From 42abfb260f873edfa80a886def7dd58b6ecf3181 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 4 Mar 2026 20:02:34 +0000 Subject: [PATCH 01/38] Initial plan From 6b470fb0b99ce4f0a0ec8dd77bd0b990e8af0c45 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 4 Mar 2026 20:51:09 +0000 Subject: [PATCH 02/38] feat(http-client-csharp): auto-generate ClientSettings classes and IConfiguration-enabled constructors - Add new ClientSettingsProvider class that generates {Client}Settings classes - Extends ClientSettings from System.ClientModel.Primitives (future type) - Properties for endpoint (Uri?) and options ({Client}Options?) - BindCore override method binding from IConfigurationSection - Marked [Experimental("SCME0002")] - Add IConfigurationSection constructor to ClientOptionsProvider - Internal constructor calling base(section) - Guards with null/Exists check - Binds non-version string properties from configuration - Marked [Experimental("SCME0002")] - Add settings constructor to ClientProvider for root clients with configurable endpoints - Calls primary constructor via this() initializer - Passes endpoint, credential (if auth), and options from settings - Marked [Experimental("SCME0002")] - Add ClientSettingsProvider output in ScmOutputLibrary.BuildClient - Add CSharpType.FromExternalType() public factory method for types not in current NuGet - Update tests to account for new constructors and generated code Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- .../src/Providers/ClientOptionsProvider.cs | 55 +++++++- .../src/Providers/ClientProvider.cs | 54 +++++++- .../src/Providers/ClientSettingsProvider.cs | 128 ++++++++++++++++++ .../src/ScmOutputLibrary.cs | 5 + .../Providers/ClientOptionsProviderTests.cs | 14 +- .../ClientProviders/ClientProviderTests.cs | 17 ++- ...ceClient_GeneratesExpectedClientOptions.cs | 8 ++ ...Services_GeneratesExpectedClientOptions.cs | 8 ++ ...edClient_GeneratesExpectedClientOptions.cs | 8 ++ ...Services_GeneratesExpectedClientOptions.cs | 8 ++ .../src/Primitives/CSharpType.cs | 14 ++ 11 files changed, 307 insertions(+), 12 deletions(-) create mode 100644 packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Providers/ClientSettingsProvider.cs diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Providers/ClientOptionsProvider.cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Providers/ClientOptionsProvider.cs index 7001641f55e..71cef389fa0 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Providers/ClientOptionsProvider.cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Providers/ClientOptionsProvider.cs @@ -11,6 +11,7 @@ using Microsoft.TypeSpec.Generator.Primitives; using Microsoft.TypeSpec.Generator.Providers; using Microsoft.TypeSpec.Generator.Shared; +using Microsoft.TypeSpec.Generator.Snippets; using Microsoft.TypeSpec.Generator.Statements; using Microsoft.TypeSpec.Generator.Utilities; using static Microsoft.TypeSpec.Generator.Snippets.Snippet; @@ -230,9 +231,11 @@ protected override TypeProvider[] BuildNestedTypes() protected override ConstructorProvider[] BuildConstructors() { + var configSectionCtor = BuildConfigurationSectionConstructor(); + if (LatestVersionsFields is null) { - return []; + return [configSectionCtor]; } var constructorBody = new List(); @@ -281,7 +284,55 @@ protected override ConstructorProvider[] BuildConstructors() new ConstructorSignature(Type, $"Initializes a new instance of {_clientProvider.Name}Options.", MethodSignatureModifiers.Public, constructorParameters), constructorBody, this); - return [constructor]; + return [constructor, configSectionCtor]; + } + + private ConstructorProvider BuildConfigurationSectionConstructor() + { + var sectionParam = new ParameterProvider( + "section", + $"The configuration section.", + ClientSettingsProvider.IConfigurationSectionType); + + var experimentalAttr = new AttributeStatement( + typeof(System.Diagnostics.CodeAnalysis.ExperimentalAttribute), + [Literal(ClientSettingsProvider.ClientSettingsDiagnosticId)]); + + // if (section is null || !section.Exists()) { return; } + var guardCondition = sectionParam.Is(Null).Or(Not(sectionParam.Invoke("Exists"))); + var guardStatement = new IfStatement(guardCondition, inline: true); + guardStatement.Add(Return()); + + var body = new List { guardStatement }; + + // Bind non-version properties from configuration + foreach (var property in Properties) + { + if (VersionProperties != null && VersionProperties.Values.Any(vp => vp.Name == property.Name)) + { + continue; + } + + // string? propValue = section["PropertyName"]; + var propValueVar = new VariableExpression(new CSharpType(typeof(string), isNullable: true), property.Name.ToVariableName() + "Value"); + body.Add(Declare(propValueVar, new IndexerExpression(sectionParam, Literal(property.Name)))); + + // if (!string.IsNullOrEmpty(propValue)) { Property = propValue; } + var ifProp = new IfStatement(Not(Static(typeof(string)).Invoke("IsNullOrEmpty", propValueVar))); + ifProp.Add(This.Property(property.Name).Assign(propValueVar).Terminate()); + body.Add(ifProp); + } + + return new ConstructorProvider( + new ConstructorSignature( + Type, + $"Initializes a new instance of {_clientProvider.Name}Options from configuration.", + MethodSignatureModifiers.Internal, + [sectionParam], + attributes: [experimentalAttr], + initializer: new ConstructorInitializer(true, [sectionParam])), + new MethodBodyStatements([.. body]), + this); } protected override PropertyProvider[] BuildProperties() diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Providers/ClientProvider.cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Providers/ClientProvider.cs index 606a888af4c..67192acdb1e 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Providers/ClientProvider.cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Providers/ClientProvider.cs @@ -4,6 +4,7 @@ using System; using System.ClientModel.Primitives; using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; using System.IO; using System.Linq; using System.Threading; @@ -102,6 +103,7 @@ public ClientProvider(InputClient inputClient) _publicCtorDescription = $"Initializes a new instance of {Name}."; ClientOptions = _inputClient.Parent is null ? ClientOptionsProvider.CreateClientOptionsProvider(_inputClient, this) : null; ClientOptionsParameter = ClientOptions != null ? ScmKnownParameters.ClientOptions(ClientOptions.Type) : null; + ClientSettings = ClientOptions != null ? new ClientSettingsProvider(_inputClient, this) : null; IsMultiServiceClient = _inputClient.IsMultiServiceClient; var apiKey = _inputAuth?.ApiKey; @@ -362,6 +364,7 @@ private IReadOnlyList GetClientParameters() /// public RestClientProvider RestClient => _restClient ??= new RestClientProvider(_inputClient, this); public ClientOptionsProvider? ClientOptions { get; } + public ClientSettingsProvider? ClientSettings { get; } public PropertyProvider PipelineProperty { get; } public FieldProvider EndpointField { get; } @@ -570,9 +573,11 @@ protected override ConstructorProvider[] BuildConstructors() var shouldIncludeMockingConstructor = !onlyContainsUnsupportedAuth && secondaryConstructors.All(c => c.Signature.Parameters.Count > 0); + var settingsConstructors = BuildSettingsConstructors(); + return shouldIncludeMockingConstructor - ? [ConstructorProviderHelper.BuildMockingConstructor(this), .. secondaryConstructors, .. primaryConstructors] - : [.. secondaryConstructors, .. primaryConstructors]; + ? [ConstructorProviderHelper.BuildMockingConstructor(this), .. secondaryConstructors, .. primaryConstructors, .. settingsConstructors] + : [.. secondaryConstructors, .. primaryConstructors, .. settingsConstructors]; void AppendConstructors( AuthFields? authFields, @@ -612,6 +617,51 @@ void AppendConstructors( } } + private IEnumerable BuildSettingsConstructors() + { + if (ClientSettings == null || ClientSettings.EndpointPropertyName == null) + { + yield break; + } + + var settingsParam = new ParameterProvider("settings", $"The settings for {Name}.", ClientSettings.Type); + var experimentalAttr = new AttributeStatement(typeof(ExperimentalAttribute), [Literal(ClientSettingsProvider.ClientSettingsDiagnosticId)]); + + // Build the arguments for the this(...) initializer to call primary constructor + var args = new List(); + + // endpoint argument - we know EndpointPropertyName is not null at this point + args.Add(new MemberExpression(new NullConditionalExpression(settingsParam), ClientSettings.EndpointPropertyName)); + + // credential argument + if (_oauth2Fields != null) + { + var credentialExpr = new MemberExpression(new NullConditionalExpression(settingsParam), "CredentialProvider"); + args.Add(new AsExpression(credentialExpr, _oauth2Fields.AuthField.Type)); + } + else if (_apiKeyAuthFields != null) + { + var credentialExpr = new MemberExpression(new NullConditionalExpression(settingsParam), "CredentialProvider"); + args.Add(new AsExpression(credentialExpr, _apiKeyAuthFields.AuthField.Type)); + } + + // options argument + args.Add(new MemberExpression(new NullConditionalExpression(settingsParam), "Options")); + + var settingsConstructor = new ConstructorProvider( + new ConstructorSignature( + Type, + $"Initializes a new instance of {Name} from settings.", + MethodSignatureModifiers.Public, + [settingsParam], + attributes: [experimentalAttr], + initializer: new ConstructorInitializer(false, args)), + MethodBodyStatement.Empty, + this); + + yield return settingsConstructor; + } + private void AppendSubClientPublicConstructors(List constructors) { // For sub-clients that can be initialized individually, we need to create public constructors diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Providers/ClientSettingsProvider.cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Providers/ClientSettingsProvider.cs new file mode 100644 index 00000000000..25f716cea80 --- /dev/null +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Providers/ClientSettingsProvider.cs @@ -0,0 +1,128 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using System; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.IO; +using System.Linq; +using Microsoft.TypeSpec.Generator.Expressions; +using Microsoft.TypeSpec.Generator.Input; +using Microsoft.TypeSpec.Generator.Input.Extensions; +using Microsoft.TypeSpec.Generator.Primitives; +using Microsoft.TypeSpec.Generator.Providers; +using Microsoft.TypeSpec.Generator.Statements; +using static Microsoft.TypeSpec.Generator.Snippets.Snippet; + +namespace Microsoft.TypeSpec.Generator.ClientModel.Providers +{ + public class ClientSettingsProvider : TypeProvider + { + internal const string ClientSettingsDiagnosticId = "SCME0002"; + + private readonly ClientProvider _clientProvider; + private readonly InputEndpointParameter? _inputEndpointParam; + + // ClientSettings base type - not yet in current NuGet package + internal static readonly CSharpType ClientSettingsType = CSharpType.FromExternalType("ClientSettings", "System.ClientModel.Primitives"); + + internal static readonly CSharpType IConfigurationSectionType = CSharpType.FromExternalType("IConfigurationSection", "Microsoft.Extensions.Configuration"); + + internal ClientSettingsProvider(InputClient inputClient, ClientProvider clientProvider) + { + _clientProvider = clientProvider; + _inputEndpointParam = inputClient.Parameters + .FirstOrDefault(p => p is InputEndpointParameter ep && ep.IsEndpoint) as InputEndpointParameter; + } + + internal string? EndpointPropertyName => _inputEndpointParam?.Name.ToIdentifierName(); + + protected override string BuildRelativeFilePath() => Path.Combine("src", "Generated", $"{Name}.cs"); + + protected override string BuildName() => $"{_clientProvider.Name}Settings"; + + protected override string BuildNamespace() => _clientProvider.Type.Namespace; + + protected override CSharpType BuildBaseType() => ClientSettingsType; + + protected override IReadOnlyList BuildAttributes() + { + return [new AttributeStatement(typeof(ExperimentalAttribute), Literal(ClientSettingsDiagnosticId))]; + } + + protected override PropertyProvider[] BuildProperties() + { + var properties = new List(); + + if (_inputEndpointParam != null) + { + properties.Add(new PropertyProvider( + null, + MethodSignatureModifiers.Public, + new CSharpType(typeof(Uri), isNullable: true), + EndpointPropertyName!, + new AutoPropertyBody(true), + this)); + } + + if (_clientProvider.ClientOptions != null) + { + properties.Add(new PropertyProvider( + null, + MethodSignatureModifiers.Public, + _clientProvider.ClientOptions.Type.WithNullable(true), + "Options", + new AutoPropertyBody(true), + this)); + } + + return [.. properties]; + } + + protected override MethodProvider[] BuildMethods() + { + var sectionParam = new ParameterProvider("section", $"The configuration section.", IConfigurationSectionType); + var body = new List(); + + if (_inputEndpointParam != null) + { + var endpointPropertyName = EndpointPropertyName!; + + // string? endpoint = section["EndpointPropertyName"]; + var endpointVar = new VariableExpression(new CSharpType(typeof(string), isNullable: true), "endpoint"); + body.Add(Declare(endpointVar, new IndexerExpression(sectionParam, Literal(endpointPropertyName)))); + + // if (!string.IsNullOrEmpty(endpoint)) { EndpointProperty = new Uri(endpoint); } + var ifStatement = new IfStatement(Not(Static(typeof(string)).Invoke("IsNullOrEmpty", endpointVar))); + ifStatement.Add(This.Property(endpointPropertyName).Assign(New.Instance(typeof(Uri), endpointVar)).Terminate()); + body.Add(ifStatement); + } + + if (_clientProvider.ClientOptions != null) + { + // IConfigurationSection optionsSection = section.GetSection("Options"); + var optionsSectionVar = new VariableExpression(IConfigurationSectionType, "optionsSection"); + body.Add(Declare(optionsSectionVar, sectionParam.Invoke("GetSection", Literal("Options")))); + + // if (optionsSection.Exists()) { Options = new ClientOptions(optionsSection); } + var ifOptionsStatement = new IfStatement(optionsSectionVar.Invoke("Exists")); + ifOptionsStatement.Add(This.Property("Options").Assign( + New.Instance(_clientProvider.ClientOptions.Type, optionsSectionVar)).Terminate()); + body.Add(ifOptionsStatement); + } + + var bindCoreMethod = new MethodProvider( + new MethodSignature( + "BindCore", + $"Binds configuration values from the given section.", + MethodSignatureModifiers.Protected | MethodSignatureModifiers.Override, + null, + null, + [sectionParam]), + new MethodBodyStatements([.. body]), + this); + + return [bindCoreMethod]; + } + } +} diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/ScmOutputLibrary.cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/ScmOutputLibrary.cs index 432561572ba..fc1d9cd87df 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/ScmOutputLibrary.cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/ScmOutputLibrary.cs @@ -41,6 +41,11 @@ private static void BuildClient(InputClient inputClient, HashSet t if (clientOptions != null) { types.Add(clientOptions); + var clientSettings = client.ClientSettings; + if (clientSettings != null) + { + types.Add(clientSettings); + } } // We use the spec view methods so that we include collection definitions even if the user is customizing or suppressing diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientOptionsProviderTests.cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientOptionsProviderTests.cs index 5f5abcd8410..69551cdb1c6 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientOptionsProviderTests.cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientOptionsProviderTests.cs @@ -137,21 +137,25 @@ public void TestConstructors(bool containsApiVersions) Assert.IsNotNull(clientOptionsProvider); var ctors = clientOptionsProvider.Constructors; + // IConfigurationSection constructor is always generated + var configSectionCtor = ctors.FirstOrDefault(c => c.Signature.Parameters.Any(p => p.Name == "section")); + Assert.IsNotNull(configSectionCtor, "IConfigurationSection constructor should always be generated"); + if (containsApiVersions) { - Assert.AreEqual(1, ctors.Count); - var ctor = ctors[0]; - var signature = ctor.Signature; + Assert.AreEqual(2, ctors.Count); + var versionCtor = ctors.First(c => c.Signature.Parameters.Any(p => p.Name == "version")); + var signature = versionCtor.Signature; Assert.AreEqual(1, signature.Parameters.Count); var versionParam = signature.Parameters[0]; Assert.AreEqual("version", versionParam.Name); Assert.AreEqual(clientOptionsProvider.NestedTypes[0].Type, versionParam.Type); Assert.IsNotNull(versionParam.DefaultValue); - Assert.IsNotNull(ctor.BodyStatements); + Assert.IsNotNull(versionCtor.BodyStatements); } else { - Assert.AreEqual(0, ctors.Count); + Assert.AreEqual(1, ctors.Count); } } diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientProviders/ClientProviderTests.cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientProviders/ClientProviderTests.cs index 9d1a8bbacdf..eb8c979a22a 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientProviders/ClientProviderTests.cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientProviders/ClientProviderTests.cs @@ -407,7 +407,9 @@ public void TestBuildConstructors_SecondaryConstructor(List inpu var primaryPublicConstructors = constructors.Where( c => c.Signature?.Initializer == null && c.Signature?.Modifiers == MethodSignatureModifiers.Public).ToArray(); var secondaryPublicConstructors = constructors.Where( - c => c.Signature?.Initializer != null && c.Signature?.Modifiers == MethodSignatureModifiers.Public).ToArray(); + c => c.Signature?.Initializer != null && + c.Signature?.Modifiers == MethodSignatureModifiers.Public && + !c.Signature.Parameters.Any(p => p.Name == "settings")).ToArray(); // Check if endpoint has a default value var endpointParam = inputParameters.FirstOrDefault(p => p is InputEndpointParameter ep && ep.IsEndpoint); @@ -543,15 +545,24 @@ public void TestBuildConstructors_SimplifiedWithOptions_WhenDefaultEndpoint() var constructors = clientProvider.Constructors; - // Get all public constructors with an initializer (secondary constructors) + // Get all public constructors with an initializer (secondary constructors), excluding settings constructor var secondaryPublicConstructors = constructors.Where( - c => c.Signature?.Initializer != null && c.Signature?.Modifiers == MethodSignatureModifiers.Public).ToList(); + c => c.Signature?.Initializer != null && + c.Signature?.Modifiers == MethodSignatureModifiers.Public && + !c.Signature.Parameters.Any(p => p.Name == "settings")).ToList(); // We should have 2 secondary constructors per auth type: // 1. Client(credential) - simple with just auth // 2. Client(credential, options) - simplified with auth + options Assert.AreEqual(2, secondaryPublicConstructors.Count); + // Verify the settings constructor also exists + var settingsConstructor = constructors.FirstOrDefault(c => + c.Signature?.Initializer != null && + c.Signature?.Modifiers == MethodSignatureModifiers.Public && + c.Signature.Parameters.Any(p => p.Name == "settings")); + Assert.IsNotNull(settingsConstructor, "Expected a settings constructor"); + // Verify the simple constructor exists (just auth) var simpleConstructor = secondaryPublicConstructors.FirstOrDefault(c => c.Signature.Parameters.Count == 1); Assert.IsNotNull(simpleConstructor, "Expected a simple constructor with just auth parameter"); diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/TestData/ClientOptionsProviderTests/MultiServiceClient_GeneratesExpectedClientOptions.cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/TestData/ClientOptionsProviderTests/MultiServiceClient_GeneratesExpectedClientOptions.cs index f3f3227ef90..d7cab0e2588 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/TestData/ClientOptionsProviderTests/MultiServiceClient_GeneratesExpectedClientOptions.cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/TestData/ClientOptionsProviderTests/MultiServiceClient_GeneratesExpectedClientOptions.cs @@ -4,6 +4,8 @@ using System; using System.ClientModel.Primitives; +using System.Diagnostics.CodeAnalysis; +using Microsoft.Extensions.Configuration; namespace Sample { @@ -28,6 +30,12 @@ public TestClientOptions(global::Sample.TestClientOptions.ServiceAVersion servic }; } + [global::System.Diagnostics.CodeAnalysis.ExperimentalAttribute("SCME0002")] + internal TestClientOptions(global::Microsoft.Extensions.Configuration.IConfigurationSection section) : base(section) + { + if (((section is null) || !section.Exists())) return; + } + internal string ServiceAApiVersion { get; } internal string ServiceBApiVersion { get; } diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/TestData/ClientOptionsProviderTests/MultiServiceClient_WithThreeServices_GeneratesExpectedClientOptions.cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/TestData/ClientOptionsProviderTests/MultiServiceClient_WithThreeServices_GeneratesExpectedClientOptions.cs index d7c4856dae2..8528a089bde 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/TestData/ClientOptionsProviderTests/MultiServiceClient_WithThreeServices_GeneratesExpectedClientOptions.cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/TestData/ClientOptionsProviderTests/MultiServiceClient_WithThreeServices_GeneratesExpectedClientOptions.cs @@ -4,6 +4,8 @@ using System; using System.ClientModel.Primitives; +using System.Diagnostics.CodeAnalysis; +using Microsoft.Extensions.Configuration; namespace Sample { @@ -36,6 +38,12 @@ public TestClientOptions(global::Sample.TestClientOptions.ServiceKeyVaultVersion }; } + [global::System.Diagnostics.CodeAnalysis.ExperimentalAttribute("SCME0002")] + internal TestClientOptions(global::Microsoft.Extensions.Configuration.IConfigurationSection section) : base(section) + { + if (((section is null) || !section.Exists())) return; + } + internal string ServiceComputeApiVersion { get; } internal string ServiceKeyVaultApiVersion { get; } diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/TestData/ClientOptionsProviderTests/MultiServiceCombinedClient_GeneratesExpectedClientOptions.cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/TestData/ClientOptionsProviderTests/MultiServiceCombinedClient_GeneratesExpectedClientOptions.cs index f3f3227ef90..d7cab0e2588 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/TestData/ClientOptionsProviderTests/MultiServiceCombinedClient_GeneratesExpectedClientOptions.cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/TestData/ClientOptionsProviderTests/MultiServiceCombinedClient_GeneratesExpectedClientOptions.cs @@ -4,6 +4,8 @@ using System; using System.ClientModel.Primitives; +using System.Diagnostics.CodeAnalysis; +using Microsoft.Extensions.Configuration; namespace Sample { @@ -28,6 +30,12 @@ public TestClientOptions(global::Sample.TestClientOptions.ServiceAVersion servic }; } + [global::System.Diagnostics.CodeAnalysis.ExperimentalAttribute("SCME0002")] + internal TestClientOptions(global::Microsoft.Extensions.Configuration.IConfigurationSection section) : base(section) + { + if (((section is null) || !section.Exists())) return; + } + internal string ServiceAApiVersion { get; } internal string ServiceBApiVersion { get; } diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/TestData/ClientOptionsProviderTests/MultiServiceCombinedClient_WithThreeServices_GeneratesExpectedClientOptions.cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/TestData/ClientOptionsProviderTests/MultiServiceCombinedClient_WithThreeServices_GeneratesExpectedClientOptions.cs index d7c4856dae2..8528a089bde 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/TestData/ClientOptionsProviderTests/MultiServiceCombinedClient_WithThreeServices_GeneratesExpectedClientOptions.cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/TestData/ClientOptionsProviderTests/MultiServiceCombinedClient_WithThreeServices_GeneratesExpectedClientOptions.cs @@ -4,6 +4,8 @@ using System; using System.ClientModel.Primitives; +using System.Diagnostics.CodeAnalysis; +using Microsoft.Extensions.Configuration; namespace Sample { @@ -36,6 +38,12 @@ public TestClientOptions(global::Sample.TestClientOptions.ServiceKeyVaultVersion }; } + [global::System.Diagnostics.CodeAnalysis.ExperimentalAttribute("SCME0002")] + internal TestClientOptions(global::Microsoft.Extensions.Configuration.IConfigurationSection section) : base(section) + { + if (((section is null) || !section.Exists())) return; + } + internal string ServiceComputeApiVersion { get; } internal string ServiceKeyVaultApiVersion { get; } diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator/src/Primitives/CSharpType.cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator/src/Primitives/CSharpType.cs index 2c4de605e0d..4543eb15ade 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator/src/Primitives/CSharpType.cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator/src/Primitives/CSharpType.cs @@ -663,6 +663,20 @@ public static CSharpType FromUnion(IReadOnlyList unionItemTypes, boo return type; } + /// + /// Creates a for a type that is not available as a .NET object, + /// such as a type from a package not yet referenced or a future API surface. + /// + /// The type name. + /// The namespace of the type. + /// Whether the type is nullable. + /// Whether the type is public. + /// A representing the external type. + public static CSharpType FromExternalType(string name, string @namespace, bool isNullable = false, bool isPublic = true) + { + return new CSharpType(name, @namespace, false, isNullable, null, Array.Empty(), isPublic, false); + } + public CSharpType MakeGenericType(IReadOnlyList arguments) { if (IsFrameworkType) From c8d145554c45504d016a0286420938c26d99f378 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 4 Mar 2026 20:53:42 +0000 Subject: [PATCH 03/38] refactor(http-client-csharp): address code review comments for ClientSettings feature - Use HashSet for O(1) version property name lookup in BuildConfigurationSectionConstructor - Rename local variable from 'propValue' suffix to 'FromConfig' for clarity - Extract IsSettingsConstructor helper in test for maintainability Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- .../src/Providers/ClientOptionsProvider.cs | 7 +++++-- .../ClientProviders/ClientProviderTests.cs | 14 ++++++++------ 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Providers/ClientOptionsProvider.cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Providers/ClientOptionsProvider.cs index 71cef389fa0..05304e8ff80 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Providers/ClientOptionsProvider.cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Providers/ClientOptionsProvider.cs @@ -305,16 +305,19 @@ private ConstructorProvider BuildConfigurationSectionConstructor() var body = new List { guardStatement }; + // Build a set of version property names for O(1) lookup + var versionPropertyNames = VersionProperties?.Values.Select(vp => vp.Name).ToHashSet(); + // Bind non-version properties from configuration foreach (var property in Properties) { - if (VersionProperties != null && VersionProperties.Values.Any(vp => vp.Name == property.Name)) + if (versionPropertyNames?.Contains(property.Name) == true) { continue; } // string? propValue = section["PropertyName"]; - var propValueVar = new VariableExpression(new CSharpType(typeof(string), isNullable: true), property.Name.ToVariableName() + "Value"); + var propValueVar = new VariableExpression(new CSharpType(typeof(string), isNullable: true), $"{property.Name.ToVariableName()}FromConfig"); body.Add(Declare(propValueVar, new IndexerExpression(sectionParam, Literal(property.Name)))); // if (!string.IsNullOrEmpty(propValue)) { Property = propValue; } diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientProviders/ClientProviderTests.cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientProviders/ClientProviderTests.cs index eb8c979a22a..3f5bf0e4a88 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientProviders/ClientProviderTests.cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientProviders/ClientProviderTests.cs @@ -409,7 +409,7 @@ public void TestBuildConstructors_SecondaryConstructor(List inpu var secondaryPublicConstructors = constructors.Where( c => c.Signature?.Initializer != null && c.Signature?.Modifiers == MethodSignatureModifiers.Public && - !c.Signature.Parameters.Any(p => p.Name == "settings")).ToArray(); + !IsSettingsConstructor(c)).ToArray(); // Check if endpoint has a default value var endpointParam = inputParameters.FirstOrDefault(p => p is InputEndpointParameter ep && ep.IsEndpoint); @@ -549,7 +549,7 @@ public void TestBuildConstructors_SimplifiedWithOptions_WhenDefaultEndpoint() var secondaryPublicConstructors = constructors.Where( c => c.Signature?.Initializer != null && c.Signature?.Modifiers == MethodSignatureModifiers.Public && - !c.Signature.Parameters.Any(p => p.Name == "settings")).ToList(); + !IsSettingsConstructor(c)).ToList(); // We should have 2 secondary constructors per auth type: // 1. Client(credential) - simple with just auth @@ -557,10 +557,7 @@ public void TestBuildConstructors_SimplifiedWithOptions_WhenDefaultEndpoint() Assert.AreEqual(2, secondaryPublicConstructors.Count); // Verify the settings constructor also exists - var settingsConstructor = constructors.FirstOrDefault(c => - c.Signature?.Initializer != null && - c.Signature?.Modifiers == MethodSignatureModifiers.Public && - c.Signature.Parameters.Any(p => p.Name == "settings")); + var settingsConstructor = constructors.FirstOrDefault(IsSettingsConstructor); Assert.IsNotNull(settingsConstructor, "Expected a settings constructor"); // Verify the simple constructor exists (just auth) @@ -1031,6 +1028,11 @@ private void ValidateSecondaryConstructor( Assert.IsTrue(primaryConstructors.Any(pc => pc.Signature.Parameters.Count == initializer?.Arguments.Count)); } + private static bool IsSettingsConstructor(ConstructorProvider c) => + c.Signature?.Initializer != null && + c.Signature?.Modifiers == MethodSignatureModifiers.Public && + c.Signature.Parameters.Any(p => p.Name == "settings"); + [TestCaseSource(nameof(EndpointParamInitializationValueTestCases))] public void EndpointInitializationValue(InputParameter endpointParameter, ValueExpression? expectedValue) { From 78afaca68f7518ddd9d27e1c22568a11e8a0aee9 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 5 Mar 2026 03:40:11 +0000 Subject: [PATCH 04/38] refactor(http-client-csharp): use typeof(ClientSettings) from System.ClientModel 1.9.0 instead of string-based type reference Co-authored-by: JoshLove-msft <54595583+JoshLove-msft@users.noreply.github.com> --- .../src/Providers/ClientSettingsProvider.cs | 9 ++++++--- .../src/Primitives/CSharpType.cs | 14 -------------- 2 files changed, 6 insertions(+), 17 deletions(-) diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Providers/ClientSettingsProvider.cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Providers/ClientSettingsProvider.cs index 25f716cea80..5920fe4de8a 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Providers/ClientSettingsProvider.cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Providers/ClientSettingsProvider.cs @@ -2,10 +2,12 @@ // Licensed under the MIT License. using System; +using System.ClientModel.Primitives; using System.Collections.Generic; using System.Diagnostics.CodeAnalysis; using System.IO; using System.Linq; +using Microsoft.Extensions.Configuration; using Microsoft.TypeSpec.Generator.Expressions; using Microsoft.TypeSpec.Generator.Input; using Microsoft.TypeSpec.Generator.Input.Extensions; @@ -23,10 +25,11 @@ public class ClientSettingsProvider : TypeProvider private readonly ClientProvider _clientProvider; private readonly InputEndpointParameter? _inputEndpointParam; - // ClientSettings base type - not yet in current NuGet package - internal static readonly CSharpType ClientSettingsType = CSharpType.FromExternalType("ClientSettings", "System.ClientModel.Primitives"); +#pragma warning disable SCME0002 // ClientSettings is for evaluation purposes only + internal static readonly CSharpType ClientSettingsType = typeof(ClientSettings); +#pragma warning restore SCME0002 - internal static readonly CSharpType IConfigurationSectionType = CSharpType.FromExternalType("IConfigurationSection", "Microsoft.Extensions.Configuration"); + internal static readonly CSharpType IConfigurationSectionType = typeof(IConfigurationSection); internal ClientSettingsProvider(InputClient inputClient, ClientProvider clientProvider) { diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator/src/Primitives/CSharpType.cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator/src/Primitives/CSharpType.cs index 4543eb15ade..2c4de605e0d 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator/src/Primitives/CSharpType.cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator/src/Primitives/CSharpType.cs @@ -663,20 +663,6 @@ public static CSharpType FromUnion(IReadOnlyList unionItemTypes, boo return type; } - /// - /// Creates a for a type that is not available as a .NET object, - /// such as a type from a package not yet referenced or a future API surface. - /// - /// The type name. - /// The namespace of the type. - /// Whether the type is nullable. - /// Whether the type is public. - /// A representing the external type. - public static CSharpType FromExternalType(string name, string @namespace, bool isNullable = false, bool isPublic = true) - { - return new CSharpType(name, @namespace, false, isNullable, null, Array.Empty(), isPublic, false); - } - public CSharpType MakeGenericType(IReadOnlyList arguments) { if (IsFrameworkType) From 9dc25d6143c614835017dd1bead1ec6819cc09ae Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 5 Mar 2026 04:04:02 +0000 Subject: [PATCH 05/38] fix(http-client-csharp): add explicit package dependency, fix inline guard, fix API key credential in settings constructor, fix missing default ctor Co-authored-by: JoshLove-msft <54595583+JoshLove-msft@users.noreply.github.com> --- ...soft.TypeSpec.Generator.ClientModel.csproj | 1 + .../src/Providers/ClientOptionsProvider.cs | 8 +++- .../src/Providers/ClientProvider.cs | 9 +++- .../Providers/ClientOptionsProviderTests.cs | 4 +- ...ceClient_GeneratesExpectedClientOptions.cs | 5 ++- ...Services_GeneratesExpectedClientOptions.cs | 5 ++- ...edClient_GeneratesExpectedClientOptions.cs | 5 ++- ...Services_GeneratesExpectedClientOptions.cs | 5 ++- .../generator/Packages.Data.props | 1 + .../src/Generated/SampleTypeSpecClient.cs | 8 ++++ .../Generated/SampleTypeSpecClientOptions.cs | 13 ++++++ .../Generated/SampleTypeSpecClientSettings.cs | 41 +++++++++++++++++++ .../api-key/src/Generated/ApiKeyClient.cs | 4 ++ .../src/Generated/ApiKeyClientOptions.cs | 4 ++ .../src/Generated/ApiKeyClientSettings.cs | 29 +++++++++++++ .../http/custom/src/Generated/CustomClient.cs | 4 ++ .../src/Generated/CustomClientOptions.cs | 4 ++ .../src/Generated/CustomClientSettings.cs | 29 +++++++++++++ .../oauth2/src/Generated/OAuth2Client.cs | 4 ++ .../src/Generated/OAuth2ClientOptions.cs | 4 ++ .../src/Generated/OAuth2ClientSettings.cs | 29 +++++++++++++ .../union/src/Generated/UnionClient.cs | 4 ++ .../union/src/Generated/UnionClientOptions.cs | 4 ++ .../src/Generated/UnionClientSettings.cs | 29 +++++++++++++ .../src/Generated/FirstClient.cs | 4 ++ .../src/Generated/FirstClientOptions.cs | 4 ++ .../src/Generated/FirstClientSettings.cs | 29 +++++++++++++ .../src/Generated/SubNamespaceSecondClient.cs | 4 ++ .../SubNamespaceSecondClientOptions.cs | 4 ++ .../SubNamespaceSecondClientSettings.cs | 29 +++++++++++++ .../default/src/Generated/ServiceClient.cs | 4 ++ .../src/Generated/ServiceClientOptions.cs | 4 ++ .../src/Generated/ServiceClientSettings.cs | 29 +++++++++++++ .../src/Generated/ClientAClient.cs | 4 ++ .../src/Generated/ClientAClientOptions.cs | 4 ++ .../src/Generated/ClientAClientSettings.cs | 29 +++++++++++++ .../src/Generated/ClientBClient.cs | 4 ++ .../src/Generated/ClientBClientOptions.cs | 4 ++ .../src/Generated/ClientBClientSettings.cs | 29 +++++++++++++ .../src/Generated/RenamedOperationClient.cs | 4 ++ .../RenamedOperationClientOptions.cs | 4 ++ .../RenamedOperationClientSettings.cs | 29 +++++++++++++ .../src/Generated/TwoOperationGroupClient.cs | 4 ++ .../TwoOperationGroupClientOptions.cs | 4 ++ .../TwoOperationGroupClientSettings.cs | 29 +++++++++++++ .../src/Generated/DocumentationClient.cs | 4 ++ .../Generated/DocumentationClientOptions.cs | 4 ++ .../Generated/DocumentationClientSettings.cs | 29 +++++++++++++ .../encode/array/src/Generated/ArrayClient.cs | 4 ++ .../array/src/Generated/ArrayClientOptions.cs | 4 ++ .../src/Generated/ArrayClientSettings.cs | 29 +++++++++++++ .../encode/bytes/src/Generated/BytesClient.cs | 4 ++ .../bytes/src/Generated/BytesClientOptions.cs | 4 ++ .../src/Generated/BytesClientSettings.cs | 29 +++++++++++++ .../datetime/src/Generated/DatetimeClient.cs | 4 ++ .../src/Generated/DatetimeClientOptions.cs | 4 ++ .../src/Generated/DatetimeClientSettings.cs | 29 +++++++++++++ .../duration/src/Generated/DurationClient.cs | 4 ++ .../src/Generated/DurationClientOptions.cs | 4 ++ .../src/Generated/DurationClientSettings.cs | 29 +++++++++++++ .../numeric/src/Generated/NumericClient.cs | 4 ++ .../src/Generated/NumericClientOptions.cs | 4 ++ .../src/Generated/NumericClientSettings.cs | 29 +++++++++++++ .../basic/src/Generated/BasicClient.cs | 4 ++ .../basic/src/Generated/BasicClientOptions.cs | 4 ++ .../src/Generated/BasicClientSettings.cs | 29 +++++++++++++ .../src/Generated/BodyOptionalityClient.cs | 4 ++ .../Generated/BodyOptionalityClientOptions.cs | 4 ++ .../BodyOptionalityClientSettings.cs | 29 +++++++++++++ .../src/Generated/CollectionFormatClient.cs | 4 ++ .../CollectionFormatClientOptions.cs | 4 ++ .../CollectionFormatClientSettings.cs | 29 +++++++++++++ .../path/src/Generated/PathClient.cs | 4 ++ .../path/src/Generated/PathClientOptions.cs | 4 ++ .../path/src/Generated/PathClientSettings.cs | 29 +++++++++++++ .../query/src/Generated/QueryClient.cs | 4 ++ .../query/src/Generated/QueryClientOptions.cs | 4 ++ .../src/Generated/QueryClientSettings.cs | 29 +++++++++++++ .../spread/src/Generated/SpreadClient.cs | 4 ++ .../src/Generated/SpreadClientOptions.cs | 4 ++ .../src/Generated/SpreadClientSettings.cs | 29 +++++++++++++ .../src/Generated/ContentNegotiationClient.cs | 4 ++ .../ContentNegotiationClientOptions.cs | 4 ++ .../ContentNegotiationClientSettings.cs | 29 +++++++++++++ .../src/Generated/JsonMergePatchClient.cs | 4 ++ .../Generated/JsonMergePatchClientOptions.cs | 4 ++ .../Generated/JsonMergePatchClientSettings.cs | 29 +++++++++++++ .../src/Generated/MediaTypeClient.cs | 4 ++ .../src/Generated/MediaTypeClientOptions.cs | 4 ++ .../src/Generated/MediaTypeClientSettings.cs | 29 +++++++++++++ .../src/Generated/MultiPartClient.cs | 4 ++ .../src/Generated/MultiPartClientOptions.cs | 4 ++ .../src/Generated/MultiPartClientSettings.cs | 29 +++++++++++++ .../pageable/src/Generated/PageableClient.cs | 4 ++ .../src/Generated/PageableClientOptions.cs | 4 ++ .../src/Generated/PageableClientSettings.cs | 29 +++++++++++++ .../payload/xml/src/Generated/XmlClient.cs | 4 ++ .../xml/src/Generated/XmlClientOptions.cs | 4 ++ .../xml/src/Generated/XmlClientSettings.cs | 29 +++++++++++++ .../ResiliencyServiceDrivenClient.cs | 4 ++ .../ResiliencyServiceDrivenClientOptions.cs | 5 +++ .../ResiliencyServiceDrivenClientSettings.cs | 29 +++++++++++++ .../ResiliencyServiceDrivenClient.cs | 4 ++ .../ResiliencyServiceDrivenClientOptions.cs | 5 +++ .../ResiliencyServiceDrivenClientSettings.cs | 29 +++++++++++++ .../src/Generated/StatusCodeRangeClient.cs | 4 ++ .../Generated/StatusCodeRangeClientOptions.cs | 4 ++ .../StatusCodeRangeClientSettings.cs | 29 +++++++++++++ .../http/routes/src/Generated/RoutesClient.cs | 4 ++ .../src/Generated/RoutesClientOptions.cs | 4 ++ .../src/Generated/RoutesClientSettings.cs | 29 +++++++++++++ .../json/src/Generated/JsonClient.cs | 4 ++ .../json/src/Generated/JsonClientOptions.cs | 4 ++ .../json/src/Generated/JsonClientSettings.cs | 29 +++++++++++++ .../src/Generated/NotDefinedClient.cs | 4 ++ .../src/Generated/NotDefinedClientOptions.cs | 4 ++ .../src/Generated/NotDefinedClientSettings.cs | 29 +++++++++++++ .../multiple/src/Generated/MultipleClient.cs | 4 ++ .../src/Generated/MultipleClientOptions.cs | 5 +++ .../src/Generated/MultipleClientSettings.cs | 29 +++++++++++++ .../path/single/src/Generated/SingleClient.cs | 4 ++ .../src/Generated/SingleClientOptions.cs | 4 ++ .../src/Generated/SingleClientSettings.cs | 29 +++++++++++++ .../src/Generated/NotVersionedClient.cs | 4 ++ .../Generated/NotVersionedClientOptions.cs | 4 ++ .../Generated/NotVersionedClientSettings.cs | 29 +++++++++++++ .../src/Generated/VersionedClient.cs | 4 ++ .../src/Generated/VersionedClientOptions.cs | 5 +++ .../src/Generated/VersionedClientSettings.cs | 29 +++++++++++++ .../src/Generated/ConditionalRequestClient.cs | 4 ++ .../ConditionalRequestClientOptions.cs | 4 ++ .../ConditionalRequestClientSettings.cs | 29 +++++++++++++ .../src/Generated/RepeatabilityClient.cs | 4 ++ .../Generated/RepeatabilityClientOptions.cs | 4 ++ .../Generated/RepeatabilityClientSettings.cs | 29 +++++++++++++ .../src/Generated/SpecialWordsClient.cs | 4 ++ .../Generated/SpecialWordsClientOptions.cs | 4 ++ .../Generated/SpecialWordsClientSettings.cs | 29 +++++++++++++ .../type/array/src/Generated/ArrayClient.cs | 4 ++ .../array/src/Generated/ArrayClientOptions.cs | 4 ++ .../src/Generated/ArrayClientSettings.cs | 29 +++++++++++++ .../src/Generated/DictionaryClient.cs | 4 ++ .../src/Generated/DictionaryClientOptions.cs | 4 ++ .../src/Generated/DictionaryClientSettings.cs | 29 +++++++++++++ .../src/Generated/ExtensibleClient.cs | 4 ++ .../src/Generated/ExtensibleClientOptions.cs | 4 ++ .../src/Generated/ExtensibleClientSettings.cs | 29 +++++++++++++ .../enum/fixed/src/Generated/FixedClient.cs | 4 ++ .../fixed/src/Generated/FixedClientOptions.cs | 4 ++ .../src/Generated/FixedClientSettings.cs | 29 +++++++++++++ .../model/empty/src/Generated/EmptyClient.cs | 4 ++ .../empty/src/Generated/EmptyClientOptions.cs | 4 ++ .../src/Generated/EmptyClientSettings.cs | 29 +++++++++++++ .../src/Generated/EnumDiscriminatorClient.cs | 4 ++ .../EnumDiscriminatorClientOptions.cs | 4 ++ .../EnumDiscriminatorClientSettings.cs | 29 +++++++++++++ .../Generated/NestedDiscriminatorClient.cs | 4 ++ .../NestedDiscriminatorClientOptions.cs | 4 ++ .../NestedDiscriminatorClientSettings.cs | 29 +++++++++++++ .../src/Generated/NotDiscriminatedClient.cs | 4 ++ .../NotDiscriminatedClientOptions.cs | 4 ++ .../NotDiscriminatedClientSettings.cs | 29 +++++++++++++ .../src/Generated/RecursiveClient.cs | 4 ++ .../src/Generated/RecursiveClientOptions.cs | 4 ++ .../src/Generated/RecursiveClientSettings.cs | 29 +++++++++++++ .../Generated/SingleDiscriminatorClient.cs | 4 ++ .../SingleDiscriminatorClientOptions.cs | 4 ++ .../SingleDiscriminatorClientSettings.cs | 29 +++++++++++++ .../model/usage/src/Generated/UsageClient.cs | 4 ++ .../usage/src/Generated/UsageClientOptions.cs | 4 ++ .../src/Generated/UsageClientSettings.cs | 29 +++++++++++++ .../src/Generated/VisibilityClient.cs | 4 ++ .../src/Generated/VisibilityClientOptions.cs | 4 ++ .../src/Generated/VisibilityClientSettings.cs | 29 +++++++++++++ .../Generated/AdditionalPropertiesClient.cs | 4 ++ .../AdditionalPropertiesClientOptions.cs | 4 ++ .../AdditionalPropertiesClientSettings.cs | 29 +++++++++++++ .../nullable/src/Generated/NullableClient.cs | 4 ++ .../src/Generated/NullableClientOptions.cs | 4 ++ .../src/Generated/NullableClientSettings.cs | 29 +++++++++++++ .../src/Generated/OptionalClient.cs | 4 ++ .../src/Generated/OptionalClientOptions.cs | 4 ++ .../src/Generated/OptionalClientSettings.cs | 29 +++++++++++++ .../src/Generated/ValueTypesClient.cs | 4 ++ .../src/Generated/ValueTypesClientOptions.cs | 4 ++ .../src/Generated/ValueTypesClientSettings.cs | 29 +++++++++++++ .../type/scalar/src/Generated/ScalarClient.cs | 4 ++ .../src/Generated/ScalarClientOptions.cs | 4 ++ .../src/Generated/ScalarClientSettings.cs | 29 +++++++++++++ .../type/union/src/Generated/UnionClient.cs | 4 ++ .../union/src/Generated/UnionClientOptions.cs | 4 ++ .../src/Generated/UnionClientSettings.cs | 29 +++++++++++++ .../added/v1/src/Generated/AddedClient.cs | 4 ++ .../v1/src/Generated/AddedClientOptions.cs | 5 +++ .../v1/src/Generated/AddedClientSettings.cs | 29 +++++++++++++ .../added/v2/src/Generated/AddedClient.cs | 4 ++ .../v2/src/Generated/AddedClientOptions.cs | 5 +++ .../v2/src/Generated/AddedClientSettings.cs | 29 +++++++++++++ .../v1/src/Generated/MadeOptionalClient.cs | 4 ++ .../Generated/MadeOptionalClientOptions.cs | 5 +++ .../Generated/MadeOptionalClientSettings.cs | 29 +++++++++++++ .../v2/src/Generated/MadeOptionalClient.cs | 4 ++ .../Generated/MadeOptionalClientOptions.cs | 5 +++ .../Generated/MadeOptionalClientSettings.cs | 29 +++++++++++++ .../removed/v1/src/Generated/RemovedClient.cs | 4 ++ .../v1/src/Generated/RemovedClientOptions.cs | 5 +++ .../v1/src/Generated/RemovedClientSettings.cs | 29 +++++++++++++ .../removed/v2/src/Generated/RemovedClient.cs | 4 ++ .../v2/src/Generated/RemovedClientOptions.cs | 5 +++ .../v2/src/Generated/RemovedClientSettings.cs | 29 +++++++++++++ .../v2Preview/src/Generated/RemovedClient.cs | 4 ++ .../src/Generated/RemovedClientOptions.cs | 5 +++ .../src/Generated/RemovedClientSettings.cs | 29 +++++++++++++ .../v1/src/Generated/RenamedFromClient.cs | 4 ++ .../src/Generated/RenamedFromClientOptions.cs | 5 +++ .../Generated/RenamedFromClientSettings.cs | 29 +++++++++++++ .../v2/src/Generated/RenamedFromClient.cs | 4 ++ .../src/Generated/RenamedFromClientOptions.cs | 5 +++ .../Generated/RenamedFromClientSettings.cs | 29 +++++++++++++ .../Generated/ReturnTypeChangedFromClient.cs | 4 ++ .../ReturnTypeChangedFromClientOptions.cs | 5 +++ .../ReturnTypeChangedFromClientSettings.cs | 29 +++++++++++++ .../Generated/ReturnTypeChangedFromClient.cs | 4 ++ .../ReturnTypeChangedFromClientOptions.cs | 5 +++ .../ReturnTypeChangedFromClientSettings.cs | 29 +++++++++++++ .../v1/src/Generated/TypeChangedFromClient.cs | 4 ++ .../Generated/TypeChangedFromClientOptions.cs | 5 +++ .../TypeChangedFromClientSettings.cs | 29 +++++++++++++ .../v2/src/Generated/TypeChangedFromClient.cs | 4 ++ .../Generated/TypeChangedFromClientOptions.cs | 5 +++ .../TypeChangedFromClientSettings.cs | 29 +++++++++++++ 231 files changed, 2814 insertions(+), 9 deletions(-) create mode 100644 packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/SampleTypeSpecClientSettings.cs create mode 100644 packages/http-client-csharp/generator/TestProjects/Spector/http/authentication/api-key/src/Generated/ApiKeyClientSettings.cs create mode 100644 packages/http-client-csharp/generator/TestProjects/Spector/http/authentication/http/custom/src/Generated/CustomClientSettings.cs create mode 100644 packages/http-client-csharp/generator/TestProjects/Spector/http/authentication/oauth2/src/Generated/OAuth2ClientSettings.cs create mode 100644 packages/http-client-csharp/generator/TestProjects/Spector/http/authentication/union/src/Generated/UnionClientSettings.cs create mode 100644 packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/client-operation-group/src/Generated/FirstClientSettings.cs create mode 100644 packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/client-operation-group/src/Generated/SubNamespaceSecondClientSettings.cs create mode 100644 packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/default/src/Generated/ServiceClientSettings.cs create mode 100644 packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/multi-client/src/Generated/ClientAClientSettings.cs create mode 100644 packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/multi-client/src/Generated/ClientBClientSettings.cs create mode 100644 packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/renamed-operation/src/Generated/RenamedOperationClientSettings.cs create mode 100644 packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/two-operation-group/src/Generated/TwoOperationGroupClientSettings.cs create mode 100644 packages/http-client-csharp/generator/TestProjects/Spector/http/documentation/src/Generated/DocumentationClientSettings.cs create mode 100644 packages/http-client-csharp/generator/TestProjects/Spector/http/encode/array/src/Generated/ArrayClientSettings.cs create mode 100644 packages/http-client-csharp/generator/TestProjects/Spector/http/encode/bytes/src/Generated/BytesClientSettings.cs create mode 100644 packages/http-client-csharp/generator/TestProjects/Spector/http/encode/datetime/src/Generated/DatetimeClientSettings.cs create mode 100644 packages/http-client-csharp/generator/TestProjects/Spector/http/encode/duration/src/Generated/DurationClientSettings.cs create mode 100644 packages/http-client-csharp/generator/TestProjects/Spector/http/encode/numeric/src/Generated/NumericClientSettings.cs create mode 100644 packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/basic/src/Generated/BasicClientSettings.cs create mode 100644 packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/body-optionality/src/Generated/BodyOptionalityClientSettings.cs create mode 100644 packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/collection-format/src/Generated/CollectionFormatClientSettings.cs create mode 100644 packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/path/src/Generated/PathClientSettings.cs create mode 100644 packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/query/src/Generated/QueryClientSettings.cs create mode 100644 packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/spread/src/Generated/SpreadClientSettings.cs create mode 100644 packages/http-client-csharp/generator/TestProjects/Spector/http/payload/content-negotiation/src/Generated/ContentNegotiationClientSettings.cs create mode 100644 packages/http-client-csharp/generator/TestProjects/Spector/http/payload/json-merge-patch/src/Generated/JsonMergePatchClientSettings.cs create mode 100644 packages/http-client-csharp/generator/TestProjects/Spector/http/payload/media-type/src/Generated/MediaTypeClientSettings.cs create mode 100644 packages/http-client-csharp/generator/TestProjects/Spector/http/payload/multipart/src/Generated/MultiPartClientSettings.cs create mode 100644 packages/http-client-csharp/generator/TestProjects/Spector/http/payload/pageable/src/Generated/PageableClientSettings.cs create mode 100644 packages/http-client-csharp/generator/TestProjects/Spector/http/payload/xml/src/Generated/XmlClientSettings.cs create mode 100644 packages/http-client-csharp/generator/TestProjects/Spector/http/resiliency/srv-driven/v1/src/Generated/ResiliencyServiceDrivenClientSettings.cs create mode 100644 packages/http-client-csharp/generator/TestProjects/Spector/http/resiliency/srv-driven/v2/src/Generated/ResiliencyServiceDrivenClientSettings.cs create mode 100644 packages/http-client-csharp/generator/TestProjects/Spector/http/response/status-code-range/src/Generated/StatusCodeRangeClientSettings.cs create mode 100644 packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/RoutesClientSettings.cs create mode 100644 packages/http-client-csharp/generator/TestProjects/Spector/http/serialization/encoded-name/json/src/Generated/JsonClientSettings.cs create mode 100644 packages/http-client-csharp/generator/TestProjects/Spector/http/server/endpoint/not-defined/src/Generated/NotDefinedClientSettings.cs create mode 100644 packages/http-client-csharp/generator/TestProjects/Spector/http/server/path/multiple/src/Generated/MultipleClientSettings.cs create mode 100644 packages/http-client-csharp/generator/TestProjects/Spector/http/server/path/single/src/Generated/SingleClientSettings.cs create mode 100644 packages/http-client-csharp/generator/TestProjects/Spector/http/server/versions/not-versioned/src/Generated/NotVersionedClientSettings.cs create mode 100644 packages/http-client-csharp/generator/TestProjects/Spector/http/server/versions/versioned/src/Generated/VersionedClientSettings.cs create mode 100644 packages/http-client-csharp/generator/TestProjects/Spector/http/special-headers/conditional-request/src/Generated/ConditionalRequestClientSettings.cs create mode 100644 packages/http-client-csharp/generator/TestProjects/Spector/http/special-headers/repeatability/src/Generated/RepeatabilityClientSettings.cs create mode 100644 packages/http-client-csharp/generator/TestProjects/Spector/http/special-words/src/Generated/SpecialWordsClientSettings.cs create mode 100644 packages/http-client-csharp/generator/TestProjects/Spector/http/type/array/src/Generated/ArrayClientSettings.cs create mode 100644 packages/http-client-csharp/generator/TestProjects/Spector/http/type/dictionary/src/Generated/DictionaryClientSettings.cs create mode 100644 packages/http-client-csharp/generator/TestProjects/Spector/http/type/enum/extensible/src/Generated/ExtensibleClientSettings.cs create mode 100644 packages/http-client-csharp/generator/TestProjects/Spector/http/type/enum/fixed/src/Generated/FixedClientSettings.cs create mode 100644 packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/empty/src/Generated/EmptyClientSettings.cs create mode 100644 packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/inheritance/enum-discriminator/src/Generated/EnumDiscriminatorClientSettings.cs create mode 100644 packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/inheritance/nested-discriminator/src/Generated/NestedDiscriminatorClientSettings.cs create mode 100644 packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/inheritance/not-discriminated/src/Generated/NotDiscriminatedClientSettings.cs create mode 100644 packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/inheritance/recursive/src/Generated/RecursiveClientSettings.cs create mode 100644 packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/inheritance/single-discriminator/src/Generated/SingleDiscriminatorClientSettings.cs create mode 100644 packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/usage/src/Generated/UsageClientSettings.cs create mode 100644 packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/visibility/src/Generated/VisibilityClientSettings.cs create mode 100644 packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/AdditionalPropertiesClientSettings.cs create mode 100644 packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/nullable/src/Generated/NullableClientSettings.cs create mode 100644 packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/optionality/src/Generated/OptionalClientSettings.cs create mode 100644 packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/ValueTypesClientSettings.cs create mode 100644 packages/http-client-csharp/generator/TestProjects/Spector/http/type/scalar/src/Generated/ScalarClientSettings.cs create mode 100644 packages/http-client-csharp/generator/TestProjects/Spector/http/type/union/src/Generated/UnionClientSettings.cs create mode 100644 packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/added/v1/src/Generated/AddedClientSettings.cs create mode 100644 packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/added/v2/src/Generated/AddedClientSettings.cs create mode 100644 packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/madeOptional/v1/src/Generated/MadeOptionalClientSettings.cs create mode 100644 packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/madeOptional/v2/src/Generated/MadeOptionalClientSettings.cs create mode 100644 packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/removed/v1/src/Generated/RemovedClientSettings.cs create mode 100644 packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/removed/v2/src/Generated/RemovedClientSettings.cs create mode 100644 packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/removed/v2Preview/src/Generated/RemovedClientSettings.cs create mode 100644 packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/renamedFrom/v1/src/Generated/RenamedFromClientSettings.cs create mode 100644 packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/renamedFrom/v2/src/Generated/RenamedFromClientSettings.cs create mode 100644 packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/returnTypeChangedFrom/v1/src/Generated/ReturnTypeChangedFromClientSettings.cs create mode 100644 packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/returnTypeChangedFrom/v2/src/Generated/ReturnTypeChangedFromClientSettings.cs create mode 100644 packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/typeChangedFrom/v1/src/Generated/TypeChangedFromClientSettings.cs create mode 100644 packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/typeChangedFrom/v2/src/Generated/TypeChangedFromClientSettings.cs diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Microsoft.TypeSpec.Generator.ClientModel.csproj b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Microsoft.TypeSpec.Generator.ClientModel.csproj index a14cd844c1c..3179721bdfb 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Microsoft.TypeSpec.Generator.ClientModel.csproj +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Microsoft.TypeSpec.Generator.ClientModel.csproj @@ -9,6 +9,7 @@ + diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Providers/ClientOptionsProvider.cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Providers/ClientOptionsProvider.cs index 05304e8ff80..a0d0a6bf1e8 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Providers/ClientOptionsProvider.cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Providers/ClientOptionsProvider.cs @@ -235,7 +235,11 @@ protected override ConstructorProvider[] BuildConstructors() if (LatestVersionsFields is null) { - return [configSectionCtor]; + var defaultCtor = new ConstructorProvider( + new ConstructorSignature(Type, $"Initializes a new instance of {_clientProvider.Name}Options.", MethodSignatureModifiers.Public, []), + MethodBodyStatement.Empty, + this); + return [defaultCtor, configSectionCtor]; } var constructorBody = new List(); @@ -300,7 +304,7 @@ private ConstructorProvider BuildConfigurationSectionConstructor() // if (section is null || !section.Exists()) { return; } var guardCondition = sectionParam.Is(Null).Or(Not(sectionParam.Invoke("Exists"))); - var guardStatement = new IfStatement(guardCondition, inline: true); + var guardStatement = new IfStatement(guardCondition); guardStatement.Add(Return()); var body = new List { guardStatement }; diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Providers/ClientProvider.cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Providers/ClientProvider.cs index 67192acdb1e..f6d93e4e8f5 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Providers/ClientProvider.cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Providers/ClientProvider.cs @@ -641,8 +641,13 @@ private IEnumerable BuildSettingsConstructors() } else if (_apiKeyAuthFields != null) { - var credentialExpr = new MemberExpression(new NullConditionalExpression(settingsParam), "CredentialProvider"); - args.Add(new AsExpression(credentialExpr, _apiKeyAuthFields.AuthField.Type)); + // settings?.Credential?.Key is string key ? new ApiKeyCredential(key) : null + var credentialExpr = new MemberExpression(new NullConditionalExpression(settingsParam), "Credential"); + var keyExpr = new MemberExpression(new NullConditionalExpression(credentialExpr), "Key"); + var keyNotNull = new BinaryOperatorExpression("!=", keyExpr, Null); + var newApiKeyCredExpr = New.Instance(_apiKeyAuthFields.AuthField.Type, + new MemberExpression(new MemberExpression(settingsParam, "Credential"), "Key")); + args.Add(new TernaryConditionalExpression(keyNotNull, newApiKeyCredExpr, Null)); } // options argument diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientOptionsProviderTests.cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientOptionsProviderTests.cs index 69551cdb1c6..6c62aa632b7 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientOptionsProviderTests.cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientOptionsProviderTests.cs @@ -155,7 +155,9 @@ public void TestConstructors(bool containsApiVersions) } else { - Assert.AreEqual(1, ctors.Count); + Assert.AreEqual(2, ctors.Count); + var defaultCtor = ctors.First(c => !c.Signature.Parameters.Any()); + Assert.IsNotNull(defaultCtor, "Default parameterless constructor should be generated"); } } diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/TestData/ClientOptionsProviderTests/MultiServiceClient_GeneratesExpectedClientOptions.cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/TestData/ClientOptionsProviderTests/MultiServiceClient_GeneratesExpectedClientOptions.cs index d7cab0e2588..7f679a6aa69 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/TestData/ClientOptionsProviderTests/MultiServiceClient_GeneratesExpectedClientOptions.cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/TestData/ClientOptionsProviderTests/MultiServiceClient_GeneratesExpectedClientOptions.cs @@ -33,7 +33,10 @@ public TestClientOptions(global::Sample.TestClientOptions.ServiceAVersion servic [global::System.Diagnostics.CodeAnalysis.ExperimentalAttribute("SCME0002")] internal TestClientOptions(global::Microsoft.Extensions.Configuration.IConfigurationSection section) : base(section) { - if (((section is null) || !section.Exists())) return; + if (((section is null) || !section.Exists())) + { + return; + } } internal string ServiceAApiVersion { get; } diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/TestData/ClientOptionsProviderTests/MultiServiceClient_WithThreeServices_GeneratesExpectedClientOptions.cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/TestData/ClientOptionsProviderTests/MultiServiceClient_WithThreeServices_GeneratesExpectedClientOptions.cs index 8528a089bde..2aeaa9f00ad 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/TestData/ClientOptionsProviderTests/MultiServiceClient_WithThreeServices_GeneratesExpectedClientOptions.cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/TestData/ClientOptionsProviderTests/MultiServiceClient_WithThreeServices_GeneratesExpectedClientOptions.cs @@ -41,7 +41,10 @@ public TestClientOptions(global::Sample.TestClientOptions.ServiceKeyVaultVersion [global::System.Diagnostics.CodeAnalysis.ExperimentalAttribute("SCME0002")] internal TestClientOptions(global::Microsoft.Extensions.Configuration.IConfigurationSection section) : base(section) { - if (((section is null) || !section.Exists())) return; + if (((section is null) || !section.Exists())) + { + return; + } } internal string ServiceComputeApiVersion { get; } diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/TestData/ClientOptionsProviderTests/MultiServiceCombinedClient_GeneratesExpectedClientOptions.cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/TestData/ClientOptionsProviderTests/MultiServiceCombinedClient_GeneratesExpectedClientOptions.cs index d7cab0e2588..7f679a6aa69 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/TestData/ClientOptionsProviderTests/MultiServiceCombinedClient_GeneratesExpectedClientOptions.cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/TestData/ClientOptionsProviderTests/MultiServiceCombinedClient_GeneratesExpectedClientOptions.cs @@ -33,7 +33,10 @@ public TestClientOptions(global::Sample.TestClientOptions.ServiceAVersion servic [global::System.Diagnostics.CodeAnalysis.ExperimentalAttribute("SCME0002")] internal TestClientOptions(global::Microsoft.Extensions.Configuration.IConfigurationSection section) : base(section) { - if (((section is null) || !section.Exists())) return; + if (((section is null) || !section.Exists())) + { + return; + } } internal string ServiceAApiVersion { get; } diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/TestData/ClientOptionsProviderTests/MultiServiceCombinedClient_WithThreeServices_GeneratesExpectedClientOptions.cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/TestData/ClientOptionsProviderTests/MultiServiceCombinedClient_WithThreeServices_GeneratesExpectedClientOptions.cs index 8528a089bde..2aeaa9f00ad 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/TestData/ClientOptionsProviderTests/MultiServiceCombinedClient_WithThreeServices_GeneratesExpectedClientOptions.cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/TestData/ClientOptionsProviderTests/MultiServiceCombinedClient_WithThreeServices_GeneratesExpectedClientOptions.cs @@ -41,7 +41,10 @@ public TestClientOptions(global::Sample.TestClientOptions.ServiceKeyVaultVersion [global::System.Diagnostics.CodeAnalysis.ExperimentalAttribute("SCME0002")] internal TestClientOptions(global::Microsoft.Extensions.Configuration.IConfigurationSection section) : base(section) { - if (((section is null) || !section.Exists())) return; + if (((section is null) || !section.Exists())) + { + return; + } } internal string ServiceComputeApiVersion { get; } diff --git a/packages/http-client-csharp/generator/Packages.Data.props b/packages/http-client-csharp/generator/Packages.Data.props index 3a46d074dfa..332a7ad5ab8 100644 --- a/packages/http-client-csharp/generator/Packages.Data.props +++ b/packages/http-client-csharp/generator/Packages.Data.props @@ -15,6 +15,7 @@ + diff --git a/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/SampleTypeSpecClient.cs b/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/SampleTypeSpecClient.cs index f2e56c36cb0..77b6c2cc6b4 100644 --- a/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/SampleTypeSpecClient.cs +++ b/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/SampleTypeSpecClient.cs @@ -9,6 +9,7 @@ using System.ClientModel; using System.ClientModel.Primitives; using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; using System.Linq; using System.Threading; using System.Threading.Tasks; @@ -91,6 +92,13 @@ public SampleTypeSpecClient(Uri endpoint, AuthenticationTokenProvider tokenProvi _apiVersion = options.Version; } + /// Initializes a new instance of SampleTypeSpecClient from settings. + /// The settings for SampleTypeSpecClient. + [Experimental("SCME0002")] + public SampleTypeSpecClient(SampleTypeSpecClientSettings settings) : this(settings?.SampleTypeSpecUrl, settings?.CredentialProvider as AuthenticationTokenProvider, settings?.Options) + { + } + /// The HTTP pipeline for sending and receiving REST requests and responses. public ClientPipeline Pipeline { get; } diff --git a/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/SampleTypeSpecClientOptions.cs b/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/SampleTypeSpecClientOptions.cs index 43baf1ff90f..2c16a5ed792 100644 --- a/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/SampleTypeSpecClientOptions.cs +++ b/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/SampleTypeSpecClientOptions.cs @@ -7,6 +7,8 @@ using System; using System.ClientModel.Primitives; +using System.Diagnostics.CodeAnalysis; +using Microsoft.Extensions.Configuration; namespace SampleTypeSpec { @@ -27,6 +29,17 @@ public SampleTypeSpecClientOptions(ServiceVersion version = LatestVersion) }; } + /// Initializes a new instance of SampleTypeSpecClientOptions from configuration. + /// The configuration section. + [Experimental("SCME0002")] + internal SampleTypeSpecClientOptions(IConfigurationSection section) : base(section) + { + if (section is null || !section.Exists()) + { + return; + } + } + /// Gets the Version. internal string Version { get; } diff --git a/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/SampleTypeSpecClientSettings.cs b/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/SampleTypeSpecClientSettings.cs new file mode 100644 index 00000000000..88e8f35c29e --- /dev/null +++ b/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/SampleTypeSpecClientSettings.cs @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Diagnostics.CodeAnalysis; +using Microsoft.Extensions.Configuration; + +namespace SampleTypeSpec +{ + /// + [Experimental("SCME0002")] + public partial class SampleTypeSpecClientSettings : ClientSettings + { + /// Gets or sets the SampleTypeSpecUrl. + public Uri SampleTypeSpecUrl { get; set; } + + /// Gets or sets the Options. + public SampleTypeSpecClientOptions Options { get; set; } + + /// Binds configuration values from the given section. + /// The configuration section. + protected override void BindCore(IConfigurationSection section) + { + string endpoint = section["SampleTypeSpecUrl"]; + if (!string.IsNullOrEmpty(endpoint)) + { + SampleTypeSpecUrl = new Uri(endpoint); + } + IConfigurationSection optionsSection = section.GetSection("Options"); + if (optionsSection.Exists()) + { + Options = new SampleTypeSpecClientOptions(optionsSection); + } + } + } +} diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/authentication/api-key/src/Generated/ApiKeyClient.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/authentication/api-key/src/Generated/ApiKeyClient.cs index 4cc79b324ba..22df2fbfdb6 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/authentication/api-key/src/Generated/ApiKeyClient.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/authentication/api-key/src/Generated/ApiKeyClient.cs @@ -5,6 +5,7 @@ using System; using System.ClientModel; using System.ClientModel.Primitives; +using System.Diagnostics.CodeAnalysis; using System.Threading; using System.Threading.Tasks; @@ -20,6 +21,9 @@ public partial class ApiKeyClient public ApiKeyClient(Uri endpoint, ApiKeyCredential credential, ApiKeyClientOptions options) => throw null; + [Experimental("SCME0002")] + public ApiKeyClient(ApiKeyClientSettings settings) : this(settings?.Endpoint, settings?.CredentialProvider as ApiKeyCredential, settings?.Options) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult Valid(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/authentication/api-key/src/Generated/ApiKeyClientOptions.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/authentication/api-key/src/Generated/ApiKeyClientOptions.cs index 898f3926f96..2549430598f 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/authentication/api-key/src/Generated/ApiKeyClientOptions.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/authentication/api-key/src/Generated/ApiKeyClientOptions.cs @@ -3,10 +3,14 @@ #nullable disable using System.ClientModel.Primitives; +using System.Diagnostics.CodeAnalysis; +using Microsoft.Extensions.Configuration; namespace Authentication.ApiKey { public partial class ApiKeyClientOptions : ClientPipelineOptions { + [Experimental("SCME0002")] + internal ApiKeyClientOptions(IConfigurationSection section) : base(section) => throw null; } } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/authentication/api-key/src/Generated/ApiKeyClientSettings.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/authentication/api-key/src/Generated/ApiKeyClientSettings.cs new file mode 100644 index 00000000000..54fd6f05531 --- /dev/null +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/authentication/api-key/src/Generated/ApiKeyClientSettings.cs @@ -0,0 +1,29 @@ +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Diagnostics.CodeAnalysis; +using Microsoft.Extensions.Configuration; + +namespace Authentication.ApiKey +{ + [Experimental("SCME0002")] + public partial class ApiKeyClientSettings : ClientSettings + { + public Uri Endpoint + { + get => throw null; + set => throw null; + } + + public ApiKeyClientOptions Options + { + get => throw null; + set => throw null; + } + + protected override void BindCore(IConfigurationSection section) => throw null; + } +} diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/authentication/http/custom/src/Generated/CustomClient.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/authentication/http/custom/src/Generated/CustomClient.cs index 1bae28cfe95..ac905b1751d 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/authentication/http/custom/src/Generated/CustomClient.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/authentication/http/custom/src/Generated/CustomClient.cs @@ -5,6 +5,7 @@ using System; using System.ClientModel; using System.ClientModel.Primitives; +using System.Diagnostics.CodeAnalysis; using System.Threading; using System.Threading.Tasks; @@ -20,6 +21,9 @@ public partial class CustomClient public CustomClient(Uri endpoint, ApiKeyCredential credential, CustomClientOptions options) => throw null; + [Experimental("SCME0002")] + public CustomClient(CustomClientSettings settings) : this(settings?.Endpoint, settings?.CredentialProvider as ApiKeyCredential, settings?.Options) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult Valid(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/authentication/http/custom/src/Generated/CustomClientOptions.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/authentication/http/custom/src/Generated/CustomClientOptions.cs index bd234ac920d..a1809b4d3c8 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/authentication/http/custom/src/Generated/CustomClientOptions.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/authentication/http/custom/src/Generated/CustomClientOptions.cs @@ -3,10 +3,14 @@ #nullable disable using System.ClientModel.Primitives; +using System.Diagnostics.CodeAnalysis; +using Microsoft.Extensions.Configuration; namespace Authentication.Http.Custom { public partial class CustomClientOptions : ClientPipelineOptions { + [Experimental("SCME0002")] + internal CustomClientOptions(IConfigurationSection section) : base(section) => throw null; } } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/authentication/http/custom/src/Generated/CustomClientSettings.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/authentication/http/custom/src/Generated/CustomClientSettings.cs new file mode 100644 index 00000000000..2a96fe4f0e7 --- /dev/null +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/authentication/http/custom/src/Generated/CustomClientSettings.cs @@ -0,0 +1,29 @@ +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Diagnostics.CodeAnalysis; +using Microsoft.Extensions.Configuration; + +namespace Authentication.Http.Custom +{ + [Experimental("SCME0002")] + public partial class CustomClientSettings : ClientSettings + { + public Uri Endpoint + { + get => throw null; + set => throw null; + } + + public CustomClientOptions Options + { + get => throw null; + set => throw null; + } + + protected override void BindCore(IConfigurationSection section) => throw null; + } +} diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/authentication/oauth2/src/Generated/OAuth2Client.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/authentication/oauth2/src/Generated/OAuth2Client.cs index be4fc518c9f..5ba9629bdd7 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/authentication/oauth2/src/Generated/OAuth2Client.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/authentication/oauth2/src/Generated/OAuth2Client.cs @@ -5,6 +5,7 @@ using System; using System.ClientModel; using System.ClientModel.Primitives; +using System.Diagnostics.CodeAnalysis; using System.Threading; using System.Threading.Tasks; @@ -20,6 +21,9 @@ public partial class OAuth2Client public OAuth2Client(Uri endpoint, AuthenticationTokenProvider tokenProvider, OAuth2ClientOptions options) => throw null; + [Experimental("SCME0002")] + public OAuth2Client(OAuth2ClientSettings settings) : this(settings?.Endpoint, settings?.CredentialProvider as AuthenticationTokenProvider, settings?.Options) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult Valid(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/authentication/oauth2/src/Generated/OAuth2ClientOptions.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/authentication/oauth2/src/Generated/OAuth2ClientOptions.cs index 1c41f844e44..c1bbe69ea65 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/authentication/oauth2/src/Generated/OAuth2ClientOptions.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/authentication/oauth2/src/Generated/OAuth2ClientOptions.cs @@ -3,10 +3,14 @@ #nullable disable using System.ClientModel.Primitives; +using System.Diagnostics.CodeAnalysis; +using Microsoft.Extensions.Configuration; namespace Authentication.OAuth2 { public partial class OAuth2ClientOptions : ClientPipelineOptions { + [Experimental("SCME0002")] + internal OAuth2ClientOptions(IConfigurationSection section) : base(section) => throw null; } } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/authentication/oauth2/src/Generated/OAuth2ClientSettings.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/authentication/oauth2/src/Generated/OAuth2ClientSettings.cs new file mode 100644 index 00000000000..1051c7cf048 --- /dev/null +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/authentication/oauth2/src/Generated/OAuth2ClientSettings.cs @@ -0,0 +1,29 @@ +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Diagnostics.CodeAnalysis; +using Microsoft.Extensions.Configuration; + +namespace Authentication.OAuth2 +{ + [Experimental("SCME0002")] + public partial class OAuth2ClientSettings : ClientSettings + { + public Uri Endpoint + { + get => throw null; + set => throw null; + } + + public OAuth2ClientOptions Options + { + get => throw null; + set => throw null; + } + + protected override void BindCore(IConfigurationSection section) => throw null; + } +} diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/authentication/union/src/Generated/UnionClient.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/authentication/union/src/Generated/UnionClient.cs index f7f4255c91e..e7c01b62077 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/authentication/union/src/Generated/UnionClient.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/authentication/union/src/Generated/UnionClient.cs @@ -5,6 +5,7 @@ using System; using System.ClientModel; using System.ClientModel.Primitives; +using System.Diagnostics.CodeAnalysis; using System.Threading; using System.Threading.Tasks; @@ -26,6 +27,9 @@ public partial class UnionClient public UnionClient(Uri endpoint, AuthenticationTokenProvider tokenProvider, UnionClientOptions options) => throw null; + [Experimental("SCME0002")] + public UnionClient(UnionClientSettings settings) : this(settings?.Endpoint, settings?.CredentialProvider as AuthenticationTokenProvider, settings?.Options) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult ValidKey(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/authentication/union/src/Generated/UnionClientOptions.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/authentication/union/src/Generated/UnionClientOptions.cs index 3a0a17570ae..0d5b7cbb1b5 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/authentication/union/src/Generated/UnionClientOptions.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/authentication/union/src/Generated/UnionClientOptions.cs @@ -3,10 +3,14 @@ #nullable disable using System.ClientModel.Primitives; +using System.Diagnostics.CodeAnalysis; +using Microsoft.Extensions.Configuration; namespace Authentication.Union { public partial class UnionClientOptions : ClientPipelineOptions { + [Experimental("SCME0002")] + internal UnionClientOptions(IConfigurationSection section) : base(section) => throw null; } } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/authentication/union/src/Generated/UnionClientSettings.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/authentication/union/src/Generated/UnionClientSettings.cs new file mode 100644 index 00000000000..f14eadcbcd3 --- /dev/null +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/authentication/union/src/Generated/UnionClientSettings.cs @@ -0,0 +1,29 @@ +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Diagnostics.CodeAnalysis; +using Microsoft.Extensions.Configuration; + +namespace Authentication.Union +{ + [Experimental("SCME0002")] + public partial class UnionClientSettings : ClientSettings + { + public Uri Endpoint + { + get => throw null; + set => throw null; + } + + public UnionClientOptions Options + { + get => throw null; + set => throw null; + } + + protected override void BindCore(IConfigurationSection section) => throw null; + } +} diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/client-operation-group/src/Generated/FirstClient.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/client-operation-group/src/Generated/FirstClient.cs index 09efa090360..1d2343ead3b 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/client-operation-group/src/Generated/FirstClient.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/client-operation-group/src/Generated/FirstClient.cs @@ -5,6 +5,7 @@ using System; using System.ClientModel; using System.ClientModel.Primitives; +using System.Diagnostics.CodeAnalysis; using System.Threading; using System.Threading.Tasks; using Client.Structure.Service; @@ -19,6 +20,9 @@ public partial class FirstClient public FirstClient(Uri endpoint, ClientType client, FirstClientOptions options) => throw null; + [Experimental("SCME0002")] + public FirstClient(FirstClientSettings settings) : this(settings?.Endpoint, settings?.Options) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult One(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/client-operation-group/src/Generated/FirstClientOptions.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/client-operation-group/src/Generated/FirstClientOptions.cs index 881ed44ef7e..1b40294b60a 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/client-operation-group/src/Generated/FirstClientOptions.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/client-operation-group/src/Generated/FirstClientOptions.cs @@ -3,10 +3,14 @@ #nullable disable using System.ClientModel.Primitives; +using System.Diagnostics.CodeAnalysis; +using Microsoft.Extensions.Configuration; namespace Client.Structure.ClientOperationGroup { public partial class FirstClientOptions : ClientPipelineOptions { + [Experimental("SCME0002")] + internal FirstClientOptions(IConfigurationSection section) : base(section) => throw null; } } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/client-operation-group/src/Generated/FirstClientSettings.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/client-operation-group/src/Generated/FirstClientSettings.cs new file mode 100644 index 00000000000..0f1ddca0797 --- /dev/null +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/client-operation-group/src/Generated/FirstClientSettings.cs @@ -0,0 +1,29 @@ +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Diagnostics.CodeAnalysis; +using Microsoft.Extensions.Configuration; + +namespace Client.Structure.ClientOperationGroup +{ + [Experimental("SCME0002")] + public partial class FirstClientSettings : ClientSettings + { + public Uri Endpoint + { + get => throw null; + set => throw null; + } + + public FirstClientOptions Options + { + get => throw null; + set => throw null; + } + + protected override void BindCore(IConfigurationSection section) => throw null; + } +} diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/client-operation-group/src/Generated/SubNamespaceSecondClient.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/client-operation-group/src/Generated/SubNamespaceSecondClient.cs index 9fe43ebbd7c..6dff3cfb8d2 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/client-operation-group/src/Generated/SubNamespaceSecondClient.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/client-operation-group/src/Generated/SubNamespaceSecondClient.cs @@ -5,6 +5,7 @@ using System; using System.ClientModel; using System.ClientModel.Primitives; +using System.Diagnostics.CodeAnalysis; using System.Threading; using System.Threading.Tasks; using Client.Structure.Service; @@ -19,6 +20,9 @@ public partial class SubNamespaceSecondClient public SubNamespaceSecondClient(Uri endpoint, ClientType client, SubNamespaceSecondClientOptions options) => throw null; + [Experimental("SCME0002")] + public SubNamespaceSecondClient(SubNamespaceSecondClientSettings settings) : this(settings?.Endpoint, settings?.Options) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult Five(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/client-operation-group/src/Generated/SubNamespaceSecondClientOptions.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/client-operation-group/src/Generated/SubNamespaceSecondClientOptions.cs index d853790bd79..48fb05e53cf 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/client-operation-group/src/Generated/SubNamespaceSecondClientOptions.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/client-operation-group/src/Generated/SubNamespaceSecondClientOptions.cs @@ -3,10 +3,14 @@ #nullable disable using System.ClientModel.Primitives; +using System.Diagnostics.CodeAnalysis; +using Microsoft.Extensions.Configuration; namespace Client.Structure.AnotherClientOperationGroup { public partial class SubNamespaceSecondClientOptions : ClientPipelineOptions { + [Experimental("SCME0002")] + internal SubNamespaceSecondClientOptions(IConfigurationSection section) : base(section) => throw null; } } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/client-operation-group/src/Generated/SubNamespaceSecondClientSettings.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/client-operation-group/src/Generated/SubNamespaceSecondClientSettings.cs new file mode 100644 index 00000000000..c70137cb6ab --- /dev/null +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/client-operation-group/src/Generated/SubNamespaceSecondClientSettings.cs @@ -0,0 +1,29 @@ +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Diagnostics.CodeAnalysis; +using Microsoft.Extensions.Configuration; + +namespace Client.Structure.AnotherClientOperationGroup +{ + [Experimental("SCME0002")] + public partial class SubNamespaceSecondClientSettings : ClientSettings + { + public Uri Endpoint + { + get => throw null; + set => throw null; + } + + public SubNamespaceSecondClientOptions Options + { + get => throw null; + set => throw null; + } + + protected override void BindCore(IConfigurationSection section) => throw null; + } +} diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/default/src/Generated/ServiceClient.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/default/src/Generated/ServiceClient.cs index c6745dfd7c9..3fa3afbd9fc 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/default/src/Generated/ServiceClient.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/default/src/Generated/ServiceClient.cs @@ -5,6 +5,7 @@ using System; using System.ClientModel; using System.ClientModel.Primitives; +using System.Diagnostics.CodeAnalysis; using System.Threading; using System.Threading.Tasks; using Client.Structure.Service._Baz; @@ -20,6 +21,9 @@ public partial class ServiceClient public ServiceClient(Uri endpoint, ClientType client, ServiceClientOptions options) => throw null; + [Experimental("SCME0002")] + public ServiceClient(ServiceClientSettings settings) : this(settings?.Endpoint, settings?.Options) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult One(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/default/src/Generated/ServiceClientOptions.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/default/src/Generated/ServiceClientOptions.cs index 721c8b6c398..e2ea98ab218 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/default/src/Generated/ServiceClientOptions.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/default/src/Generated/ServiceClientOptions.cs @@ -3,10 +3,14 @@ #nullable disable using System.ClientModel.Primitives; +using System.Diagnostics.CodeAnalysis; +using Microsoft.Extensions.Configuration; namespace Client.Structure.Service { public partial class ServiceClientOptions : ClientPipelineOptions { + [Experimental("SCME0002")] + internal ServiceClientOptions(IConfigurationSection section) : base(section) => throw null; } } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/default/src/Generated/ServiceClientSettings.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/default/src/Generated/ServiceClientSettings.cs new file mode 100644 index 00000000000..7b3623819c6 --- /dev/null +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/default/src/Generated/ServiceClientSettings.cs @@ -0,0 +1,29 @@ +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Diagnostics.CodeAnalysis; +using Microsoft.Extensions.Configuration; + +namespace Client.Structure.Service +{ + [Experimental("SCME0002")] + public partial class ServiceClientSettings : ClientSettings + { + public Uri Endpoint + { + get => throw null; + set => throw null; + } + + public ServiceClientOptions Options + { + get => throw null; + set => throw null; + } + + protected override void BindCore(IConfigurationSection section) => throw null; + } +} diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/multi-client/src/Generated/ClientAClient.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/multi-client/src/Generated/ClientAClient.cs index 8474e633848..9ead52f28b5 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/multi-client/src/Generated/ClientAClient.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/multi-client/src/Generated/ClientAClient.cs @@ -5,6 +5,7 @@ using System; using System.ClientModel; using System.ClientModel.Primitives; +using System.Diagnostics.CodeAnalysis; using System.Threading; using System.Threading.Tasks; using Client.Structure.Service; @@ -19,6 +20,9 @@ public partial class ClientAClient public ClientAClient(Uri endpoint, ClientType client, ClientAClientOptions options) => throw null; + [Experimental("SCME0002")] + public ClientAClient(ClientAClientSettings settings) : this(settings?.Endpoint, settings?.Options) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult RenamedOne(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/multi-client/src/Generated/ClientAClientOptions.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/multi-client/src/Generated/ClientAClientOptions.cs index d52bc376d61..b6a2f789659 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/multi-client/src/Generated/ClientAClientOptions.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/multi-client/src/Generated/ClientAClientOptions.cs @@ -3,10 +3,14 @@ #nullable disable using System.ClientModel.Primitives; +using System.Diagnostics.CodeAnalysis; +using Microsoft.Extensions.Configuration; namespace Client.Structure.MultiClient { public partial class ClientAClientOptions : ClientPipelineOptions { + [Experimental("SCME0002")] + internal ClientAClientOptions(IConfigurationSection section) : base(section) => throw null; } } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/multi-client/src/Generated/ClientAClientSettings.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/multi-client/src/Generated/ClientAClientSettings.cs new file mode 100644 index 00000000000..d6693b0abe6 --- /dev/null +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/multi-client/src/Generated/ClientAClientSettings.cs @@ -0,0 +1,29 @@ +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Diagnostics.CodeAnalysis; +using Microsoft.Extensions.Configuration; + +namespace Client.Structure.MultiClient +{ + [Experimental("SCME0002")] + public partial class ClientAClientSettings : ClientSettings + { + public Uri Endpoint + { + get => throw null; + set => throw null; + } + + public ClientAClientOptions Options + { + get => throw null; + set => throw null; + } + + protected override void BindCore(IConfigurationSection section) => throw null; + } +} diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/multi-client/src/Generated/ClientBClient.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/multi-client/src/Generated/ClientBClient.cs index 63271b0bf6f..1f5101a866d 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/multi-client/src/Generated/ClientBClient.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/multi-client/src/Generated/ClientBClient.cs @@ -5,6 +5,7 @@ using System; using System.ClientModel; using System.ClientModel.Primitives; +using System.Diagnostics.CodeAnalysis; using System.Threading; using System.Threading.Tasks; using Client.Structure.Service; @@ -19,6 +20,9 @@ public partial class ClientBClient public ClientBClient(Uri endpoint, ClientType client, ClientBClientOptions options) => throw null; + [Experimental("SCME0002")] + public ClientBClient(ClientBClientSettings settings) : this(settings?.Endpoint, settings?.Options) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult RenamedTwo(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/multi-client/src/Generated/ClientBClientOptions.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/multi-client/src/Generated/ClientBClientOptions.cs index 79f628d59e3..be5cddbd4e5 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/multi-client/src/Generated/ClientBClientOptions.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/multi-client/src/Generated/ClientBClientOptions.cs @@ -3,10 +3,14 @@ #nullable disable using System.ClientModel.Primitives; +using System.Diagnostics.CodeAnalysis; +using Microsoft.Extensions.Configuration; namespace Client.Structure.MultiClient { public partial class ClientBClientOptions : ClientPipelineOptions { + [Experimental("SCME0002")] + internal ClientBClientOptions(IConfigurationSection section) : base(section) => throw null; } } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/multi-client/src/Generated/ClientBClientSettings.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/multi-client/src/Generated/ClientBClientSettings.cs new file mode 100644 index 00000000000..236592b75b9 --- /dev/null +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/multi-client/src/Generated/ClientBClientSettings.cs @@ -0,0 +1,29 @@ +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Diagnostics.CodeAnalysis; +using Microsoft.Extensions.Configuration; + +namespace Client.Structure.MultiClient +{ + [Experimental("SCME0002")] + public partial class ClientBClientSettings : ClientSettings + { + public Uri Endpoint + { + get => throw null; + set => throw null; + } + + public ClientBClientOptions Options + { + get => throw null; + set => throw null; + } + + protected override void BindCore(IConfigurationSection section) => throw null; + } +} diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/renamed-operation/src/Generated/RenamedOperationClient.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/renamed-operation/src/Generated/RenamedOperationClient.cs index acb300be1b5..e5e3c0a9944 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/renamed-operation/src/Generated/RenamedOperationClient.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/renamed-operation/src/Generated/RenamedOperationClient.cs @@ -5,6 +5,7 @@ using System; using System.ClientModel; using System.ClientModel.Primitives; +using System.Diagnostics.CodeAnalysis; using System.Threading; using System.Threading.Tasks; using Client.Structure.Service; @@ -19,6 +20,9 @@ public partial class RenamedOperationClient public RenamedOperationClient(Uri endpoint, ClientType client, RenamedOperationClientOptions options) => throw null; + [Experimental("SCME0002")] + public RenamedOperationClient(RenamedOperationClientSettings settings) : this(settings?.Endpoint, settings?.Options) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult RenamedOne(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/renamed-operation/src/Generated/RenamedOperationClientOptions.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/renamed-operation/src/Generated/RenamedOperationClientOptions.cs index 981265b249d..43bff10973b 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/renamed-operation/src/Generated/RenamedOperationClientOptions.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/renamed-operation/src/Generated/RenamedOperationClientOptions.cs @@ -3,10 +3,14 @@ #nullable disable using System.ClientModel.Primitives; +using System.Diagnostics.CodeAnalysis; +using Microsoft.Extensions.Configuration; namespace Client.Structure.RenamedOperation { public partial class RenamedOperationClientOptions : ClientPipelineOptions { + [Experimental("SCME0002")] + internal RenamedOperationClientOptions(IConfigurationSection section) : base(section) => throw null; } } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/renamed-operation/src/Generated/RenamedOperationClientSettings.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/renamed-operation/src/Generated/RenamedOperationClientSettings.cs new file mode 100644 index 00000000000..4e4434c1ae5 --- /dev/null +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/renamed-operation/src/Generated/RenamedOperationClientSettings.cs @@ -0,0 +1,29 @@ +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Diagnostics.CodeAnalysis; +using Microsoft.Extensions.Configuration; + +namespace Client.Structure.RenamedOperation +{ + [Experimental("SCME0002")] + public partial class RenamedOperationClientSettings : ClientSettings + { + public Uri Endpoint + { + get => throw null; + set => throw null; + } + + public RenamedOperationClientOptions Options + { + get => throw null; + set => throw null; + } + + protected override void BindCore(IConfigurationSection section) => throw null; + } +} diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/two-operation-group/src/Generated/TwoOperationGroupClient.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/two-operation-group/src/Generated/TwoOperationGroupClient.cs index 42cdaf6080a..286aa46f7e1 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/two-operation-group/src/Generated/TwoOperationGroupClient.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/two-operation-group/src/Generated/TwoOperationGroupClient.cs @@ -4,6 +4,7 @@ using System; using System.ClientModel.Primitives; +using System.Diagnostics.CodeAnalysis; using Client.Structure.Service; namespace Client.Structure.TwoOperationGroup @@ -16,6 +17,9 @@ public partial class TwoOperationGroupClient public TwoOperationGroupClient(Uri endpoint, ClientType client, TwoOperationGroupClientOptions options) => throw null; + [Experimental("SCME0002")] + public TwoOperationGroupClient(TwoOperationGroupClientSettings settings) : this(settings?.Endpoint, settings?.Options) => throw null; + public ClientPipeline Pipeline => throw null; public virtual Group1 GetGroup1Client() => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/two-operation-group/src/Generated/TwoOperationGroupClientOptions.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/two-operation-group/src/Generated/TwoOperationGroupClientOptions.cs index 95058870aa8..8c55bff86c7 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/two-operation-group/src/Generated/TwoOperationGroupClientOptions.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/two-operation-group/src/Generated/TwoOperationGroupClientOptions.cs @@ -3,10 +3,14 @@ #nullable disable using System.ClientModel.Primitives; +using System.Diagnostics.CodeAnalysis; +using Microsoft.Extensions.Configuration; namespace Client.Structure.TwoOperationGroup { public partial class TwoOperationGroupClientOptions : ClientPipelineOptions { + [Experimental("SCME0002")] + internal TwoOperationGroupClientOptions(IConfigurationSection section) : base(section) => throw null; } } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/two-operation-group/src/Generated/TwoOperationGroupClientSettings.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/two-operation-group/src/Generated/TwoOperationGroupClientSettings.cs new file mode 100644 index 00000000000..e418ebf8e9f --- /dev/null +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/two-operation-group/src/Generated/TwoOperationGroupClientSettings.cs @@ -0,0 +1,29 @@ +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Diagnostics.CodeAnalysis; +using Microsoft.Extensions.Configuration; + +namespace Client.Structure.TwoOperationGroup +{ + [Experimental("SCME0002")] + public partial class TwoOperationGroupClientSettings : ClientSettings + { + public Uri Endpoint + { + get => throw null; + set => throw null; + } + + public TwoOperationGroupClientOptions Options + { + get => throw null; + set => throw null; + } + + protected override void BindCore(IConfigurationSection section) => throw null; + } +} diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/documentation/src/Generated/DocumentationClient.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/documentation/src/Generated/DocumentationClient.cs index 8f961dff791..1b4f533629a 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/documentation/src/Generated/DocumentationClient.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/documentation/src/Generated/DocumentationClient.cs @@ -4,6 +4,7 @@ using System; using System.ClientModel.Primitives; +using System.Diagnostics.CodeAnalysis; using Documentation._Lists; using Documentation._TextFormatting; @@ -15,6 +16,9 @@ public partial class DocumentationClient public DocumentationClient(Uri endpoint, DocumentationClientOptions options) => throw null; + [Experimental("SCME0002")] + public DocumentationClient(DocumentationClientSettings settings) : this(settings?.Endpoint, settings?.Options) => throw null; + public ClientPipeline Pipeline => throw null; public virtual Lists GetListsClient() => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/documentation/src/Generated/DocumentationClientOptions.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/documentation/src/Generated/DocumentationClientOptions.cs index d14497f2a3d..aaf844ca9bb 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/documentation/src/Generated/DocumentationClientOptions.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/documentation/src/Generated/DocumentationClientOptions.cs @@ -3,10 +3,14 @@ #nullable disable using System.ClientModel.Primitives; +using System.Diagnostics.CodeAnalysis; +using Microsoft.Extensions.Configuration; namespace Documentation { public partial class DocumentationClientOptions : ClientPipelineOptions { + [Experimental("SCME0002")] + internal DocumentationClientOptions(IConfigurationSection section) : base(section) => throw null; } } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/documentation/src/Generated/DocumentationClientSettings.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/documentation/src/Generated/DocumentationClientSettings.cs new file mode 100644 index 00000000000..3359778538d --- /dev/null +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/documentation/src/Generated/DocumentationClientSettings.cs @@ -0,0 +1,29 @@ +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Diagnostics.CodeAnalysis; +using Microsoft.Extensions.Configuration; + +namespace Documentation +{ + [Experimental("SCME0002")] + public partial class DocumentationClientSettings : ClientSettings + { + public Uri Endpoint + { + get => throw null; + set => throw null; + } + + public DocumentationClientOptions Options + { + get => throw null; + set => throw null; + } + + protected override void BindCore(IConfigurationSection section) => throw null; + } +} diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/array/src/Generated/ArrayClient.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/array/src/Generated/ArrayClient.cs index 55ae5b366f0..9398d01f302 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/array/src/Generated/ArrayClient.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/array/src/Generated/ArrayClient.cs @@ -4,6 +4,7 @@ using System; using System.ClientModel.Primitives; +using System.Diagnostics.CodeAnalysis; using Encode._Array._Property; namespace Encode._Array @@ -14,6 +15,9 @@ public partial class ArrayClient public ArrayClient(Uri endpoint, ArrayClientOptions options) => throw null; + [Experimental("SCME0002")] + public ArrayClient(ArrayClientSettings settings) : this(settings?.Endpoint, settings?.Options) => throw null; + public ClientPipeline Pipeline => throw null; public virtual Property GetPropertyClient() => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/array/src/Generated/ArrayClientOptions.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/array/src/Generated/ArrayClientOptions.cs index 392d2e67a55..ddaaf1e669f 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/array/src/Generated/ArrayClientOptions.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/array/src/Generated/ArrayClientOptions.cs @@ -3,10 +3,14 @@ #nullable disable using System.ClientModel.Primitives; +using System.Diagnostics.CodeAnalysis; +using Microsoft.Extensions.Configuration; namespace Encode._Array { public partial class ArrayClientOptions : ClientPipelineOptions { + [Experimental("SCME0002")] + internal ArrayClientOptions(IConfigurationSection section) : base(section) => throw null; } } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/array/src/Generated/ArrayClientSettings.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/array/src/Generated/ArrayClientSettings.cs new file mode 100644 index 00000000000..a63b499749e --- /dev/null +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/array/src/Generated/ArrayClientSettings.cs @@ -0,0 +1,29 @@ +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Diagnostics.CodeAnalysis; +using Microsoft.Extensions.Configuration; + +namespace Encode._Array +{ + [Experimental("SCME0002")] + public partial class ArrayClientSettings : ClientSettings + { + public Uri Endpoint + { + get => throw null; + set => throw null; + } + + public ArrayClientOptions Options + { + get => throw null; + set => throw null; + } + + protected override void BindCore(IConfigurationSection section) => throw null; + } +} diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/bytes/src/Generated/BytesClient.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/bytes/src/Generated/BytesClient.cs index 9f869034eb7..aa4260d61d9 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/bytes/src/Generated/BytesClient.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/bytes/src/Generated/BytesClient.cs @@ -4,6 +4,7 @@ using System; using System.ClientModel.Primitives; +using System.Diagnostics.CodeAnalysis; using Encode.Bytes._Header; using Encode.Bytes._Property; using Encode.Bytes._Query; @@ -18,6 +19,9 @@ public partial class BytesClient public BytesClient(Uri endpoint, BytesClientOptions options) => throw null; + [Experimental("SCME0002")] + public BytesClient(BytesClientSettings settings) : this(settings?.Endpoint, settings?.Options) => throw null; + public ClientPipeline Pipeline => throw null; public virtual Query GetQueryClient() => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/bytes/src/Generated/BytesClientOptions.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/bytes/src/Generated/BytesClientOptions.cs index cd5fed986b7..54102fe0cf4 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/bytes/src/Generated/BytesClientOptions.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/bytes/src/Generated/BytesClientOptions.cs @@ -3,10 +3,14 @@ #nullable disable using System.ClientModel.Primitives; +using System.Diagnostics.CodeAnalysis; +using Microsoft.Extensions.Configuration; namespace Encode.Bytes { public partial class BytesClientOptions : ClientPipelineOptions { + [Experimental("SCME0002")] + internal BytesClientOptions(IConfigurationSection section) : base(section) => throw null; } } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/bytes/src/Generated/BytesClientSettings.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/bytes/src/Generated/BytesClientSettings.cs new file mode 100644 index 00000000000..a6033329a11 --- /dev/null +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/bytes/src/Generated/BytesClientSettings.cs @@ -0,0 +1,29 @@ +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Diagnostics.CodeAnalysis; +using Microsoft.Extensions.Configuration; + +namespace Encode.Bytes +{ + [Experimental("SCME0002")] + public partial class BytesClientSettings : ClientSettings + { + public Uri Endpoint + { + get => throw null; + set => throw null; + } + + public BytesClientOptions Options + { + get => throw null; + set => throw null; + } + + protected override void BindCore(IConfigurationSection section) => throw null; + } +} diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/datetime/src/Generated/DatetimeClient.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/datetime/src/Generated/DatetimeClient.cs index 99b7355986c..3620302eb68 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/datetime/src/Generated/DatetimeClient.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/datetime/src/Generated/DatetimeClient.cs @@ -4,6 +4,7 @@ using System; using System.ClientModel.Primitives; +using System.Diagnostics.CodeAnalysis; using Encode.Datetime._Header; using Encode.Datetime._Property; using Encode.Datetime._Query; @@ -17,6 +18,9 @@ public partial class DatetimeClient public DatetimeClient(Uri endpoint, DatetimeClientOptions options) => throw null; + [Experimental("SCME0002")] + public DatetimeClient(DatetimeClientSettings settings) : this(settings?.Endpoint, settings?.Options) => throw null; + public ClientPipeline Pipeline => throw null; public virtual Query GetQueryClient() => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/datetime/src/Generated/DatetimeClientOptions.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/datetime/src/Generated/DatetimeClientOptions.cs index 698cb7d64f1..3e47968e597 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/datetime/src/Generated/DatetimeClientOptions.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/datetime/src/Generated/DatetimeClientOptions.cs @@ -3,10 +3,14 @@ #nullable disable using System.ClientModel.Primitives; +using System.Diagnostics.CodeAnalysis; +using Microsoft.Extensions.Configuration; namespace Encode.Datetime { public partial class DatetimeClientOptions : ClientPipelineOptions { + [Experimental("SCME0002")] + internal DatetimeClientOptions(IConfigurationSection section) : base(section) => throw null; } } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/datetime/src/Generated/DatetimeClientSettings.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/datetime/src/Generated/DatetimeClientSettings.cs new file mode 100644 index 00000000000..9924fa8a904 --- /dev/null +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/datetime/src/Generated/DatetimeClientSettings.cs @@ -0,0 +1,29 @@ +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Diagnostics.CodeAnalysis; +using Microsoft.Extensions.Configuration; + +namespace Encode.Datetime +{ + [Experimental("SCME0002")] + public partial class DatetimeClientSettings : ClientSettings + { + public Uri Endpoint + { + get => throw null; + set => throw null; + } + + public DatetimeClientOptions Options + { + get => throw null; + set => throw null; + } + + protected override void BindCore(IConfigurationSection section) => throw null; + } +} diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/duration/src/Generated/DurationClient.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/duration/src/Generated/DurationClient.cs index 5f2a93cce5a..2d3a7bc7cec 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/duration/src/Generated/DurationClient.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/duration/src/Generated/DurationClient.cs @@ -4,6 +4,7 @@ using System; using System.ClientModel.Primitives; +using System.Diagnostics.CodeAnalysis; using Encode.Duration._Header; using Encode.Duration._Property; using Encode.Duration._Query; @@ -16,6 +17,9 @@ public partial class DurationClient public DurationClient(Uri endpoint, DurationClientOptions options) => throw null; + [Experimental("SCME0002")] + public DurationClient(DurationClientSettings settings) : this(settings?.Endpoint, settings?.Options) => throw null; + public ClientPipeline Pipeline => throw null; public virtual Query GetQueryClient() => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/duration/src/Generated/DurationClientOptions.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/duration/src/Generated/DurationClientOptions.cs index a78e11b5410..29e1b4603a2 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/duration/src/Generated/DurationClientOptions.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/duration/src/Generated/DurationClientOptions.cs @@ -3,10 +3,14 @@ #nullable disable using System.ClientModel.Primitives; +using System.Diagnostics.CodeAnalysis; +using Microsoft.Extensions.Configuration; namespace Encode.Duration { public partial class DurationClientOptions : ClientPipelineOptions { + [Experimental("SCME0002")] + internal DurationClientOptions(IConfigurationSection section) : base(section) => throw null; } } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/duration/src/Generated/DurationClientSettings.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/duration/src/Generated/DurationClientSettings.cs new file mode 100644 index 00000000000..d5794c77d32 --- /dev/null +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/duration/src/Generated/DurationClientSettings.cs @@ -0,0 +1,29 @@ +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Diagnostics.CodeAnalysis; +using Microsoft.Extensions.Configuration; + +namespace Encode.Duration +{ + [Experimental("SCME0002")] + public partial class DurationClientSettings : ClientSettings + { + public Uri Endpoint + { + get => throw null; + set => throw null; + } + + public DurationClientOptions Options + { + get => throw null; + set => throw null; + } + + protected override void BindCore(IConfigurationSection section) => throw null; + } +} diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/numeric/src/Generated/NumericClient.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/numeric/src/Generated/NumericClient.cs index a43095cc1bc..f7b5a16fb1f 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/numeric/src/Generated/NumericClient.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/numeric/src/Generated/NumericClient.cs @@ -4,6 +4,7 @@ using System; using System.ClientModel.Primitives; +using System.Diagnostics.CodeAnalysis; using Encode.Numeric._Property; namespace Encode.Numeric @@ -14,6 +15,9 @@ public partial class NumericClient public NumericClient(Uri endpoint, NumericClientOptions options) => throw null; + [Experimental("SCME0002")] + public NumericClient(NumericClientSettings settings) : this(settings?.Endpoint, settings?.Options) => throw null; + public ClientPipeline Pipeline => throw null; public virtual Property GetPropertyClient() => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/numeric/src/Generated/NumericClientOptions.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/numeric/src/Generated/NumericClientOptions.cs index 94e681301bf..11858671eed 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/numeric/src/Generated/NumericClientOptions.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/numeric/src/Generated/NumericClientOptions.cs @@ -3,10 +3,14 @@ #nullable disable using System.ClientModel.Primitives; +using System.Diagnostics.CodeAnalysis; +using Microsoft.Extensions.Configuration; namespace Encode.Numeric { public partial class NumericClientOptions : ClientPipelineOptions { + [Experimental("SCME0002")] + internal NumericClientOptions(IConfigurationSection section) : base(section) => throw null; } } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/numeric/src/Generated/NumericClientSettings.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/numeric/src/Generated/NumericClientSettings.cs new file mode 100644 index 00000000000..1eb21a455d6 --- /dev/null +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/numeric/src/Generated/NumericClientSettings.cs @@ -0,0 +1,29 @@ +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Diagnostics.CodeAnalysis; +using Microsoft.Extensions.Configuration; + +namespace Encode.Numeric +{ + [Experimental("SCME0002")] + public partial class NumericClientSettings : ClientSettings + { + public Uri Endpoint + { + get => throw null; + set => throw null; + } + + public NumericClientOptions Options + { + get => throw null; + set => throw null; + } + + protected override void BindCore(IConfigurationSection section) => throw null; + } +} diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/basic/src/Generated/BasicClient.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/basic/src/Generated/BasicClient.cs index dfb24ed2a43..bf0f4d22e3e 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/basic/src/Generated/BasicClient.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/basic/src/Generated/BasicClient.cs @@ -4,6 +4,7 @@ using System; using System.ClientModel.Primitives; +using System.Diagnostics.CodeAnalysis; using Parameters.Basic._ExplicitBody; using Parameters.Basic._ImplicitBody; @@ -15,6 +16,9 @@ public partial class BasicClient public BasicClient(Uri endpoint, BasicClientOptions options) => throw null; + [Experimental("SCME0002")] + public BasicClient(BasicClientSettings settings) : this(settings?.Endpoint, settings?.Options) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ExplicitBody GetExplicitBodyClient() => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/basic/src/Generated/BasicClientOptions.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/basic/src/Generated/BasicClientOptions.cs index 8739650ee13..6275ed4f48b 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/basic/src/Generated/BasicClientOptions.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/basic/src/Generated/BasicClientOptions.cs @@ -3,10 +3,14 @@ #nullable disable using System.ClientModel.Primitives; +using System.Diagnostics.CodeAnalysis; +using Microsoft.Extensions.Configuration; namespace Parameters.Basic { public partial class BasicClientOptions : ClientPipelineOptions { + [Experimental("SCME0002")] + internal BasicClientOptions(IConfigurationSection section) : base(section) => throw null; } } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/basic/src/Generated/BasicClientSettings.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/basic/src/Generated/BasicClientSettings.cs new file mode 100644 index 00000000000..51e2b9e6c0f --- /dev/null +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/basic/src/Generated/BasicClientSettings.cs @@ -0,0 +1,29 @@ +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Diagnostics.CodeAnalysis; +using Microsoft.Extensions.Configuration; + +namespace Parameters.Basic +{ + [Experimental("SCME0002")] + public partial class BasicClientSettings : ClientSettings + { + public Uri Endpoint + { + get => throw null; + set => throw null; + } + + public BasicClientOptions Options + { + get => throw null; + set => throw null; + } + + protected override void BindCore(IConfigurationSection section) => throw null; + } +} diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/body-optionality/src/Generated/BodyOptionalityClient.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/body-optionality/src/Generated/BodyOptionalityClient.cs index 3c77de1b7fe..8ada2ace385 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/body-optionality/src/Generated/BodyOptionalityClient.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/body-optionality/src/Generated/BodyOptionalityClient.cs @@ -5,6 +5,7 @@ using System; using System.ClientModel; using System.ClientModel.Primitives; +using System.Diagnostics.CodeAnalysis; using System.Threading; using System.Threading.Tasks; using Parameters.BodyOptionality._OptionalExplicit; @@ -17,6 +18,9 @@ public partial class BodyOptionalityClient public BodyOptionalityClient(Uri endpoint, BodyOptionalityClientOptions options) => throw null; + [Experimental("SCME0002")] + public BodyOptionalityClient(BodyOptionalityClientSettings settings) : this(settings?.Endpoint, settings?.Options) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult RequiredExplicit(BinaryContent content, RequestOptions options = null) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/body-optionality/src/Generated/BodyOptionalityClientOptions.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/body-optionality/src/Generated/BodyOptionalityClientOptions.cs index 80f4405292a..d16cd1e6a9d 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/body-optionality/src/Generated/BodyOptionalityClientOptions.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/body-optionality/src/Generated/BodyOptionalityClientOptions.cs @@ -3,10 +3,14 @@ #nullable disable using System.ClientModel.Primitives; +using System.Diagnostics.CodeAnalysis; +using Microsoft.Extensions.Configuration; namespace Parameters.BodyOptionality { public partial class BodyOptionalityClientOptions : ClientPipelineOptions { + [Experimental("SCME0002")] + internal BodyOptionalityClientOptions(IConfigurationSection section) : base(section) => throw null; } } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/body-optionality/src/Generated/BodyOptionalityClientSettings.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/body-optionality/src/Generated/BodyOptionalityClientSettings.cs new file mode 100644 index 00000000000..137094caec7 --- /dev/null +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/body-optionality/src/Generated/BodyOptionalityClientSettings.cs @@ -0,0 +1,29 @@ +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Diagnostics.CodeAnalysis; +using Microsoft.Extensions.Configuration; + +namespace Parameters.BodyOptionality +{ + [Experimental("SCME0002")] + public partial class BodyOptionalityClientSettings : ClientSettings + { + public Uri Endpoint + { + get => throw null; + set => throw null; + } + + public BodyOptionalityClientOptions Options + { + get => throw null; + set => throw null; + } + + protected override void BindCore(IConfigurationSection section) => throw null; + } +} diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/collection-format/src/Generated/CollectionFormatClient.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/collection-format/src/Generated/CollectionFormatClient.cs index c75beeba0ad..b01cbda1fa4 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/collection-format/src/Generated/CollectionFormatClient.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/collection-format/src/Generated/CollectionFormatClient.cs @@ -4,6 +4,7 @@ using System; using System.ClientModel.Primitives; +using System.Diagnostics.CodeAnalysis; using Parameters.CollectionFormat._Header; using Parameters.CollectionFormat._Query; @@ -15,6 +16,9 @@ public partial class CollectionFormatClient public CollectionFormatClient(Uri endpoint, CollectionFormatClientOptions options) => throw null; + [Experimental("SCME0002")] + public CollectionFormatClient(CollectionFormatClientSettings settings) : this(settings?.Endpoint, settings?.Options) => throw null; + public ClientPipeline Pipeline => throw null; public virtual Query GetQueryClient() => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/collection-format/src/Generated/CollectionFormatClientOptions.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/collection-format/src/Generated/CollectionFormatClientOptions.cs index 31d6176ffa4..aa251fcd4e5 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/collection-format/src/Generated/CollectionFormatClientOptions.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/collection-format/src/Generated/CollectionFormatClientOptions.cs @@ -3,10 +3,14 @@ #nullable disable using System.ClientModel.Primitives; +using System.Diagnostics.CodeAnalysis; +using Microsoft.Extensions.Configuration; namespace Parameters.CollectionFormat { public partial class CollectionFormatClientOptions : ClientPipelineOptions { + [Experimental("SCME0002")] + internal CollectionFormatClientOptions(IConfigurationSection section) : base(section) => throw null; } } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/collection-format/src/Generated/CollectionFormatClientSettings.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/collection-format/src/Generated/CollectionFormatClientSettings.cs new file mode 100644 index 00000000000..ae7b80aa260 --- /dev/null +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/collection-format/src/Generated/CollectionFormatClientSettings.cs @@ -0,0 +1,29 @@ +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Diagnostics.CodeAnalysis; +using Microsoft.Extensions.Configuration; + +namespace Parameters.CollectionFormat +{ + [Experimental("SCME0002")] + public partial class CollectionFormatClientSettings : ClientSettings + { + public Uri Endpoint + { + get => throw null; + set => throw null; + } + + public CollectionFormatClientOptions Options + { + get => throw null; + set => throw null; + } + + protected override void BindCore(IConfigurationSection section) => throw null; + } +} diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/path/src/Generated/PathClient.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/path/src/Generated/PathClient.cs index d4db42a991a..bb9f8d21079 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/path/src/Generated/PathClient.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/path/src/Generated/PathClient.cs @@ -5,6 +5,7 @@ using System; using System.ClientModel; using System.ClientModel.Primitives; +using System.Diagnostics.CodeAnalysis; using System.Threading; using System.Threading.Tasks; @@ -16,6 +17,9 @@ public partial class PathClient public PathClient(Uri endpoint, PathClientOptions options) => throw null; + [Experimental("SCME0002")] + public PathClient(PathClientSettings settings) : this(settings?.Endpoint, settings?.Options) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult Normal(string name, RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/path/src/Generated/PathClientOptions.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/path/src/Generated/PathClientOptions.cs index 9a352e9e917..777d6cb255a 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/path/src/Generated/PathClientOptions.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/path/src/Generated/PathClientOptions.cs @@ -3,10 +3,14 @@ #nullable disable using System.ClientModel.Primitives; +using System.Diagnostics.CodeAnalysis; +using Microsoft.Extensions.Configuration; namespace Parameters.Path { public partial class PathClientOptions : ClientPipelineOptions { + [Experimental("SCME0002")] + internal PathClientOptions(IConfigurationSection section) : base(section) => throw null; } } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/path/src/Generated/PathClientSettings.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/path/src/Generated/PathClientSettings.cs new file mode 100644 index 00000000000..a5fa1a1373e --- /dev/null +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/path/src/Generated/PathClientSettings.cs @@ -0,0 +1,29 @@ +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Diagnostics.CodeAnalysis; +using Microsoft.Extensions.Configuration; + +namespace Parameters.Path +{ + [Experimental("SCME0002")] + public partial class PathClientSettings : ClientSettings + { + public Uri Endpoint + { + get => throw null; + set => throw null; + } + + public PathClientOptions Options + { + get => throw null; + set => throw null; + } + + protected override void BindCore(IConfigurationSection section) => throw null; + } +} diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/query/src/Generated/QueryClient.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/query/src/Generated/QueryClient.cs index c3ed5f02aab..688a29355de 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/query/src/Generated/QueryClient.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/query/src/Generated/QueryClient.cs @@ -4,6 +4,7 @@ using System; using System.ClientModel.Primitives; +using System.Diagnostics.CodeAnalysis; namespace Parameters.Query { @@ -13,6 +14,9 @@ public partial class QueryClient public QueryClient(Uri endpoint, QueryClientOptions options) => throw null; + [Experimental("SCME0002")] + public QueryClient(QueryClientSettings settings) : this(settings?.Endpoint, settings?.Options) => throw null; + public ClientPipeline Pipeline => throw null; public virtual Constant GetConstantClient() => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/query/src/Generated/QueryClientOptions.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/query/src/Generated/QueryClientOptions.cs index a625c60f864..feac4c1e466 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/query/src/Generated/QueryClientOptions.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/query/src/Generated/QueryClientOptions.cs @@ -3,10 +3,14 @@ #nullable disable using System.ClientModel.Primitives; +using System.Diagnostics.CodeAnalysis; +using Microsoft.Extensions.Configuration; namespace Parameters.Query { public partial class QueryClientOptions : ClientPipelineOptions { + [Experimental("SCME0002")] + internal QueryClientOptions(IConfigurationSection section) : base(section) => throw null; } } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/query/src/Generated/QueryClientSettings.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/query/src/Generated/QueryClientSettings.cs new file mode 100644 index 00000000000..d41690bb4e7 --- /dev/null +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/query/src/Generated/QueryClientSettings.cs @@ -0,0 +1,29 @@ +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Diagnostics.CodeAnalysis; +using Microsoft.Extensions.Configuration; + +namespace Parameters.Query +{ + [Experimental("SCME0002")] + public partial class QueryClientSettings : ClientSettings + { + public Uri Endpoint + { + get => throw null; + set => throw null; + } + + public QueryClientOptions Options + { + get => throw null; + set => throw null; + } + + protected override void BindCore(IConfigurationSection section) => throw null; + } +} diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/spread/src/Generated/SpreadClient.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/spread/src/Generated/SpreadClient.cs index 310ea3031c4..8242e4db12f 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/spread/src/Generated/SpreadClient.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/spread/src/Generated/SpreadClient.cs @@ -4,6 +4,7 @@ using System; using System.ClientModel.Primitives; +using System.Diagnostics.CodeAnalysis; using Parameters.Spread._Alias; using Parameters.Spread._Model; @@ -15,6 +16,9 @@ public partial class SpreadClient public SpreadClient(Uri endpoint, SpreadClientOptions options) => throw null; + [Experimental("SCME0002")] + public SpreadClient(SpreadClientSettings settings) : this(settings?.Endpoint, settings?.Options) => throw null; + public ClientPipeline Pipeline => throw null; public virtual Model GetModelClient() => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/spread/src/Generated/SpreadClientOptions.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/spread/src/Generated/SpreadClientOptions.cs index c738d114fae..c4bac49d9b2 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/spread/src/Generated/SpreadClientOptions.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/spread/src/Generated/SpreadClientOptions.cs @@ -3,10 +3,14 @@ #nullable disable using System.ClientModel.Primitives; +using System.Diagnostics.CodeAnalysis; +using Microsoft.Extensions.Configuration; namespace Parameters.Spread { public partial class SpreadClientOptions : ClientPipelineOptions { + [Experimental("SCME0002")] + internal SpreadClientOptions(IConfigurationSection section) : base(section) => throw null; } } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/spread/src/Generated/SpreadClientSettings.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/spread/src/Generated/SpreadClientSettings.cs new file mode 100644 index 00000000000..1ca4f6c34d8 --- /dev/null +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/spread/src/Generated/SpreadClientSettings.cs @@ -0,0 +1,29 @@ +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Diagnostics.CodeAnalysis; +using Microsoft.Extensions.Configuration; + +namespace Parameters.Spread +{ + [Experimental("SCME0002")] + public partial class SpreadClientSettings : ClientSettings + { + public Uri Endpoint + { + get => throw null; + set => throw null; + } + + public SpreadClientOptions Options + { + get => throw null; + set => throw null; + } + + protected override void BindCore(IConfigurationSection section) => throw null; + } +} diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/content-negotiation/src/Generated/ContentNegotiationClient.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/content-negotiation/src/Generated/ContentNegotiationClient.cs index 3632bd3895d..37853116524 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/content-negotiation/src/Generated/ContentNegotiationClient.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/content-negotiation/src/Generated/ContentNegotiationClient.cs @@ -4,6 +4,7 @@ using System; using System.ClientModel.Primitives; +using System.Diagnostics.CodeAnalysis; using Payload.ContentNegotiation._DifferentBody; using Payload.ContentNegotiation._SameBody; @@ -15,6 +16,9 @@ public partial class ContentNegotiationClient public ContentNegotiationClient(Uri endpoint, ContentNegotiationClientOptions options) => throw null; + [Experimental("SCME0002")] + public ContentNegotiationClient(ContentNegotiationClientSettings settings) : this(settings?.Endpoint, settings?.Options) => throw null; + public ClientPipeline Pipeline => throw null; public virtual SameBody GetSameBodyClient() => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/content-negotiation/src/Generated/ContentNegotiationClientOptions.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/content-negotiation/src/Generated/ContentNegotiationClientOptions.cs index b35052fa447..65f6c5f01d8 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/content-negotiation/src/Generated/ContentNegotiationClientOptions.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/content-negotiation/src/Generated/ContentNegotiationClientOptions.cs @@ -3,10 +3,14 @@ #nullable disable using System.ClientModel.Primitives; +using System.Diagnostics.CodeAnalysis; +using Microsoft.Extensions.Configuration; namespace Payload.ContentNegotiation { public partial class ContentNegotiationClientOptions : ClientPipelineOptions { + [Experimental("SCME0002")] + internal ContentNegotiationClientOptions(IConfigurationSection section) : base(section) => throw null; } } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/content-negotiation/src/Generated/ContentNegotiationClientSettings.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/content-negotiation/src/Generated/ContentNegotiationClientSettings.cs new file mode 100644 index 00000000000..518fbf6fb65 --- /dev/null +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/content-negotiation/src/Generated/ContentNegotiationClientSettings.cs @@ -0,0 +1,29 @@ +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Diagnostics.CodeAnalysis; +using Microsoft.Extensions.Configuration; + +namespace Payload.ContentNegotiation +{ + [Experimental("SCME0002")] + public partial class ContentNegotiationClientSettings : ClientSettings + { + public Uri Endpoint + { + get => throw null; + set => throw null; + } + + public ContentNegotiationClientOptions Options + { + get => throw null; + set => throw null; + } + + protected override void BindCore(IConfigurationSection section) => throw null; + } +} diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/json-merge-patch/src/Generated/JsonMergePatchClient.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/json-merge-patch/src/Generated/JsonMergePatchClient.cs index 06f7a37dced..03df0074364 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/json-merge-patch/src/Generated/JsonMergePatchClient.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/json-merge-patch/src/Generated/JsonMergePatchClient.cs @@ -5,6 +5,7 @@ using System; using System.ClientModel; using System.ClientModel.Primitives; +using System.Diagnostics.CodeAnalysis; using System.Threading; using System.Threading.Tasks; @@ -16,6 +17,9 @@ public partial class JsonMergePatchClient public JsonMergePatchClient(Uri endpoint, JsonMergePatchClientOptions options) => throw null; + [Experimental("SCME0002")] + public JsonMergePatchClient(JsonMergePatchClientSettings settings) : this(settings?.Endpoint, settings?.Options) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult CreateResource(BinaryContent content, RequestOptions options = null) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/json-merge-patch/src/Generated/JsonMergePatchClientOptions.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/json-merge-patch/src/Generated/JsonMergePatchClientOptions.cs index 044a4f35fb3..5a459a6229e 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/json-merge-patch/src/Generated/JsonMergePatchClientOptions.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/json-merge-patch/src/Generated/JsonMergePatchClientOptions.cs @@ -3,10 +3,14 @@ #nullable disable using System.ClientModel.Primitives; +using System.Diagnostics.CodeAnalysis; +using Microsoft.Extensions.Configuration; namespace Payload.JsonMergePatch { public partial class JsonMergePatchClientOptions : ClientPipelineOptions { + [Experimental("SCME0002")] + internal JsonMergePatchClientOptions(IConfigurationSection section) : base(section) => throw null; } } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/json-merge-patch/src/Generated/JsonMergePatchClientSettings.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/json-merge-patch/src/Generated/JsonMergePatchClientSettings.cs new file mode 100644 index 00000000000..53e5788c5d5 --- /dev/null +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/json-merge-patch/src/Generated/JsonMergePatchClientSettings.cs @@ -0,0 +1,29 @@ +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Diagnostics.CodeAnalysis; +using Microsoft.Extensions.Configuration; + +namespace Payload.JsonMergePatch +{ + [Experimental("SCME0002")] + public partial class JsonMergePatchClientSettings : ClientSettings + { + public Uri Endpoint + { + get => throw null; + set => throw null; + } + + public JsonMergePatchClientOptions Options + { + get => throw null; + set => throw null; + } + + protected override void BindCore(IConfigurationSection section) => throw null; + } +} diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/media-type/src/Generated/MediaTypeClient.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/media-type/src/Generated/MediaTypeClient.cs index 6e34839a39c..a2721fdee72 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/media-type/src/Generated/MediaTypeClient.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/media-type/src/Generated/MediaTypeClient.cs @@ -4,6 +4,7 @@ using System; using System.ClientModel.Primitives; +using System.Diagnostics.CodeAnalysis; using Payload.MediaType._StringBody; namespace Payload.MediaType @@ -14,6 +15,9 @@ public partial class MediaTypeClient public MediaTypeClient(Uri endpoint, MediaTypeClientOptions options) => throw null; + [Experimental("SCME0002")] + public MediaTypeClient(MediaTypeClientSettings settings) : this(settings?.Endpoint, settings?.Options) => throw null; + public ClientPipeline Pipeline => throw null; public virtual StringBody GetStringBodyClient() => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/media-type/src/Generated/MediaTypeClientOptions.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/media-type/src/Generated/MediaTypeClientOptions.cs index 34c7b715a6f..56323e88093 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/media-type/src/Generated/MediaTypeClientOptions.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/media-type/src/Generated/MediaTypeClientOptions.cs @@ -3,10 +3,14 @@ #nullable disable using System.ClientModel.Primitives; +using System.Diagnostics.CodeAnalysis; +using Microsoft.Extensions.Configuration; namespace Payload.MediaType { public partial class MediaTypeClientOptions : ClientPipelineOptions { + [Experimental("SCME0002")] + internal MediaTypeClientOptions(IConfigurationSection section) : base(section) => throw null; } } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/media-type/src/Generated/MediaTypeClientSettings.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/media-type/src/Generated/MediaTypeClientSettings.cs new file mode 100644 index 00000000000..2d7404eca4e --- /dev/null +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/media-type/src/Generated/MediaTypeClientSettings.cs @@ -0,0 +1,29 @@ +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Diagnostics.CodeAnalysis; +using Microsoft.Extensions.Configuration; + +namespace Payload.MediaType +{ + [Experimental("SCME0002")] + public partial class MediaTypeClientSettings : ClientSettings + { + public Uri Endpoint + { + get => throw null; + set => throw null; + } + + public MediaTypeClientOptions Options + { + get => throw null; + set => throw null; + } + + protected override void BindCore(IConfigurationSection section) => throw null; + } +} diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/multipart/src/Generated/MultiPartClient.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/multipart/src/Generated/MultiPartClient.cs index cd0cceb3f85..4d3ab9ccea0 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/multipart/src/Generated/MultiPartClient.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/multipart/src/Generated/MultiPartClient.cs @@ -4,6 +4,7 @@ using System; using System.ClientModel.Primitives; +using System.Diagnostics.CodeAnalysis; using Payload.MultiPart._FormData; namespace Payload.MultiPart @@ -14,6 +15,9 @@ public partial class MultiPartClient public MultiPartClient(Uri endpoint, MultiPartClientOptions options) => throw null; + [Experimental("SCME0002")] + public MultiPartClient(MultiPartClientSettings settings) : this(settings?.Endpoint, settings?.Options) => throw null; + public ClientPipeline Pipeline => throw null; public virtual FormData GetFormDataClient() => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/multipart/src/Generated/MultiPartClientOptions.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/multipart/src/Generated/MultiPartClientOptions.cs index 637c71f86aa..a585956cfcd 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/multipart/src/Generated/MultiPartClientOptions.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/multipart/src/Generated/MultiPartClientOptions.cs @@ -3,10 +3,14 @@ #nullable disable using System.ClientModel.Primitives; +using System.Diagnostics.CodeAnalysis; +using Microsoft.Extensions.Configuration; namespace Payload.MultiPart { public partial class MultiPartClientOptions : ClientPipelineOptions { + [Experimental("SCME0002")] + internal MultiPartClientOptions(IConfigurationSection section) : base(section) => throw null; } } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/multipart/src/Generated/MultiPartClientSettings.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/multipart/src/Generated/MultiPartClientSettings.cs new file mode 100644 index 00000000000..4952a597b64 --- /dev/null +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/multipart/src/Generated/MultiPartClientSettings.cs @@ -0,0 +1,29 @@ +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Diagnostics.CodeAnalysis; +using Microsoft.Extensions.Configuration; + +namespace Payload.MultiPart +{ + [Experimental("SCME0002")] + public partial class MultiPartClientSettings : ClientSettings + { + public Uri Endpoint + { + get => throw null; + set => throw null; + } + + public MultiPartClientOptions Options + { + get => throw null; + set => throw null; + } + + protected override void BindCore(IConfigurationSection section) => throw null; + } +} diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/pageable/src/Generated/PageableClient.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/pageable/src/Generated/PageableClient.cs index 990fa78c378..d2371c25205 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/pageable/src/Generated/PageableClient.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/pageable/src/Generated/PageableClient.cs @@ -4,6 +4,7 @@ using System; using System.ClientModel.Primitives; +using System.Diagnostics.CodeAnalysis; using Payload.Pageable._PageSize; using Payload.Pageable._ServerDrivenPagination; using Payload.Pageable._XmlPagination; @@ -16,6 +17,9 @@ public partial class PageableClient public PageableClient(Uri endpoint, PageableClientOptions options) => throw null; + [Experimental("SCME0002")] + public PageableClient(PageableClientSettings settings) : this(settings?.Endpoint, settings?.Options) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ServerDrivenPagination GetServerDrivenPaginationClient() => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/pageable/src/Generated/PageableClientOptions.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/pageable/src/Generated/PageableClientOptions.cs index a852c495b1e..f60308ebdce 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/pageable/src/Generated/PageableClientOptions.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/pageable/src/Generated/PageableClientOptions.cs @@ -3,10 +3,14 @@ #nullable disable using System.ClientModel.Primitives; +using System.Diagnostics.CodeAnalysis; +using Microsoft.Extensions.Configuration; namespace Payload.Pageable { public partial class PageableClientOptions : ClientPipelineOptions { + [Experimental("SCME0002")] + internal PageableClientOptions(IConfigurationSection section) : base(section) => throw null; } } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/pageable/src/Generated/PageableClientSettings.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/pageable/src/Generated/PageableClientSettings.cs new file mode 100644 index 00000000000..f1e6a9393e2 --- /dev/null +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/pageable/src/Generated/PageableClientSettings.cs @@ -0,0 +1,29 @@ +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Diagnostics.CodeAnalysis; +using Microsoft.Extensions.Configuration; + +namespace Payload.Pageable +{ + [Experimental("SCME0002")] + public partial class PageableClientSettings : ClientSettings + { + public Uri Endpoint + { + get => throw null; + set => throw null; + } + + public PageableClientOptions Options + { + get => throw null; + set => throw null; + } + + protected override void BindCore(IConfigurationSection section) => throw null; + } +} diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/xml/src/Generated/XmlClient.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/xml/src/Generated/XmlClient.cs index 8b674b49e90..a0354192a44 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/xml/src/Generated/XmlClient.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/xml/src/Generated/XmlClient.cs @@ -4,6 +4,7 @@ using System; using System.ClientModel.Primitives; +using System.Diagnostics.CodeAnalysis; namespace Payload.Xml { @@ -13,6 +14,9 @@ public partial class XmlClient public XmlClient(Uri endpoint, XmlClientOptions options) => throw null; + [Experimental("SCME0002")] + public XmlClient(XmlClientSettings settings) : this(settings?.Endpoint, settings?.Options) => throw null; + public ClientPipeline Pipeline => throw null; public virtual SimpleModelValue GetSimpleModelValueClient() => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/xml/src/Generated/XmlClientOptions.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/xml/src/Generated/XmlClientOptions.cs index 467bebf98b1..2f59c52886b 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/xml/src/Generated/XmlClientOptions.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/xml/src/Generated/XmlClientOptions.cs @@ -3,10 +3,14 @@ #nullable disable using System.ClientModel.Primitives; +using System.Diagnostics.CodeAnalysis; +using Microsoft.Extensions.Configuration; namespace Payload.Xml { public partial class XmlClientOptions : ClientPipelineOptions { + [Experimental("SCME0002")] + internal XmlClientOptions(IConfigurationSection section) : base(section) => throw null; } } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/xml/src/Generated/XmlClientSettings.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/xml/src/Generated/XmlClientSettings.cs new file mode 100644 index 00000000000..57bc9f1bbc8 --- /dev/null +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/xml/src/Generated/XmlClientSettings.cs @@ -0,0 +1,29 @@ +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Diagnostics.CodeAnalysis; +using Microsoft.Extensions.Configuration; + +namespace Payload.Xml +{ + [Experimental("SCME0002")] + public partial class XmlClientSettings : ClientSettings + { + public Uri Endpoint + { + get => throw null; + set => throw null; + } + + public XmlClientOptions Options + { + get => throw null; + set => throw null; + } + + protected override void BindCore(IConfigurationSection section) => throw null; + } +} diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/resiliency/srv-driven/v1/src/Generated/ResiliencyServiceDrivenClient.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/resiliency/srv-driven/v1/src/Generated/ResiliencyServiceDrivenClient.cs index d5a954479be..39c24de3c65 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/resiliency/srv-driven/v1/src/Generated/ResiliencyServiceDrivenClient.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/resiliency/srv-driven/v1/src/Generated/ResiliencyServiceDrivenClient.cs @@ -5,6 +5,7 @@ using System; using System.ClientModel; using System.ClientModel.Primitives; +using System.Diagnostics.CodeAnalysis; using System.Threading; using System.Threading.Tasks; @@ -18,6 +19,9 @@ public partial class ResiliencyServiceDrivenClient public ResiliencyServiceDrivenClient(Uri endpoint, string serviceDeploymentVersion, ResiliencyServiceDrivenClientOptions options) => throw null; + [Experimental("SCME0002")] + public ResiliencyServiceDrivenClient(ResiliencyServiceDrivenClientSettings settings) : this(settings?.Endpoint, settings?.Options) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult FromNone(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/resiliency/srv-driven/v1/src/Generated/ResiliencyServiceDrivenClientOptions.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/resiliency/srv-driven/v1/src/Generated/ResiliencyServiceDrivenClientOptions.cs index d5dd7cc38e0..2612bc02b39 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/resiliency/srv-driven/v1/src/Generated/ResiliencyServiceDrivenClientOptions.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/resiliency/srv-driven/v1/src/Generated/ResiliencyServiceDrivenClientOptions.cs @@ -3,6 +3,8 @@ #nullable disable using System.ClientModel.Primitives; +using System.Diagnostics.CodeAnalysis; +using Microsoft.Extensions.Configuration; namespace Resiliency.ServiceDriven { @@ -12,6 +14,9 @@ public partial class ResiliencyServiceDrivenClientOptions : ClientPipelineOption public ResiliencyServiceDrivenClientOptions(ServiceVersion version = LatestVersion) => throw null; + [Experimental("SCME0002")] + internal ResiliencyServiceDrivenClientOptions(IConfigurationSection section) : base(section) => throw null; + public enum ServiceVersion { /// Version 1. diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/resiliency/srv-driven/v1/src/Generated/ResiliencyServiceDrivenClientSettings.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/resiliency/srv-driven/v1/src/Generated/ResiliencyServiceDrivenClientSettings.cs new file mode 100644 index 00000000000..8fc780e6f90 --- /dev/null +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/resiliency/srv-driven/v1/src/Generated/ResiliencyServiceDrivenClientSettings.cs @@ -0,0 +1,29 @@ +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Diagnostics.CodeAnalysis; +using Microsoft.Extensions.Configuration; + +namespace Resiliency.ServiceDriven +{ + [Experimental("SCME0002")] + public partial class ResiliencyServiceDrivenClientSettings : ClientSettings + { + public Uri Endpoint + { + get => throw null; + set => throw null; + } + + public ResiliencyServiceDrivenClientOptions Options + { + get => throw null; + set => throw null; + } + + protected override void BindCore(IConfigurationSection section) => throw null; + } +} diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/resiliency/srv-driven/v2/src/Generated/ResiliencyServiceDrivenClient.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/resiliency/srv-driven/v2/src/Generated/ResiliencyServiceDrivenClient.cs index d99259d205c..83002c7a037 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/resiliency/srv-driven/v2/src/Generated/ResiliencyServiceDrivenClient.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/resiliency/srv-driven/v2/src/Generated/ResiliencyServiceDrivenClient.cs @@ -5,6 +5,7 @@ using System; using System.ClientModel; using System.ClientModel.Primitives; +using System.Diagnostics.CodeAnalysis; using System.Threading; using System.Threading.Tasks; @@ -18,6 +19,9 @@ public partial class ResiliencyServiceDrivenClient public ResiliencyServiceDrivenClient(Uri endpoint, string serviceDeploymentVersion, ResiliencyServiceDrivenClientOptions options) => throw null; + [Experimental("SCME0002")] + public ResiliencyServiceDrivenClient(ResiliencyServiceDrivenClientSettings settings) : this(settings?.Endpoint, settings?.Options) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult AddOperation(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/resiliency/srv-driven/v2/src/Generated/ResiliencyServiceDrivenClientOptions.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/resiliency/srv-driven/v2/src/Generated/ResiliencyServiceDrivenClientOptions.cs index 233945b82e3..b4d13f3a8f5 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/resiliency/srv-driven/v2/src/Generated/ResiliencyServiceDrivenClientOptions.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/resiliency/srv-driven/v2/src/Generated/ResiliencyServiceDrivenClientOptions.cs @@ -3,6 +3,8 @@ #nullable disable using System.ClientModel.Primitives; +using System.Diagnostics.CodeAnalysis; +using Microsoft.Extensions.Configuration; namespace Resiliency.ServiceDriven { @@ -12,6 +14,9 @@ public partial class ResiliencyServiceDrivenClientOptions : ClientPipelineOption public ResiliencyServiceDrivenClientOptions(ServiceVersion version = LatestVersion) => throw null; + [Experimental("SCME0002")] + internal ResiliencyServiceDrivenClientOptions(IConfigurationSection section) : base(section) => throw null; + public enum ServiceVersion { /// Version 1. diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/resiliency/srv-driven/v2/src/Generated/ResiliencyServiceDrivenClientSettings.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/resiliency/srv-driven/v2/src/Generated/ResiliencyServiceDrivenClientSettings.cs new file mode 100644 index 00000000000..8fc780e6f90 --- /dev/null +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/resiliency/srv-driven/v2/src/Generated/ResiliencyServiceDrivenClientSettings.cs @@ -0,0 +1,29 @@ +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Diagnostics.CodeAnalysis; +using Microsoft.Extensions.Configuration; + +namespace Resiliency.ServiceDriven +{ + [Experimental("SCME0002")] + public partial class ResiliencyServiceDrivenClientSettings : ClientSettings + { + public Uri Endpoint + { + get => throw null; + set => throw null; + } + + public ResiliencyServiceDrivenClientOptions Options + { + get => throw null; + set => throw null; + } + + protected override void BindCore(IConfigurationSection section) => throw null; + } +} diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/response/status-code-range/src/Generated/StatusCodeRangeClient.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/response/status-code-range/src/Generated/StatusCodeRangeClient.cs index 68220900e03..cc62426e506 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/response/status-code-range/src/Generated/StatusCodeRangeClient.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/response/status-code-range/src/Generated/StatusCodeRangeClient.cs @@ -5,6 +5,7 @@ using System; using System.ClientModel; using System.ClientModel.Primitives; +using System.Diagnostics.CodeAnalysis; using System.Threading; using System.Threading.Tasks; @@ -16,6 +17,9 @@ public partial class StatusCodeRangeClient public StatusCodeRangeClient(Uri endpoint, StatusCodeRangeClientOptions options) => throw null; + [Experimental("SCME0002")] + public StatusCodeRangeClient(StatusCodeRangeClientSettings settings) : this(settings?.Endpoint, settings?.Options) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult ErrorResponseStatusCodeInRange(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/response/status-code-range/src/Generated/StatusCodeRangeClientOptions.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/response/status-code-range/src/Generated/StatusCodeRangeClientOptions.cs index 2433a12ddfd..60107960db0 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/response/status-code-range/src/Generated/StatusCodeRangeClientOptions.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/response/status-code-range/src/Generated/StatusCodeRangeClientOptions.cs @@ -3,10 +3,14 @@ #nullable disable using System.ClientModel.Primitives; +using System.Diagnostics.CodeAnalysis; +using Microsoft.Extensions.Configuration; namespace Response.StatusCodeRange { public partial class StatusCodeRangeClientOptions : ClientPipelineOptions { + [Experimental("SCME0002")] + internal StatusCodeRangeClientOptions(IConfigurationSection section) : base(section) => throw null; } } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/response/status-code-range/src/Generated/StatusCodeRangeClientSettings.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/response/status-code-range/src/Generated/StatusCodeRangeClientSettings.cs new file mode 100644 index 00000000000..c08b681519a --- /dev/null +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/response/status-code-range/src/Generated/StatusCodeRangeClientSettings.cs @@ -0,0 +1,29 @@ +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Diagnostics.CodeAnalysis; +using Microsoft.Extensions.Configuration; + +namespace Response.StatusCodeRange +{ + [Experimental("SCME0002")] + public partial class StatusCodeRangeClientSettings : ClientSettings + { + public Uri Endpoint + { + get => throw null; + set => throw null; + } + + public StatusCodeRangeClientOptions Options + { + get => throw null; + set => throw null; + } + + protected override void BindCore(IConfigurationSection section) => throw null; + } +} diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/RoutesClient.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/RoutesClient.cs index 7b3edc83edf..9e22955b9e7 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/RoutesClient.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/RoutesClient.cs @@ -5,6 +5,7 @@ using System; using System.ClientModel; using System.ClientModel.Primitives; +using System.Diagnostics.CodeAnalysis; using System.Threading; using System.Threading.Tasks; using Routes._PathParameters; @@ -18,6 +19,9 @@ public partial class RoutesClient public RoutesClient(Uri endpoint, RoutesClientOptions options) => throw null; + [Experimental("SCME0002")] + public RoutesClient(RoutesClientSettings settings) : this(settings?.Endpoint, settings?.Options) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult Fixed(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/RoutesClientOptions.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/RoutesClientOptions.cs index f81efdb4ab9..d3f721a8793 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/RoutesClientOptions.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/RoutesClientOptions.cs @@ -3,10 +3,14 @@ #nullable disable using System.ClientModel.Primitives; +using System.Diagnostics.CodeAnalysis; +using Microsoft.Extensions.Configuration; namespace Routes { public partial class RoutesClientOptions : ClientPipelineOptions { + [Experimental("SCME0002")] + internal RoutesClientOptions(IConfigurationSection section) : base(section) => throw null; } } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/RoutesClientSettings.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/RoutesClientSettings.cs new file mode 100644 index 00000000000..8b389ba6227 --- /dev/null +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/RoutesClientSettings.cs @@ -0,0 +1,29 @@ +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Diagnostics.CodeAnalysis; +using Microsoft.Extensions.Configuration; + +namespace Routes +{ + [Experimental("SCME0002")] + public partial class RoutesClientSettings : ClientSettings + { + public Uri Endpoint + { + get => throw null; + set => throw null; + } + + public RoutesClientOptions Options + { + get => throw null; + set => throw null; + } + + protected override void BindCore(IConfigurationSection section) => throw null; + } +} diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/serialization/encoded-name/json/src/Generated/JsonClient.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/serialization/encoded-name/json/src/Generated/JsonClient.cs index 0e13b569cc6..f2fe872a261 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/serialization/encoded-name/json/src/Generated/JsonClient.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/serialization/encoded-name/json/src/Generated/JsonClient.cs @@ -4,6 +4,7 @@ using System; using System.ClientModel.Primitives; +using System.Diagnostics.CodeAnalysis; using Serialization.EncodedName.Json._Property; namespace Serialization.EncodedName.Json @@ -14,6 +15,9 @@ public partial class JsonClient public JsonClient(Uri endpoint, JsonClientOptions options) => throw null; + [Experimental("SCME0002")] + public JsonClient(JsonClientSettings settings) : this(settings?.Endpoint, settings?.Options) => throw null; + public ClientPipeline Pipeline => throw null; public virtual Property GetPropertyClient() => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/serialization/encoded-name/json/src/Generated/JsonClientOptions.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/serialization/encoded-name/json/src/Generated/JsonClientOptions.cs index bc3159f77db..28328fcb891 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/serialization/encoded-name/json/src/Generated/JsonClientOptions.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/serialization/encoded-name/json/src/Generated/JsonClientOptions.cs @@ -3,10 +3,14 @@ #nullable disable using System.ClientModel.Primitives; +using System.Diagnostics.CodeAnalysis; +using Microsoft.Extensions.Configuration; namespace Serialization.EncodedName.Json { public partial class JsonClientOptions : ClientPipelineOptions { + [Experimental("SCME0002")] + internal JsonClientOptions(IConfigurationSection section) : base(section) => throw null; } } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/serialization/encoded-name/json/src/Generated/JsonClientSettings.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/serialization/encoded-name/json/src/Generated/JsonClientSettings.cs new file mode 100644 index 00000000000..ae2ecca1041 --- /dev/null +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/serialization/encoded-name/json/src/Generated/JsonClientSettings.cs @@ -0,0 +1,29 @@ +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Diagnostics.CodeAnalysis; +using Microsoft.Extensions.Configuration; + +namespace Serialization.EncodedName.Json +{ + [Experimental("SCME0002")] + public partial class JsonClientSettings : ClientSettings + { + public Uri Endpoint + { + get => throw null; + set => throw null; + } + + public JsonClientOptions Options + { + get => throw null; + set => throw null; + } + + protected override void BindCore(IConfigurationSection section) => throw null; + } +} diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/server/endpoint/not-defined/src/Generated/NotDefinedClient.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/server/endpoint/not-defined/src/Generated/NotDefinedClient.cs index c9b371e3911..028fad6a4b2 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/server/endpoint/not-defined/src/Generated/NotDefinedClient.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/server/endpoint/not-defined/src/Generated/NotDefinedClient.cs @@ -5,6 +5,7 @@ using System; using System.ClientModel; using System.ClientModel.Primitives; +using System.Diagnostics.CodeAnalysis; using System.Threading; using System.Threading.Tasks; @@ -18,6 +19,9 @@ public partial class NotDefinedClient public NotDefinedClient(Uri endpoint, NotDefinedClientOptions options) => throw null; + [Experimental("SCME0002")] + public NotDefinedClient(NotDefinedClientSettings settings) : this(settings?.Endpoint, settings?.Options) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult Valid(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/server/endpoint/not-defined/src/Generated/NotDefinedClientOptions.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/server/endpoint/not-defined/src/Generated/NotDefinedClientOptions.cs index 7621f589fdc..88f228a9f3f 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/server/endpoint/not-defined/src/Generated/NotDefinedClientOptions.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/server/endpoint/not-defined/src/Generated/NotDefinedClientOptions.cs @@ -3,10 +3,14 @@ #nullable disable using System.ClientModel.Primitives; +using System.Diagnostics.CodeAnalysis; +using Microsoft.Extensions.Configuration; namespace Server.Endpoint.NotDefined { public partial class NotDefinedClientOptions : ClientPipelineOptions { + [Experimental("SCME0002")] + internal NotDefinedClientOptions(IConfigurationSection section) : base(section) => throw null; } } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/server/endpoint/not-defined/src/Generated/NotDefinedClientSettings.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/server/endpoint/not-defined/src/Generated/NotDefinedClientSettings.cs new file mode 100644 index 00000000000..fd6f73d8ae7 --- /dev/null +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/server/endpoint/not-defined/src/Generated/NotDefinedClientSettings.cs @@ -0,0 +1,29 @@ +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Diagnostics.CodeAnalysis; +using Microsoft.Extensions.Configuration; + +namespace Server.Endpoint.NotDefined +{ + [Experimental("SCME0002")] + public partial class NotDefinedClientSettings : ClientSettings + { + public Uri Endpoint + { + get => throw null; + set => throw null; + } + + public NotDefinedClientOptions Options + { + get => throw null; + set => throw null; + } + + protected override void BindCore(IConfigurationSection section) => throw null; + } +} diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/server/path/multiple/src/Generated/MultipleClient.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/server/path/multiple/src/Generated/MultipleClient.cs index cfb066bf912..99b5606c8f9 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/server/path/multiple/src/Generated/MultipleClient.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/server/path/multiple/src/Generated/MultipleClient.cs @@ -5,6 +5,7 @@ using System; using System.ClientModel; using System.ClientModel.Primitives; +using System.Diagnostics.CodeAnalysis; using System.Threading; using System.Threading.Tasks; @@ -18,6 +19,9 @@ public partial class MultipleClient public MultipleClient(Uri endpoint, MultipleClientOptions options) => throw null; + [Experimental("SCME0002")] + public MultipleClient(MultipleClientSettings settings) : this(settings?.Endpoint, settings?.Options) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult NoOperationParams(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/server/path/multiple/src/Generated/MultipleClientOptions.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/server/path/multiple/src/Generated/MultipleClientOptions.cs index 3c63332cfb3..caa3e5d7a43 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/server/path/multiple/src/Generated/MultipleClientOptions.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/server/path/multiple/src/Generated/MultipleClientOptions.cs @@ -3,6 +3,8 @@ #nullable disable using System.ClientModel.Primitives; +using System.Diagnostics.CodeAnalysis; +using Microsoft.Extensions.Configuration; namespace Server.Path.Multiple { @@ -12,6 +14,9 @@ public partial class MultipleClientOptions : ClientPipelineOptions public MultipleClientOptions(ServiceVersion version = LatestVersion) => throw null; + [Experimental("SCME0002")] + internal MultipleClientOptions(IConfigurationSection section) : base(section) => throw null; + public enum ServiceVersion { /// Version 1.0. diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/server/path/multiple/src/Generated/MultipleClientSettings.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/server/path/multiple/src/Generated/MultipleClientSettings.cs new file mode 100644 index 00000000000..6f63f3d49bd --- /dev/null +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/server/path/multiple/src/Generated/MultipleClientSettings.cs @@ -0,0 +1,29 @@ +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Diagnostics.CodeAnalysis; +using Microsoft.Extensions.Configuration; + +namespace Server.Path.Multiple +{ + [Experimental("SCME0002")] + public partial class MultipleClientSettings : ClientSettings + { + public Uri Endpoint + { + get => throw null; + set => throw null; + } + + public MultipleClientOptions Options + { + get => throw null; + set => throw null; + } + + protected override void BindCore(IConfigurationSection section) => throw null; + } +} diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/server/path/single/src/Generated/SingleClient.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/server/path/single/src/Generated/SingleClient.cs index 25d2f13eb10..1296a3c8ddf 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/server/path/single/src/Generated/SingleClient.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/server/path/single/src/Generated/SingleClient.cs @@ -5,6 +5,7 @@ using System; using System.ClientModel; using System.ClientModel.Primitives; +using System.Diagnostics.CodeAnalysis; using System.Threading; using System.Threading.Tasks; @@ -18,6 +19,9 @@ public partial class SingleClient public SingleClient(Uri endpoint, SingleClientOptions options) => throw null; + [Experimental("SCME0002")] + public SingleClient(SingleClientSettings settings) : this(settings?.Endpoint, settings?.Options) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult MyOp(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/server/path/single/src/Generated/SingleClientOptions.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/server/path/single/src/Generated/SingleClientOptions.cs index 2bf92e1e4dd..78e65f3988e 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/server/path/single/src/Generated/SingleClientOptions.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/server/path/single/src/Generated/SingleClientOptions.cs @@ -3,10 +3,14 @@ #nullable disable using System.ClientModel.Primitives; +using System.Diagnostics.CodeAnalysis; +using Microsoft.Extensions.Configuration; namespace Server.Path.Single { public partial class SingleClientOptions : ClientPipelineOptions { + [Experimental("SCME0002")] + internal SingleClientOptions(IConfigurationSection section) : base(section) => throw null; } } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/server/path/single/src/Generated/SingleClientSettings.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/server/path/single/src/Generated/SingleClientSettings.cs new file mode 100644 index 00000000000..62fc1c47174 --- /dev/null +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/server/path/single/src/Generated/SingleClientSettings.cs @@ -0,0 +1,29 @@ +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Diagnostics.CodeAnalysis; +using Microsoft.Extensions.Configuration; + +namespace Server.Path.Single +{ + [Experimental("SCME0002")] + public partial class SingleClientSettings : ClientSettings + { + public Uri Endpoint + { + get => throw null; + set => throw null; + } + + public SingleClientOptions Options + { + get => throw null; + set => throw null; + } + + protected override void BindCore(IConfigurationSection section) => throw null; + } +} diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/server/versions/not-versioned/src/Generated/NotVersionedClient.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/server/versions/not-versioned/src/Generated/NotVersionedClient.cs index 6fb0abe3bce..18284bace62 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/server/versions/not-versioned/src/Generated/NotVersionedClient.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/server/versions/not-versioned/src/Generated/NotVersionedClient.cs @@ -5,6 +5,7 @@ using System; using System.ClientModel; using System.ClientModel.Primitives; +using System.Diagnostics.CodeAnalysis; using System.Threading; using System.Threading.Tasks; @@ -18,6 +19,9 @@ public partial class NotVersionedClient public NotVersionedClient(Uri endpoint, NotVersionedClientOptions options) => throw null; + [Experimental("SCME0002")] + public NotVersionedClient(NotVersionedClientSettings settings) : this(settings?.Endpoint, settings?.Options) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult WithoutApiVersion(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/server/versions/not-versioned/src/Generated/NotVersionedClientOptions.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/server/versions/not-versioned/src/Generated/NotVersionedClientOptions.cs index f08093acac4..9568cf0dff4 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/server/versions/not-versioned/src/Generated/NotVersionedClientOptions.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/server/versions/not-versioned/src/Generated/NotVersionedClientOptions.cs @@ -3,10 +3,14 @@ #nullable disable using System.ClientModel.Primitives; +using System.Diagnostics.CodeAnalysis; +using Microsoft.Extensions.Configuration; namespace Server.Versions.NotVersioned { public partial class NotVersionedClientOptions : ClientPipelineOptions { + [Experimental("SCME0002")] + internal NotVersionedClientOptions(IConfigurationSection section) : base(section) => throw null; } } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/server/versions/not-versioned/src/Generated/NotVersionedClientSettings.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/server/versions/not-versioned/src/Generated/NotVersionedClientSettings.cs new file mode 100644 index 00000000000..f090470d82a --- /dev/null +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/server/versions/not-versioned/src/Generated/NotVersionedClientSettings.cs @@ -0,0 +1,29 @@ +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Diagnostics.CodeAnalysis; +using Microsoft.Extensions.Configuration; + +namespace Server.Versions.NotVersioned +{ + [Experimental("SCME0002")] + public partial class NotVersionedClientSettings : ClientSettings + { + public Uri Endpoint + { + get => throw null; + set => throw null; + } + + public NotVersionedClientOptions Options + { + get => throw null; + set => throw null; + } + + protected override void BindCore(IConfigurationSection section) => throw null; + } +} diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/server/versions/versioned/src/Generated/VersionedClient.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/server/versions/versioned/src/Generated/VersionedClient.cs index 01e9d2e3224..5beaaaff906 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/server/versions/versioned/src/Generated/VersionedClient.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/server/versions/versioned/src/Generated/VersionedClient.cs @@ -5,6 +5,7 @@ using System; using System.ClientModel; using System.ClientModel.Primitives; +using System.Diagnostics.CodeAnalysis; using System.Threading; using System.Threading.Tasks; @@ -18,6 +19,9 @@ public partial class VersionedClient public VersionedClient(Uri endpoint, VersionedClientOptions options) => throw null; + [Experimental("SCME0002")] + public VersionedClient(VersionedClientSettings settings) : this(settings?.Endpoint, settings?.Options) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult WithoutApiVersion(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/server/versions/versioned/src/Generated/VersionedClientOptions.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/server/versions/versioned/src/Generated/VersionedClientOptions.cs index 6caa7e3df01..ad90f69c8ee 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/server/versions/versioned/src/Generated/VersionedClientOptions.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/server/versions/versioned/src/Generated/VersionedClientOptions.cs @@ -3,6 +3,8 @@ #nullable disable using System.ClientModel.Primitives; +using System.Diagnostics.CodeAnalysis; +using Microsoft.Extensions.Configuration; namespace Server.Versions.Versioned { @@ -12,6 +14,9 @@ public partial class VersionedClientOptions : ClientPipelineOptions public VersionedClientOptions(ServiceVersion version = LatestVersion) => throw null; + [Experimental("SCME0002")] + internal VersionedClientOptions(IConfigurationSection section) : base(section) => throw null; + public enum ServiceVersion { /// The version 2022-12-01-preview. diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/server/versions/versioned/src/Generated/VersionedClientSettings.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/server/versions/versioned/src/Generated/VersionedClientSettings.cs new file mode 100644 index 00000000000..b9d2f526719 --- /dev/null +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/server/versions/versioned/src/Generated/VersionedClientSettings.cs @@ -0,0 +1,29 @@ +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Diagnostics.CodeAnalysis; +using Microsoft.Extensions.Configuration; + +namespace Server.Versions.Versioned +{ + [Experimental("SCME0002")] + public partial class VersionedClientSettings : ClientSettings + { + public Uri Endpoint + { + get => throw null; + set => throw null; + } + + public VersionedClientOptions Options + { + get => throw null; + set => throw null; + } + + protected override void BindCore(IConfigurationSection section) => throw null; + } +} diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/special-headers/conditional-request/src/Generated/ConditionalRequestClient.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/special-headers/conditional-request/src/Generated/ConditionalRequestClient.cs index 0e54b80f164..976a2b46406 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/special-headers/conditional-request/src/Generated/ConditionalRequestClient.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/special-headers/conditional-request/src/Generated/ConditionalRequestClient.cs @@ -5,6 +5,7 @@ using System; using System.ClientModel; using System.ClientModel.Primitives; +using System.Diagnostics.CodeAnalysis; using System.Threading; using System.Threading.Tasks; @@ -16,6 +17,9 @@ public partial class ConditionalRequestClient public ConditionalRequestClient(Uri endpoint, ConditionalRequestClientOptions options) => throw null; + [Experimental("SCME0002")] + public ConditionalRequestClient(ConditionalRequestClientSettings settings) : this(settings?.Endpoint, settings?.Options) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult PostIfMatch(string ifMatch, RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/special-headers/conditional-request/src/Generated/ConditionalRequestClientOptions.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/special-headers/conditional-request/src/Generated/ConditionalRequestClientOptions.cs index 924fd0111b6..9f62811ed8f 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/special-headers/conditional-request/src/Generated/ConditionalRequestClientOptions.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/special-headers/conditional-request/src/Generated/ConditionalRequestClientOptions.cs @@ -3,10 +3,14 @@ #nullable disable using System.ClientModel.Primitives; +using System.Diagnostics.CodeAnalysis; +using Microsoft.Extensions.Configuration; namespace SpecialHeaders.ConditionalRequest { public partial class ConditionalRequestClientOptions : ClientPipelineOptions { + [Experimental("SCME0002")] + internal ConditionalRequestClientOptions(IConfigurationSection section) : base(section) => throw null; } } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/special-headers/conditional-request/src/Generated/ConditionalRequestClientSettings.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/special-headers/conditional-request/src/Generated/ConditionalRequestClientSettings.cs new file mode 100644 index 00000000000..875c80b7101 --- /dev/null +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/special-headers/conditional-request/src/Generated/ConditionalRequestClientSettings.cs @@ -0,0 +1,29 @@ +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Diagnostics.CodeAnalysis; +using Microsoft.Extensions.Configuration; + +namespace SpecialHeaders.ConditionalRequest +{ + [Experimental("SCME0002")] + public partial class ConditionalRequestClientSettings : ClientSettings + { + public Uri Endpoint + { + get => throw null; + set => throw null; + } + + public ConditionalRequestClientOptions Options + { + get => throw null; + set => throw null; + } + + protected override void BindCore(IConfigurationSection section) => throw null; + } +} diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/special-headers/repeatability/src/Generated/RepeatabilityClient.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/special-headers/repeatability/src/Generated/RepeatabilityClient.cs index 325865ab679..04f50ea930e 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/special-headers/repeatability/src/Generated/RepeatabilityClient.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/special-headers/repeatability/src/Generated/RepeatabilityClient.cs @@ -5,6 +5,7 @@ using System; using System.ClientModel; using System.ClientModel.Primitives; +using System.Diagnostics.CodeAnalysis; using System.Threading; using System.Threading.Tasks; @@ -16,6 +17,9 @@ public partial class RepeatabilityClient public RepeatabilityClient(Uri endpoint, RepeatabilityClientOptions options) => throw null; + [Experimental("SCME0002")] + public RepeatabilityClient(RepeatabilityClientSettings settings) : this(settings?.Endpoint, settings?.Options) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult ImmediateSuccess(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/special-headers/repeatability/src/Generated/RepeatabilityClientOptions.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/special-headers/repeatability/src/Generated/RepeatabilityClientOptions.cs index e41461a9acc..cf921921a90 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/special-headers/repeatability/src/Generated/RepeatabilityClientOptions.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/special-headers/repeatability/src/Generated/RepeatabilityClientOptions.cs @@ -3,10 +3,14 @@ #nullable disable using System.ClientModel.Primitives; +using System.Diagnostics.CodeAnalysis; +using Microsoft.Extensions.Configuration; namespace SpecialHeaders.Repeatability { public partial class RepeatabilityClientOptions : ClientPipelineOptions { + [Experimental("SCME0002")] + internal RepeatabilityClientOptions(IConfigurationSection section) : base(section) => throw null; } } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/special-headers/repeatability/src/Generated/RepeatabilityClientSettings.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/special-headers/repeatability/src/Generated/RepeatabilityClientSettings.cs new file mode 100644 index 00000000000..3a295325198 --- /dev/null +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/special-headers/repeatability/src/Generated/RepeatabilityClientSettings.cs @@ -0,0 +1,29 @@ +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Diagnostics.CodeAnalysis; +using Microsoft.Extensions.Configuration; + +namespace SpecialHeaders.Repeatability +{ + [Experimental("SCME0002")] + public partial class RepeatabilityClientSettings : ClientSettings + { + public Uri Endpoint + { + get => throw null; + set => throw null; + } + + public RepeatabilityClientOptions Options + { + get => throw null; + set => throw null; + } + + protected override void BindCore(IConfigurationSection section) => throw null; + } +} diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/special-words/src/Generated/SpecialWordsClient.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/special-words/src/Generated/SpecialWordsClient.cs index 7d18528a04e..7d4c924f080 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/special-words/src/Generated/SpecialWordsClient.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/special-words/src/Generated/SpecialWordsClient.cs @@ -4,6 +4,7 @@ using System; using System.ClientModel.Primitives; +using System.Diagnostics.CodeAnalysis; using SpecialWords._ModelProperties; using SpecialWords._Models; @@ -15,6 +16,9 @@ public partial class SpecialWordsClient public SpecialWordsClient(Uri endpoint, SpecialWordsClientOptions options) => throw null; + [Experimental("SCME0002")] + public SpecialWordsClient(SpecialWordsClientSettings settings) : this(settings?.Endpoint, settings?.Options) => throw null; + public ClientPipeline Pipeline => throw null; public virtual Models GetModelsClient() => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/special-words/src/Generated/SpecialWordsClientOptions.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/special-words/src/Generated/SpecialWordsClientOptions.cs index 51d0271c810..ac465ad1fb5 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/special-words/src/Generated/SpecialWordsClientOptions.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/special-words/src/Generated/SpecialWordsClientOptions.cs @@ -3,10 +3,14 @@ #nullable disable using System.ClientModel.Primitives; +using System.Diagnostics.CodeAnalysis; +using Microsoft.Extensions.Configuration; namespace SpecialWords { public partial class SpecialWordsClientOptions : ClientPipelineOptions { + [Experimental("SCME0002")] + internal SpecialWordsClientOptions(IConfigurationSection section) : base(section) => throw null; } } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/special-words/src/Generated/SpecialWordsClientSettings.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/special-words/src/Generated/SpecialWordsClientSettings.cs new file mode 100644 index 00000000000..28c09cdfd51 --- /dev/null +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/special-words/src/Generated/SpecialWordsClientSettings.cs @@ -0,0 +1,29 @@ +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Diagnostics.CodeAnalysis; +using Microsoft.Extensions.Configuration; + +namespace SpecialWords +{ + [Experimental("SCME0002")] + public partial class SpecialWordsClientSettings : ClientSettings + { + public Uri Endpoint + { + get => throw null; + set => throw null; + } + + public SpecialWordsClientOptions Options + { + get => throw null; + set => throw null; + } + + protected override void BindCore(IConfigurationSection section) => throw null; + } +} diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/array/src/Generated/ArrayClient.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/array/src/Generated/ArrayClient.cs index 515ecb8abaa..eff03c97449 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/array/src/Generated/ArrayClient.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/array/src/Generated/ArrayClient.cs @@ -4,6 +4,7 @@ using System; using System.ClientModel.Primitives; +using System.Diagnostics.CodeAnalysis; namespace _Type._Array { @@ -13,6 +14,9 @@ public partial class ArrayClient public ArrayClient(Uri endpoint, ArrayClientOptions options) => throw null; + [Experimental("SCME0002")] + public ArrayClient(ArrayClientSettings settings) : this(settings?.Endpoint, settings?.Options) => throw null; + public ClientPipeline Pipeline => throw null; public virtual Int32Value GetInt32ValueClient() => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/array/src/Generated/ArrayClientOptions.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/array/src/Generated/ArrayClientOptions.cs index 90179926109..7b9c9fba908 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/array/src/Generated/ArrayClientOptions.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/array/src/Generated/ArrayClientOptions.cs @@ -3,10 +3,14 @@ #nullable disable using System.ClientModel.Primitives; +using System.Diagnostics.CodeAnalysis; +using Microsoft.Extensions.Configuration; namespace _Type._Array { public partial class ArrayClientOptions : ClientPipelineOptions { + [Experimental("SCME0002")] + internal ArrayClientOptions(IConfigurationSection section) : base(section) => throw null; } } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/array/src/Generated/ArrayClientSettings.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/array/src/Generated/ArrayClientSettings.cs new file mode 100644 index 00000000000..c315edcc62d --- /dev/null +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/array/src/Generated/ArrayClientSettings.cs @@ -0,0 +1,29 @@ +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Diagnostics.CodeAnalysis; +using Microsoft.Extensions.Configuration; + +namespace _Type._Array +{ + [Experimental("SCME0002")] + public partial class ArrayClientSettings : ClientSettings + { + public Uri Endpoint + { + get => throw null; + set => throw null; + } + + public ArrayClientOptions Options + { + get => throw null; + set => throw null; + } + + protected override void BindCore(IConfigurationSection section) => throw null; + } +} diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/dictionary/src/Generated/DictionaryClient.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/dictionary/src/Generated/DictionaryClient.cs index ce6ad9364b3..62f36b059e2 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/dictionary/src/Generated/DictionaryClient.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/dictionary/src/Generated/DictionaryClient.cs @@ -4,6 +4,7 @@ using System; using System.ClientModel.Primitives; +using System.Diagnostics.CodeAnalysis; namespace _Type.Dictionary { @@ -13,6 +14,9 @@ public partial class DictionaryClient public DictionaryClient(Uri endpoint, DictionaryClientOptions options) => throw null; + [Experimental("SCME0002")] + public DictionaryClient(DictionaryClientSettings settings) : this(settings?.Endpoint, settings?.Options) => throw null; + public ClientPipeline Pipeline => throw null; public virtual Int32Value GetInt32ValueClient() => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/dictionary/src/Generated/DictionaryClientOptions.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/dictionary/src/Generated/DictionaryClientOptions.cs index 7cb91a10843..0bc7f38ee76 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/dictionary/src/Generated/DictionaryClientOptions.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/dictionary/src/Generated/DictionaryClientOptions.cs @@ -3,10 +3,14 @@ #nullable disable using System.ClientModel.Primitives; +using System.Diagnostics.CodeAnalysis; +using Microsoft.Extensions.Configuration; namespace _Type.Dictionary { public partial class DictionaryClientOptions : ClientPipelineOptions { + [Experimental("SCME0002")] + internal DictionaryClientOptions(IConfigurationSection section) : base(section) => throw null; } } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/dictionary/src/Generated/DictionaryClientSettings.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/dictionary/src/Generated/DictionaryClientSettings.cs new file mode 100644 index 00000000000..2e51cfc2467 --- /dev/null +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/dictionary/src/Generated/DictionaryClientSettings.cs @@ -0,0 +1,29 @@ +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Diagnostics.CodeAnalysis; +using Microsoft.Extensions.Configuration; + +namespace _Type.Dictionary +{ + [Experimental("SCME0002")] + public partial class DictionaryClientSettings : ClientSettings + { + public Uri Endpoint + { + get => throw null; + set => throw null; + } + + public DictionaryClientOptions Options + { + get => throw null; + set => throw null; + } + + protected override void BindCore(IConfigurationSection section) => throw null; + } +} diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/enum/extensible/src/Generated/ExtensibleClient.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/enum/extensible/src/Generated/ExtensibleClient.cs index 2d82a8caeb9..1519ba1020a 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/enum/extensible/src/Generated/ExtensibleClient.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/enum/extensible/src/Generated/ExtensibleClient.cs @@ -4,6 +4,7 @@ using System; using System.ClientModel.Primitives; +using System.Diagnostics.CodeAnalysis; namespace _Type._Enum.Extensible { @@ -13,6 +14,9 @@ public partial class ExtensibleClient public ExtensibleClient(Uri endpoint, ExtensibleClientOptions options) => throw null; + [Experimental("SCME0002")] + public ExtensibleClient(ExtensibleClientSettings settings) : this(settings?.Endpoint, settings?.Options) => throw null; + public ClientPipeline Pipeline => throw null; public virtual String GetStringClient() => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/enum/extensible/src/Generated/ExtensibleClientOptions.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/enum/extensible/src/Generated/ExtensibleClientOptions.cs index 525ccf06c11..b9a7b5af8cf 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/enum/extensible/src/Generated/ExtensibleClientOptions.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/enum/extensible/src/Generated/ExtensibleClientOptions.cs @@ -3,10 +3,14 @@ #nullable disable using System.ClientModel.Primitives; +using System.Diagnostics.CodeAnalysis; +using Microsoft.Extensions.Configuration; namespace _Type._Enum.Extensible { public partial class ExtensibleClientOptions : ClientPipelineOptions { + [Experimental("SCME0002")] + internal ExtensibleClientOptions(IConfigurationSection section) : base(section) => throw null; } } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/enum/extensible/src/Generated/ExtensibleClientSettings.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/enum/extensible/src/Generated/ExtensibleClientSettings.cs new file mode 100644 index 00000000000..feadb885bf8 --- /dev/null +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/enum/extensible/src/Generated/ExtensibleClientSettings.cs @@ -0,0 +1,29 @@ +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Diagnostics.CodeAnalysis; +using Microsoft.Extensions.Configuration; + +namespace _Type._Enum.Extensible +{ + [Experimental("SCME0002")] + public partial class ExtensibleClientSettings : ClientSettings + { + public Uri Endpoint + { + get => throw null; + set => throw null; + } + + public ExtensibleClientOptions Options + { + get => throw null; + set => throw null; + } + + protected override void BindCore(IConfigurationSection section) => throw null; + } +} diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/enum/fixed/src/Generated/FixedClient.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/enum/fixed/src/Generated/FixedClient.cs index 3c72b867393..d035af03d3c 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/enum/fixed/src/Generated/FixedClient.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/enum/fixed/src/Generated/FixedClient.cs @@ -4,6 +4,7 @@ using System; using System.ClientModel.Primitives; +using System.Diagnostics.CodeAnalysis; namespace _Type._Enum.Fixed { @@ -13,6 +14,9 @@ public partial class FixedClient public FixedClient(Uri endpoint, FixedClientOptions options) => throw null; + [Experimental("SCME0002")] + public FixedClient(FixedClientSettings settings) : this(settings?.Endpoint, settings?.Options) => throw null; + public ClientPipeline Pipeline => throw null; public virtual String GetStringClient() => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/enum/fixed/src/Generated/FixedClientOptions.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/enum/fixed/src/Generated/FixedClientOptions.cs index b3e1ebf26c3..457e9d5eade 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/enum/fixed/src/Generated/FixedClientOptions.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/enum/fixed/src/Generated/FixedClientOptions.cs @@ -3,10 +3,14 @@ #nullable disable using System.ClientModel.Primitives; +using System.Diagnostics.CodeAnalysis; +using Microsoft.Extensions.Configuration; namespace _Type._Enum.Fixed { public partial class FixedClientOptions : ClientPipelineOptions { + [Experimental("SCME0002")] + internal FixedClientOptions(IConfigurationSection section) : base(section) => throw null; } } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/enum/fixed/src/Generated/FixedClientSettings.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/enum/fixed/src/Generated/FixedClientSettings.cs new file mode 100644 index 00000000000..4e365e6f6c5 --- /dev/null +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/enum/fixed/src/Generated/FixedClientSettings.cs @@ -0,0 +1,29 @@ +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Diagnostics.CodeAnalysis; +using Microsoft.Extensions.Configuration; + +namespace _Type._Enum.Fixed +{ + [Experimental("SCME0002")] + public partial class FixedClientSettings : ClientSettings + { + public Uri Endpoint + { + get => throw null; + set => throw null; + } + + public FixedClientOptions Options + { + get => throw null; + set => throw null; + } + + protected override void BindCore(IConfigurationSection section) => throw null; + } +} diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/empty/src/Generated/EmptyClient.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/empty/src/Generated/EmptyClient.cs index 70d8023048c..adc65d8c815 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/empty/src/Generated/EmptyClient.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/empty/src/Generated/EmptyClient.cs @@ -5,6 +5,7 @@ using System; using System.ClientModel; using System.ClientModel.Primitives; +using System.Diagnostics.CodeAnalysis; using System.Threading; using System.Threading.Tasks; @@ -16,6 +17,9 @@ public partial class EmptyClient public EmptyClient(Uri endpoint, EmptyClientOptions options) => throw null; + [Experimental("SCME0002")] + public EmptyClient(EmptyClientSettings settings) : this(settings?.Endpoint, settings?.Options) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult PutEmpty(BinaryContent content, RequestOptions options = null) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/empty/src/Generated/EmptyClientOptions.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/empty/src/Generated/EmptyClientOptions.cs index 56e786c637d..d907b861126 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/empty/src/Generated/EmptyClientOptions.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/empty/src/Generated/EmptyClientOptions.cs @@ -3,10 +3,14 @@ #nullable disable using System.ClientModel.Primitives; +using System.Diagnostics.CodeAnalysis; +using Microsoft.Extensions.Configuration; namespace _Type.Model.Empty { public partial class EmptyClientOptions : ClientPipelineOptions { + [Experimental("SCME0002")] + internal EmptyClientOptions(IConfigurationSection section) : base(section) => throw null; } } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/empty/src/Generated/EmptyClientSettings.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/empty/src/Generated/EmptyClientSettings.cs new file mode 100644 index 00000000000..8635789555e --- /dev/null +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/empty/src/Generated/EmptyClientSettings.cs @@ -0,0 +1,29 @@ +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Diagnostics.CodeAnalysis; +using Microsoft.Extensions.Configuration; + +namespace _Type.Model.Empty +{ + [Experimental("SCME0002")] + public partial class EmptyClientSettings : ClientSettings + { + public Uri Endpoint + { + get => throw null; + set => throw null; + } + + public EmptyClientOptions Options + { + get => throw null; + set => throw null; + } + + protected override void BindCore(IConfigurationSection section) => throw null; + } +} diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/inheritance/enum-discriminator/src/Generated/EnumDiscriminatorClient.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/inheritance/enum-discriminator/src/Generated/EnumDiscriminatorClient.cs index 2eec9f2f047..2a42fc59d9d 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/inheritance/enum-discriminator/src/Generated/EnumDiscriminatorClient.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/inheritance/enum-discriminator/src/Generated/EnumDiscriminatorClient.cs @@ -5,6 +5,7 @@ using System; using System.ClientModel; using System.ClientModel.Primitives; +using System.Diagnostics.CodeAnalysis; using System.Threading; using System.Threading.Tasks; @@ -16,6 +17,9 @@ public partial class EnumDiscriminatorClient public EnumDiscriminatorClient(Uri endpoint, EnumDiscriminatorClientOptions options) => throw null; + [Experimental("SCME0002")] + public EnumDiscriminatorClient(EnumDiscriminatorClientSettings settings) : this(settings?.Endpoint, settings?.Options) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult GetExtensibleModel(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/inheritance/enum-discriminator/src/Generated/EnumDiscriminatorClientOptions.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/inheritance/enum-discriminator/src/Generated/EnumDiscriminatorClientOptions.cs index fc64fcba766..68d5a012cec 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/inheritance/enum-discriminator/src/Generated/EnumDiscriminatorClientOptions.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/inheritance/enum-discriminator/src/Generated/EnumDiscriminatorClientOptions.cs @@ -3,10 +3,14 @@ #nullable disable using System.ClientModel.Primitives; +using System.Diagnostics.CodeAnalysis; +using Microsoft.Extensions.Configuration; namespace _Type.Model.Inheritance.EnumDiscriminator { public partial class EnumDiscriminatorClientOptions : ClientPipelineOptions { + [Experimental("SCME0002")] + internal EnumDiscriminatorClientOptions(IConfigurationSection section) : base(section) => throw null; } } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/inheritance/enum-discriminator/src/Generated/EnumDiscriminatorClientSettings.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/inheritance/enum-discriminator/src/Generated/EnumDiscriminatorClientSettings.cs new file mode 100644 index 00000000000..fd5914814bd --- /dev/null +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/inheritance/enum-discriminator/src/Generated/EnumDiscriminatorClientSettings.cs @@ -0,0 +1,29 @@ +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Diagnostics.CodeAnalysis; +using Microsoft.Extensions.Configuration; + +namespace _Type.Model.Inheritance.EnumDiscriminator +{ + [Experimental("SCME0002")] + public partial class EnumDiscriminatorClientSettings : ClientSettings + { + public Uri Endpoint + { + get => throw null; + set => throw null; + } + + public EnumDiscriminatorClientOptions Options + { + get => throw null; + set => throw null; + } + + protected override void BindCore(IConfigurationSection section) => throw null; + } +} diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/inheritance/nested-discriminator/src/Generated/NestedDiscriminatorClient.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/inheritance/nested-discriminator/src/Generated/NestedDiscriminatorClient.cs index 677ad5ba4f3..31927ffdbf0 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/inheritance/nested-discriminator/src/Generated/NestedDiscriminatorClient.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/inheritance/nested-discriminator/src/Generated/NestedDiscriminatorClient.cs @@ -5,6 +5,7 @@ using System; using System.ClientModel; using System.ClientModel.Primitives; +using System.Diagnostics.CodeAnalysis; using System.Threading; using System.Threading.Tasks; @@ -16,6 +17,9 @@ public partial class NestedDiscriminatorClient public NestedDiscriminatorClient(Uri endpoint, NestedDiscriminatorClientOptions options) => throw null; + [Experimental("SCME0002")] + public NestedDiscriminatorClient(NestedDiscriminatorClientSettings settings) : this(settings?.Endpoint, settings?.Options) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult GetModel(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/inheritance/nested-discriminator/src/Generated/NestedDiscriminatorClientOptions.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/inheritance/nested-discriminator/src/Generated/NestedDiscriminatorClientOptions.cs index 000960d84d9..93e0996b13c 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/inheritance/nested-discriminator/src/Generated/NestedDiscriminatorClientOptions.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/inheritance/nested-discriminator/src/Generated/NestedDiscriminatorClientOptions.cs @@ -3,10 +3,14 @@ #nullable disable using System.ClientModel.Primitives; +using System.Diagnostics.CodeAnalysis; +using Microsoft.Extensions.Configuration; namespace _Type.Model.Inheritance.NestedDiscriminator { public partial class NestedDiscriminatorClientOptions : ClientPipelineOptions { + [Experimental("SCME0002")] + internal NestedDiscriminatorClientOptions(IConfigurationSection section) : base(section) => throw null; } } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/inheritance/nested-discriminator/src/Generated/NestedDiscriminatorClientSettings.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/inheritance/nested-discriminator/src/Generated/NestedDiscriminatorClientSettings.cs new file mode 100644 index 00000000000..ebb7fd9e0c8 --- /dev/null +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/inheritance/nested-discriminator/src/Generated/NestedDiscriminatorClientSettings.cs @@ -0,0 +1,29 @@ +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Diagnostics.CodeAnalysis; +using Microsoft.Extensions.Configuration; + +namespace _Type.Model.Inheritance.NestedDiscriminator +{ + [Experimental("SCME0002")] + public partial class NestedDiscriminatorClientSettings : ClientSettings + { + public Uri Endpoint + { + get => throw null; + set => throw null; + } + + public NestedDiscriminatorClientOptions Options + { + get => throw null; + set => throw null; + } + + protected override void BindCore(IConfigurationSection section) => throw null; + } +} diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/inheritance/not-discriminated/src/Generated/NotDiscriminatedClient.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/inheritance/not-discriminated/src/Generated/NotDiscriminatedClient.cs index e573655283f..b9945e189b4 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/inheritance/not-discriminated/src/Generated/NotDiscriminatedClient.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/inheritance/not-discriminated/src/Generated/NotDiscriminatedClient.cs @@ -5,6 +5,7 @@ using System; using System.ClientModel; using System.ClientModel.Primitives; +using System.Diagnostics.CodeAnalysis; using System.Threading; using System.Threading.Tasks; @@ -16,6 +17,9 @@ public partial class NotDiscriminatedClient public NotDiscriminatedClient(Uri endpoint, NotDiscriminatedClientOptions options) => throw null; + [Experimental("SCME0002")] + public NotDiscriminatedClient(NotDiscriminatedClientSettings settings) : this(settings?.Endpoint, settings?.Options) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult PostValid(BinaryContent content, RequestOptions options = null) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/inheritance/not-discriminated/src/Generated/NotDiscriminatedClientOptions.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/inheritance/not-discriminated/src/Generated/NotDiscriminatedClientOptions.cs index c727712c1f8..619298ff0f0 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/inheritance/not-discriminated/src/Generated/NotDiscriminatedClientOptions.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/inheritance/not-discriminated/src/Generated/NotDiscriminatedClientOptions.cs @@ -3,10 +3,14 @@ #nullable disable using System.ClientModel.Primitives; +using System.Diagnostics.CodeAnalysis; +using Microsoft.Extensions.Configuration; namespace _Type.Model.Inheritance.NotDiscriminated { public partial class NotDiscriminatedClientOptions : ClientPipelineOptions { + [Experimental("SCME0002")] + internal NotDiscriminatedClientOptions(IConfigurationSection section) : base(section) => throw null; } } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/inheritance/not-discriminated/src/Generated/NotDiscriminatedClientSettings.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/inheritance/not-discriminated/src/Generated/NotDiscriminatedClientSettings.cs new file mode 100644 index 00000000000..eab881e66bc --- /dev/null +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/inheritance/not-discriminated/src/Generated/NotDiscriminatedClientSettings.cs @@ -0,0 +1,29 @@ +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Diagnostics.CodeAnalysis; +using Microsoft.Extensions.Configuration; + +namespace _Type.Model.Inheritance.NotDiscriminated +{ + [Experimental("SCME0002")] + public partial class NotDiscriminatedClientSettings : ClientSettings + { + public Uri Endpoint + { + get => throw null; + set => throw null; + } + + public NotDiscriminatedClientOptions Options + { + get => throw null; + set => throw null; + } + + protected override void BindCore(IConfigurationSection section) => throw null; + } +} diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/inheritance/recursive/src/Generated/RecursiveClient.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/inheritance/recursive/src/Generated/RecursiveClient.cs index 50140c50d04..afba4893da8 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/inheritance/recursive/src/Generated/RecursiveClient.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/inheritance/recursive/src/Generated/RecursiveClient.cs @@ -5,6 +5,7 @@ using System; using System.ClientModel; using System.ClientModel.Primitives; +using System.Diagnostics.CodeAnalysis; using System.Threading; using System.Threading.Tasks; @@ -16,6 +17,9 @@ public partial class RecursiveClient public RecursiveClient(Uri endpoint, RecursiveClientOptions options) => throw null; + [Experimental("SCME0002")] + public RecursiveClient(RecursiveClientSettings settings) : this(settings?.Endpoint, settings?.Options) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult Put(BinaryContent content, RequestOptions options = null) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/inheritance/recursive/src/Generated/RecursiveClientOptions.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/inheritance/recursive/src/Generated/RecursiveClientOptions.cs index cf994ec31db..d68c5ba6913 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/inheritance/recursive/src/Generated/RecursiveClientOptions.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/inheritance/recursive/src/Generated/RecursiveClientOptions.cs @@ -3,10 +3,14 @@ #nullable disable using System.ClientModel.Primitives; +using System.Diagnostics.CodeAnalysis; +using Microsoft.Extensions.Configuration; namespace _Type.Model.Inheritance.Recursive { public partial class RecursiveClientOptions : ClientPipelineOptions { + [Experimental("SCME0002")] + internal RecursiveClientOptions(IConfigurationSection section) : base(section) => throw null; } } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/inheritance/recursive/src/Generated/RecursiveClientSettings.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/inheritance/recursive/src/Generated/RecursiveClientSettings.cs new file mode 100644 index 00000000000..deaa4e1f167 --- /dev/null +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/inheritance/recursive/src/Generated/RecursiveClientSettings.cs @@ -0,0 +1,29 @@ +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Diagnostics.CodeAnalysis; +using Microsoft.Extensions.Configuration; + +namespace _Type.Model.Inheritance.Recursive +{ + [Experimental("SCME0002")] + public partial class RecursiveClientSettings : ClientSettings + { + public Uri Endpoint + { + get => throw null; + set => throw null; + } + + public RecursiveClientOptions Options + { + get => throw null; + set => throw null; + } + + protected override void BindCore(IConfigurationSection section) => throw null; + } +} diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/inheritance/single-discriminator/src/Generated/SingleDiscriminatorClient.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/inheritance/single-discriminator/src/Generated/SingleDiscriminatorClient.cs index 261b93c7665..a9884144620 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/inheritance/single-discriminator/src/Generated/SingleDiscriminatorClient.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/inheritance/single-discriminator/src/Generated/SingleDiscriminatorClient.cs @@ -5,6 +5,7 @@ using System; using System.ClientModel; using System.ClientModel.Primitives; +using System.Diagnostics.CodeAnalysis; using System.Threading; using System.Threading.Tasks; @@ -16,6 +17,9 @@ public partial class SingleDiscriminatorClient public SingleDiscriminatorClient(Uri endpoint, SingleDiscriminatorClientOptions options) => throw null; + [Experimental("SCME0002")] + public SingleDiscriminatorClient(SingleDiscriminatorClientSettings settings) : this(settings?.Endpoint, settings?.Options) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult GetModel(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/inheritance/single-discriminator/src/Generated/SingleDiscriminatorClientOptions.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/inheritance/single-discriminator/src/Generated/SingleDiscriminatorClientOptions.cs index ab3b42d7150..0b6e4e01cb8 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/inheritance/single-discriminator/src/Generated/SingleDiscriminatorClientOptions.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/inheritance/single-discriminator/src/Generated/SingleDiscriminatorClientOptions.cs @@ -3,10 +3,14 @@ #nullable disable using System.ClientModel.Primitives; +using System.Diagnostics.CodeAnalysis; +using Microsoft.Extensions.Configuration; namespace _Type.Model.Inheritance.SingleDiscriminator { public partial class SingleDiscriminatorClientOptions : ClientPipelineOptions { + [Experimental("SCME0002")] + internal SingleDiscriminatorClientOptions(IConfigurationSection section) : base(section) => throw null; } } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/inheritance/single-discriminator/src/Generated/SingleDiscriminatorClientSettings.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/inheritance/single-discriminator/src/Generated/SingleDiscriminatorClientSettings.cs new file mode 100644 index 00000000000..ab187bd8d92 --- /dev/null +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/inheritance/single-discriminator/src/Generated/SingleDiscriminatorClientSettings.cs @@ -0,0 +1,29 @@ +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Diagnostics.CodeAnalysis; +using Microsoft.Extensions.Configuration; + +namespace _Type.Model.Inheritance.SingleDiscriminator +{ + [Experimental("SCME0002")] + public partial class SingleDiscriminatorClientSettings : ClientSettings + { + public Uri Endpoint + { + get => throw null; + set => throw null; + } + + public SingleDiscriminatorClientOptions Options + { + get => throw null; + set => throw null; + } + + protected override void BindCore(IConfigurationSection section) => throw null; + } +} diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/usage/src/Generated/UsageClient.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/usage/src/Generated/UsageClient.cs index cd3f6b4c23d..26eccdcc4f3 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/usage/src/Generated/UsageClient.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/usage/src/Generated/UsageClient.cs @@ -5,6 +5,7 @@ using System; using System.ClientModel; using System.ClientModel.Primitives; +using System.Diagnostics.CodeAnalysis; using System.Threading; using System.Threading.Tasks; @@ -16,6 +17,9 @@ public partial class UsageClient public UsageClient(Uri endpoint, UsageClientOptions options) => throw null; + [Experimental("SCME0002")] + public UsageClient(UsageClientSettings settings) : this(settings?.Endpoint, settings?.Options) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult Input(BinaryContent content, RequestOptions options = null) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/usage/src/Generated/UsageClientOptions.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/usage/src/Generated/UsageClientOptions.cs index 307a5173a35..b7df89f0a4a 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/usage/src/Generated/UsageClientOptions.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/usage/src/Generated/UsageClientOptions.cs @@ -3,10 +3,14 @@ #nullable disable using System.ClientModel.Primitives; +using System.Diagnostics.CodeAnalysis; +using Microsoft.Extensions.Configuration; namespace _Type.Model.Usage { public partial class UsageClientOptions : ClientPipelineOptions { + [Experimental("SCME0002")] + internal UsageClientOptions(IConfigurationSection section) : base(section) => throw null; } } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/usage/src/Generated/UsageClientSettings.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/usage/src/Generated/UsageClientSettings.cs new file mode 100644 index 00000000000..1d813163af2 --- /dev/null +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/usage/src/Generated/UsageClientSettings.cs @@ -0,0 +1,29 @@ +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Diagnostics.CodeAnalysis; +using Microsoft.Extensions.Configuration; + +namespace _Type.Model.Usage +{ + [Experimental("SCME0002")] + public partial class UsageClientSettings : ClientSettings + { + public Uri Endpoint + { + get => throw null; + set => throw null; + } + + public UsageClientOptions Options + { + get => throw null; + set => throw null; + } + + protected override void BindCore(IConfigurationSection section) => throw null; + } +} diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/visibility/src/Generated/VisibilityClient.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/visibility/src/Generated/VisibilityClient.cs index 901d82e4098..4bda7d3fdcd 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/visibility/src/Generated/VisibilityClient.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/visibility/src/Generated/VisibilityClient.cs @@ -5,6 +5,7 @@ using System; using System.ClientModel; using System.ClientModel.Primitives; +using System.Diagnostics.CodeAnalysis; using System.Threading; using System.Threading.Tasks; @@ -16,6 +17,9 @@ public partial class VisibilityClient public VisibilityClient(Uri endpoint, VisibilityClientOptions options) => throw null; + [Experimental("SCME0002")] + public VisibilityClient(VisibilityClientSettings settings) : this(settings?.Endpoint, settings?.Options) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult GetModel(int queryProp, BinaryContent content, RequestOptions options = null) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/visibility/src/Generated/VisibilityClientOptions.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/visibility/src/Generated/VisibilityClientOptions.cs index a32153c9626..a77f4b26aea 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/visibility/src/Generated/VisibilityClientOptions.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/visibility/src/Generated/VisibilityClientOptions.cs @@ -3,10 +3,14 @@ #nullable disable using System.ClientModel.Primitives; +using System.Diagnostics.CodeAnalysis; +using Microsoft.Extensions.Configuration; namespace _Type.Model.Visibility { public partial class VisibilityClientOptions : ClientPipelineOptions { + [Experimental("SCME0002")] + internal VisibilityClientOptions(IConfigurationSection section) : base(section) => throw null; } } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/visibility/src/Generated/VisibilityClientSettings.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/visibility/src/Generated/VisibilityClientSettings.cs new file mode 100644 index 00000000000..75f60f4f199 --- /dev/null +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/visibility/src/Generated/VisibilityClientSettings.cs @@ -0,0 +1,29 @@ +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Diagnostics.CodeAnalysis; +using Microsoft.Extensions.Configuration; + +namespace _Type.Model.Visibility +{ + [Experimental("SCME0002")] + public partial class VisibilityClientSettings : ClientSettings + { + public Uri Endpoint + { + get => throw null; + set => throw null; + } + + public VisibilityClientOptions Options + { + get => throw null; + set => throw null; + } + + protected override void BindCore(IConfigurationSection section) => throw null; + } +} diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/AdditionalPropertiesClient.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/AdditionalPropertiesClient.cs index 86b144da674..d10d4de3960 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/AdditionalPropertiesClient.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/AdditionalPropertiesClient.cs @@ -4,6 +4,7 @@ using System; using System.ClientModel.Primitives; +using System.Diagnostics.CodeAnalysis; namespace _Type.Property.AdditionalProperties { @@ -13,6 +14,9 @@ public partial class AdditionalPropertiesClient public AdditionalPropertiesClient(Uri endpoint, AdditionalPropertiesClientOptions options) => throw null; + [Experimental("SCME0002")] + public AdditionalPropertiesClient(AdditionalPropertiesClientSettings settings) : this(settings?.Endpoint, settings?.Options) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ExtendsUnknown GetExtendsUnknownClient() => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/AdditionalPropertiesClientOptions.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/AdditionalPropertiesClientOptions.cs index 131277df71b..b0c26ef9d7d 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/AdditionalPropertiesClientOptions.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/AdditionalPropertiesClientOptions.cs @@ -3,10 +3,14 @@ #nullable disable using System.ClientModel.Primitives; +using System.Diagnostics.CodeAnalysis; +using Microsoft.Extensions.Configuration; namespace _Type.Property.AdditionalProperties { public partial class AdditionalPropertiesClientOptions : ClientPipelineOptions { + [Experimental("SCME0002")] + internal AdditionalPropertiesClientOptions(IConfigurationSection section) : base(section) => throw null; } } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/AdditionalPropertiesClientSettings.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/AdditionalPropertiesClientSettings.cs new file mode 100644 index 00000000000..2ecc0cb99b0 --- /dev/null +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/AdditionalPropertiesClientSettings.cs @@ -0,0 +1,29 @@ +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Diagnostics.CodeAnalysis; +using Microsoft.Extensions.Configuration; + +namespace _Type.Property.AdditionalProperties +{ + [Experimental("SCME0002")] + public partial class AdditionalPropertiesClientSettings : ClientSettings + { + public Uri Endpoint + { + get => throw null; + set => throw null; + } + + public AdditionalPropertiesClientOptions Options + { + get => throw null; + set => throw null; + } + + protected override void BindCore(IConfigurationSection section) => throw null; + } +} diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/nullable/src/Generated/NullableClient.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/nullable/src/Generated/NullableClient.cs index 96329118412..345bda037b6 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/nullable/src/Generated/NullableClient.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/nullable/src/Generated/NullableClient.cs @@ -4,6 +4,7 @@ using System; using System.ClientModel.Primitives; +using System.Diagnostics.CodeAnalysis; namespace _Type.Property.Nullable { @@ -13,6 +14,9 @@ public partial class NullableClient public NullableClient(Uri endpoint, NullableClientOptions options) => throw null; + [Experimental("SCME0002")] + public NullableClient(NullableClientSettings settings) : this(settings?.Endpoint, settings?.Options) => throw null; + public ClientPipeline Pipeline => throw null; public virtual String GetStringClient() => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/nullable/src/Generated/NullableClientOptions.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/nullable/src/Generated/NullableClientOptions.cs index d4939dbbb1f..fac74cb122c 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/nullable/src/Generated/NullableClientOptions.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/nullable/src/Generated/NullableClientOptions.cs @@ -3,10 +3,14 @@ #nullable disable using System.ClientModel.Primitives; +using System.Diagnostics.CodeAnalysis; +using Microsoft.Extensions.Configuration; namespace _Type.Property.Nullable { public partial class NullableClientOptions : ClientPipelineOptions { + [Experimental("SCME0002")] + internal NullableClientOptions(IConfigurationSection section) : base(section) => throw null; } } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/nullable/src/Generated/NullableClientSettings.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/nullable/src/Generated/NullableClientSettings.cs new file mode 100644 index 00000000000..738504eba24 --- /dev/null +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/nullable/src/Generated/NullableClientSettings.cs @@ -0,0 +1,29 @@ +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Diagnostics.CodeAnalysis; +using Microsoft.Extensions.Configuration; + +namespace _Type.Property.Nullable +{ + [Experimental("SCME0002")] + public partial class NullableClientSettings : ClientSettings + { + public Uri Endpoint + { + get => throw null; + set => throw null; + } + + public NullableClientOptions Options + { + get => throw null; + set => throw null; + } + + protected override void BindCore(IConfigurationSection section) => throw null; + } +} diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/optionality/src/Generated/OptionalClient.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/optionality/src/Generated/OptionalClient.cs index 6f67bdc1b3a..63b9eb4e2c4 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/optionality/src/Generated/OptionalClient.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/optionality/src/Generated/OptionalClient.cs @@ -4,6 +4,7 @@ using System; using System.ClientModel.Primitives; +using System.Diagnostics.CodeAnalysis; namespace _Type.Property.Optional { @@ -13,6 +14,9 @@ public partial class OptionalClient public OptionalClient(Uri endpoint, OptionalClientOptions options) => throw null; + [Experimental("SCME0002")] + public OptionalClient(OptionalClientSettings settings) : this(settings?.Endpoint, settings?.Options) => throw null; + public ClientPipeline Pipeline => throw null; public virtual String GetStringClient() => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/optionality/src/Generated/OptionalClientOptions.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/optionality/src/Generated/OptionalClientOptions.cs index a9ffaadfe8f..30be22458c0 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/optionality/src/Generated/OptionalClientOptions.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/optionality/src/Generated/OptionalClientOptions.cs @@ -3,10 +3,14 @@ #nullable disable using System.ClientModel.Primitives; +using System.Diagnostics.CodeAnalysis; +using Microsoft.Extensions.Configuration; namespace _Type.Property.Optional { public partial class OptionalClientOptions : ClientPipelineOptions { + [Experimental("SCME0002")] + internal OptionalClientOptions(IConfigurationSection section) : base(section) => throw null; } } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/optionality/src/Generated/OptionalClientSettings.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/optionality/src/Generated/OptionalClientSettings.cs new file mode 100644 index 00000000000..b6de9fdd7d6 --- /dev/null +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/optionality/src/Generated/OptionalClientSettings.cs @@ -0,0 +1,29 @@ +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Diagnostics.CodeAnalysis; +using Microsoft.Extensions.Configuration; + +namespace _Type.Property.Optional +{ + [Experimental("SCME0002")] + public partial class OptionalClientSettings : ClientSettings + { + public Uri Endpoint + { + get => throw null; + set => throw null; + } + + public OptionalClientOptions Options + { + get => throw null; + set => throw null; + } + + protected override void BindCore(IConfigurationSection section) => throw null; + } +} diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/ValueTypesClient.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/ValueTypesClient.cs index 2d928c3bb26..b2a31ce63d0 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/ValueTypesClient.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/ValueTypesClient.cs @@ -4,6 +4,7 @@ using System; using System.ClientModel.Primitives; +using System.Diagnostics.CodeAnalysis; namespace _Type.Property.ValueTypes { @@ -13,6 +14,9 @@ public partial class ValueTypesClient public ValueTypesClient(Uri endpoint, ValueTypesClientOptions options) => throw null; + [Experimental("SCME0002")] + public ValueTypesClient(ValueTypesClientSettings settings) : this(settings?.Endpoint, settings?.Options) => throw null; + public ClientPipeline Pipeline => throw null; public virtual Boolean GetBooleanClient() => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/ValueTypesClientOptions.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/ValueTypesClientOptions.cs index ecfa4e24e2a..4dc4307a63b 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/ValueTypesClientOptions.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/ValueTypesClientOptions.cs @@ -3,10 +3,14 @@ #nullable disable using System.ClientModel.Primitives; +using System.Diagnostics.CodeAnalysis; +using Microsoft.Extensions.Configuration; namespace _Type.Property.ValueTypes { public partial class ValueTypesClientOptions : ClientPipelineOptions { + [Experimental("SCME0002")] + internal ValueTypesClientOptions(IConfigurationSection section) : base(section) => throw null; } } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/ValueTypesClientSettings.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/ValueTypesClientSettings.cs new file mode 100644 index 00000000000..804ef7bdb0c --- /dev/null +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/ValueTypesClientSettings.cs @@ -0,0 +1,29 @@ +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Diagnostics.CodeAnalysis; +using Microsoft.Extensions.Configuration; + +namespace _Type.Property.ValueTypes +{ + [Experimental("SCME0002")] + public partial class ValueTypesClientSettings : ClientSettings + { + public Uri Endpoint + { + get => throw null; + set => throw null; + } + + public ValueTypesClientOptions Options + { + get => throw null; + set => throw null; + } + + protected override void BindCore(IConfigurationSection section) => throw null; + } +} diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/scalar/src/Generated/ScalarClient.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/scalar/src/Generated/ScalarClient.cs index 7a2ab78771c..b8d8365878c 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/scalar/src/Generated/ScalarClient.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/scalar/src/Generated/ScalarClient.cs @@ -4,6 +4,7 @@ using System; using System.ClientModel.Primitives; +using System.Diagnostics.CodeAnalysis; namespace _Type.Scalar { @@ -13,6 +14,9 @@ public partial class ScalarClient public ScalarClient(Uri endpoint, ScalarClientOptions options) => throw null; + [Experimental("SCME0002")] + public ScalarClient(ScalarClientSettings settings) : this(settings?.Endpoint, settings?.Options) => throw null; + public ClientPipeline Pipeline => throw null; public virtual String GetStringClient() => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/scalar/src/Generated/ScalarClientOptions.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/scalar/src/Generated/ScalarClientOptions.cs index 315778f0dfa..0cd9b666e34 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/scalar/src/Generated/ScalarClientOptions.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/scalar/src/Generated/ScalarClientOptions.cs @@ -3,10 +3,14 @@ #nullable disable using System.ClientModel.Primitives; +using System.Diagnostics.CodeAnalysis; +using Microsoft.Extensions.Configuration; namespace _Type.Scalar { public partial class ScalarClientOptions : ClientPipelineOptions { + [Experimental("SCME0002")] + internal ScalarClientOptions(IConfigurationSection section) : base(section) => throw null; } } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/scalar/src/Generated/ScalarClientSettings.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/scalar/src/Generated/ScalarClientSettings.cs new file mode 100644 index 00000000000..c16448023ec --- /dev/null +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/scalar/src/Generated/ScalarClientSettings.cs @@ -0,0 +1,29 @@ +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Diagnostics.CodeAnalysis; +using Microsoft.Extensions.Configuration; + +namespace _Type.Scalar +{ + [Experimental("SCME0002")] + public partial class ScalarClientSettings : ClientSettings + { + public Uri Endpoint + { + get => throw null; + set => throw null; + } + + public ScalarClientOptions Options + { + get => throw null; + set => throw null; + } + + protected override void BindCore(IConfigurationSection section) => throw null; + } +} diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/union/src/Generated/UnionClient.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/union/src/Generated/UnionClient.cs index d8169c7677e..84e89fe37f7 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/union/src/Generated/UnionClient.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/union/src/Generated/UnionClient.cs @@ -4,6 +4,7 @@ using System; using System.ClientModel.Primitives; +using System.Diagnostics.CodeAnalysis; namespace _Type.Union { @@ -13,6 +14,9 @@ public partial class UnionClient public UnionClient(Uri endpoint, UnionClientOptions options) => throw null; + [Experimental("SCME0002")] + public UnionClient(UnionClientSettings settings) : this(settings?.Endpoint, settings?.Options) => throw null; + public ClientPipeline Pipeline => throw null; public virtual StringsOnly GetStringsOnlyClient() => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/union/src/Generated/UnionClientOptions.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/union/src/Generated/UnionClientOptions.cs index e5f6e387e74..b434d0884c2 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/union/src/Generated/UnionClientOptions.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/union/src/Generated/UnionClientOptions.cs @@ -3,10 +3,14 @@ #nullable disable using System.ClientModel.Primitives; +using System.Diagnostics.CodeAnalysis; +using Microsoft.Extensions.Configuration; namespace _Type.Union { public partial class UnionClientOptions : ClientPipelineOptions { + [Experimental("SCME0002")] + internal UnionClientOptions(IConfigurationSection section) : base(section) => throw null; } } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/union/src/Generated/UnionClientSettings.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/union/src/Generated/UnionClientSettings.cs new file mode 100644 index 00000000000..71defed8463 --- /dev/null +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/union/src/Generated/UnionClientSettings.cs @@ -0,0 +1,29 @@ +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Diagnostics.CodeAnalysis; +using Microsoft.Extensions.Configuration; + +namespace _Type.Union +{ + [Experimental("SCME0002")] + public partial class UnionClientSettings : ClientSettings + { + public Uri Endpoint + { + get => throw null; + set => throw null; + } + + public UnionClientOptions Options + { + get => throw null; + set => throw null; + } + + protected override void BindCore(IConfigurationSection section) => throw null; + } +} diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/added/v1/src/Generated/AddedClient.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/added/v1/src/Generated/AddedClient.cs index 4f240a760b1..e59dbe60aa6 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/added/v1/src/Generated/AddedClient.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/added/v1/src/Generated/AddedClient.cs @@ -5,6 +5,7 @@ using System; using System.ClientModel; using System.ClientModel.Primitives; +using System.Diagnostics.CodeAnalysis; using System.Threading; using System.Threading.Tasks; @@ -18,6 +19,9 @@ public partial class AddedClient public AddedClient(Uri endpoint, AddedClientOptions options) => throw null; + [Experimental("SCME0002")] + public AddedClient(AddedClientSettings settings) : this(settings?.Endpoint, settings?.Options) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult V1(BinaryContent content, RequestOptions options = null) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/added/v1/src/Generated/AddedClientOptions.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/added/v1/src/Generated/AddedClientOptions.cs index 773ddd6c34e..b7fbe47ed89 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/added/v1/src/Generated/AddedClientOptions.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/added/v1/src/Generated/AddedClientOptions.cs @@ -3,6 +3,8 @@ #nullable disable using System.ClientModel.Primitives; +using System.Diagnostics.CodeAnalysis; +using Microsoft.Extensions.Configuration; namespace Versioning.Added { @@ -12,6 +14,9 @@ public partial class AddedClientOptions : ClientPipelineOptions public AddedClientOptions(ServiceVersion version = LatestVersion) => throw null; + [Experimental("SCME0002")] + internal AddedClientOptions(IConfigurationSection section) : base(section) => throw null; + public enum ServiceVersion { /// The version v1. diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/added/v1/src/Generated/AddedClientSettings.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/added/v1/src/Generated/AddedClientSettings.cs new file mode 100644 index 00000000000..de45b556cb9 --- /dev/null +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/added/v1/src/Generated/AddedClientSettings.cs @@ -0,0 +1,29 @@ +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Diagnostics.CodeAnalysis; +using Microsoft.Extensions.Configuration; + +namespace Versioning.Added +{ + [Experimental("SCME0002")] + public partial class AddedClientSettings : ClientSettings + { + public Uri Endpoint + { + get => throw null; + set => throw null; + } + + public AddedClientOptions Options + { + get => throw null; + set => throw null; + } + + protected override void BindCore(IConfigurationSection section) => throw null; + } +} diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/added/v2/src/Generated/AddedClient.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/added/v2/src/Generated/AddedClient.cs index 15c9f8e666d..6df5b4baa38 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/added/v2/src/Generated/AddedClient.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/added/v2/src/Generated/AddedClient.cs @@ -5,6 +5,7 @@ using System; using System.ClientModel; using System.ClientModel.Primitives; +using System.Diagnostics.CodeAnalysis; using System.Threading; using System.Threading.Tasks; @@ -18,6 +19,9 @@ public partial class AddedClient public AddedClient(Uri endpoint, AddedClientOptions options) => throw null; + [Experimental("SCME0002")] + public AddedClient(AddedClientSettings settings) : this(settings?.Endpoint, settings?.Options) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult V1(string headerV2, BinaryContent content, RequestOptions options = null) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/added/v2/src/Generated/AddedClientOptions.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/added/v2/src/Generated/AddedClientOptions.cs index e2f29f0a557..9719d90a137 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/added/v2/src/Generated/AddedClientOptions.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/added/v2/src/Generated/AddedClientOptions.cs @@ -3,6 +3,8 @@ #nullable disable using System.ClientModel.Primitives; +using System.Diagnostics.CodeAnalysis; +using Microsoft.Extensions.Configuration; namespace Versioning.Added { @@ -12,6 +14,9 @@ public partial class AddedClientOptions : ClientPipelineOptions public AddedClientOptions(ServiceVersion version = LatestVersion) => throw null; + [Experimental("SCME0002")] + internal AddedClientOptions(IConfigurationSection section) : base(section) => throw null; + public enum ServiceVersion { /// The version v1. diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/added/v2/src/Generated/AddedClientSettings.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/added/v2/src/Generated/AddedClientSettings.cs new file mode 100644 index 00000000000..de45b556cb9 --- /dev/null +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/added/v2/src/Generated/AddedClientSettings.cs @@ -0,0 +1,29 @@ +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Diagnostics.CodeAnalysis; +using Microsoft.Extensions.Configuration; + +namespace Versioning.Added +{ + [Experimental("SCME0002")] + public partial class AddedClientSettings : ClientSettings + { + public Uri Endpoint + { + get => throw null; + set => throw null; + } + + public AddedClientOptions Options + { + get => throw null; + set => throw null; + } + + protected override void BindCore(IConfigurationSection section) => throw null; + } +} diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/madeOptional/v1/src/Generated/MadeOptionalClient.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/madeOptional/v1/src/Generated/MadeOptionalClient.cs index 8594bc90f75..0ede1d2c6c6 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/madeOptional/v1/src/Generated/MadeOptionalClient.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/madeOptional/v1/src/Generated/MadeOptionalClient.cs @@ -5,6 +5,7 @@ using System; using System.ClientModel; using System.ClientModel.Primitives; +using System.Diagnostics.CodeAnalysis; using System.Threading; using System.Threading.Tasks; @@ -18,6 +19,9 @@ public partial class MadeOptionalClient public MadeOptionalClient(Uri endpoint, MadeOptionalClientOptions options) => throw null; + [Experimental("SCME0002")] + public MadeOptionalClient(MadeOptionalClientSettings settings) : this(settings?.Endpoint, settings?.Options) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult Test(string @param, BinaryContent content, RequestOptions options = null) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/madeOptional/v1/src/Generated/MadeOptionalClientOptions.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/madeOptional/v1/src/Generated/MadeOptionalClientOptions.cs index 3eefb1ff588..d26fc936f07 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/madeOptional/v1/src/Generated/MadeOptionalClientOptions.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/madeOptional/v1/src/Generated/MadeOptionalClientOptions.cs @@ -3,6 +3,8 @@ #nullable disable using System.ClientModel.Primitives; +using System.Diagnostics.CodeAnalysis; +using Microsoft.Extensions.Configuration; namespace Versioning.MadeOptional { @@ -12,6 +14,9 @@ public partial class MadeOptionalClientOptions : ClientPipelineOptions public MadeOptionalClientOptions(ServiceVersion version = LatestVersion) => throw null; + [Experimental("SCME0002")] + internal MadeOptionalClientOptions(IConfigurationSection section) : base(section) => throw null; + public enum ServiceVersion { /// The version v1. diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/madeOptional/v1/src/Generated/MadeOptionalClientSettings.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/madeOptional/v1/src/Generated/MadeOptionalClientSettings.cs new file mode 100644 index 00000000000..4773765707d --- /dev/null +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/madeOptional/v1/src/Generated/MadeOptionalClientSettings.cs @@ -0,0 +1,29 @@ +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Diagnostics.CodeAnalysis; +using Microsoft.Extensions.Configuration; + +namespace Versioning.MadeOptional +{ + [Experimental("SCME0002")] + public partial class MadeOptionalClientSettings : ClientSettings + { + public Uri Endpoint + { + get => throw null; + set => throw null; + } + + public MadeOptionalClientOptions Options + { + get => throw null; + set => throw null; + } + + protected override void BindCore(IConfigurationSection section) => throw null; + } +} diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/madeOptional/v2/src/Generated/MadeOptionalClient.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/madeOptional/v2/src/Generated/MadeOptionalClient.cs index a78a2f47210..d777d66aaf0 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/madeOptional/v2/src/Generated/MadeOptionalClient.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/madeOptional/v2/src/Generated/MadeOptionalClient.cs @@ -5,6 +5,7 @@ using System; using System.ClientModel; using System.ClientModel.Primitives; +using System.Diagnostics.CodeAnalysis; using System.Threading; using System.Threading.Tasks; @@ -18,6 +19,9 @@ public partial class MadeOptionalClient public MadeOptionalClient(Uri endpoint, MadeOptionalClientOptions options) => throw null; + [Experimental("SCME0002")] + public MadeOptionalClient(MadeOptionalClientSettings settings) : this(settings?.Endpoint, settings?.Options) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult Test(BinaryContent content, string @param = default, RequestOptions options = null) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/madeOptional/v2/src/Generated/MadeOptionalClientOptions.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/madeOptional/v2/src/Generated/MadeOptionalClientOptions.cs index f328701bf0d..61493a2cdce 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/madeOptional/v2/src/Generated/MadeOptionalClientOptions.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/madeOptional/v2/src/Generated/MadeOptionalClientOptions.cs @@ -3,6 +3,8 @@ #nullable disable using System.ClientModel.Primitives; +using System.Diagnostics.CodeAnalysis; +using Microsoft.Extensions.Configuration; namespace Versioning.MadeOptional { @@ -12,6 +14,9 @@ public partial class MadeOptionalClientOptions : ClientPipelineOptions public MadeOptionalClientOptions(ServiceVersion version = LatestVersion) => throw null; + [Experimental("SCME0002")] + internal MadeOptionalClientOptions(IConfigurationSection section) : base(section) => throw null; + public enum ServiceVersion { /// The version v1. diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/madeOptional/v2/src/Generated/MadeOptionalClientSettings.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/madeOptional/v2/src/Generated/MadeOptionalClientSettings.cs new file mode 100644 index 00000000000..4773765707d --- /dev/null +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/madeOptional/v2/src/Generated/MadeOptionalClientSettings.cs @@ -0,0 +1,29 @@ +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Diagnostics.CodeAnalysis; +using Microsoft.Extensions.Configuration; + +namespace Versioning.MadeOptional +{ + [Experimental("SCME0002")] + public partial class MadeOptionalClientSettings : ClientSettings + { + public Uri Endpoint + { + get => throw null; + set => throw null; + } + + public MadeOptionalClientOptions Options + { + get => throw null; + set => throw null; + } + + protected override void BindCore(IConfigurationSection section) => throw null; + } +} diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/removed/v1/src/Generated/RemovedClient.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/removed/v1/src/Generated/RemovedClient.cs index 9d7b39f1c89..0494eec7ee4 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/removed/v1/src/Generated/RemovedClient.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/removed/v1/src/Generated/RemovedClient.cs @@ -5,6 +5,7 @@ using System; using System.ClientModel; using System.ClientModel.Primitives; +using System.Diagnostics.CodeAnalysis; using System.Threading; using System.Threading.Tasks; @@ -18,6 +19,9 @@ public partial class RemovedClient public RemovedClient(Uri endpoint, RemovedClientOptions options) => throw null; + [Experimental("SCME0002")] + public RemovedClient(RemovedClientSettings settings) : this(settings?.Endpoint, settings?.Options) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult V1(BinaryContent content, RequestOptions options = null) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/removed/v1/src/Generated/RemovedClientOptions.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/removed/v1/src/Generated/RemovedClientOptions.cs index 6389ac97d10..e72954e373d 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/removed/v1/src/Generated/RemovedClientOptions.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/removed/v1/src/Generated/RemovedClientOptions.cs @@ -3,6 +3,8 @@ #nullable disable using System.ClientModel.Primitives; +using System.Diagnostics.CodeAnalysis; +using Microsoft.Extensions.Configuration; namespace Versioning.Removed { @@ -12,6 +14,9 @@ public partial class RemovedClientOptions : ClientPipelineOptions public RemovedClientOptions(ServiceVersion version = LatestVersion) => throw null; + [Experimental("SCME0002")] + internal RemovedClientOptions(IConfigurationSection section) : base(section) => throw null; + public enum ServiceVersion { /// The version v1. diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/removed/v1/src/Generated/RemovedClientSettings.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/removed/v1/src/Generated/RemovedClientSettings.cs new file mode 100644 index 00000000000..ff06e89e8df --- /dev/null +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/removed/v1/src/Generated/RemovedClientSettings.cs @@ -0,0 +1,29 @@ +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Diagnostics.CodeAnalysis; +using Microsoft.Extensions.Configuration; + +namespace Versioning.Removed +{ + [Experimental("SCME0002")] + public partial class RemovedClientSettings : ClientSettings + { + public Uri Endpoint + { + get => throw null; + set => throw null; + } + + public RemovedClientOptions Options + { + get => throw null; + set => throw null; + } + + protected override void BindCore(IConfigurationSection section) => throw null; + } +} diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/removed/v2/src/Generated/RemovedClient.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/removed/v2/src/Generated/RemovedClient.cs index febf2295a42..9c21a4389af 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/removed/v2/src/Generated/RemovedClient.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/removed/v2/src/Generated/RemovedClient.cs @@ -5,6 +5,7 @@ using System; using System.ClientModel; using System.ClientModel.Primitives; +using System.Diagnostics.CodeAnalysis; using System.Threading; using System.Threading.Tasks; @@ -18,6 +19,9 @@ public partial class RemovedClient public RemovedClient(Uri endpoint, RemovedClientOptions options) => throw null; + [Experimental("SCME0002")] + public RemovedClient(RemovedClientSettings settings) : this(settings?.Endpoint, settings?.Options) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult V2(BinaryContent content, RequestOptions options = null) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/removed/v2/src/Generated/RemovedClientOptions.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/removed/v2/src/Generated/RemovedClientOptions.cs index 4925a16b6eb..f2256cfd36c 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/removed/v2/src/Generated/RemovedClientOptions.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/removed/v2/src/Generated/RemovedClientOptions.cs @@ -3,6 +3,8 @@ #nullable disable using System.ClientModel.Primitives; +using System.Diagnostics.CodeAnalysis; +using Microsoft.Extensions.Configuration; namespace Versioning.Removed { @@ -12,6 +14,9 @@ public partial class RemovedClientOptions : ClientPipelineOptions public RemovedClientOptions(ServiceVersion version = LatestVersion) => throw null; + [Experimental("SCME0002")] + internal RemovedClientOptions(IConfigurationSection section) : base(section) => throw null; + public enum ServiceVersion { /// The version v1. diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/removed/v2/src/Generated/RemovedClientSettings.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/removed/v2/src/Generated/RemovedClientSettings.cs new file mode 100644 index 00000000000..ff06e89e8df --- /dev/null +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/removed/v2/src/Generated/RemovedClientSettings.cs @@ -0,0 +1,29 @@ +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Diagnostics.CodeAnalysis; +using Microsoft.Extensions.Configuration; + +namespace Versioning.Removed +{ + [Experimental("SCME0002")] + public partial class RemovedClientSettings : ClientSettings + { + public Uri Endpoint + { + get => throw null; + set => throw null; + } + + public RemovedClientOptions Options + { + get => throw null; + set => throw null; + } + + protected override void BindCore(IConfigurationSection section) => throw null; + } +} diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/removed/v2Preview/src/Generated/RemovedClient.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/removed/v2Preview/src/Generated/RemovedClient.cs index 9d7b39f1c89..0494eec7ee4 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/removed/v2Preview/src/Generated/RemovedClient.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/removed/v2Preview/src/Generated/RemovedClient.cs @@ -5,6 +5,7 @@ using System; using System.ClientModel; using System.ClientModel.Primitives; +using System.Diagnostics.CodeAnalysis; using System.Threading; using System.Threading.Tasks; @@ -18,6 +19,9 @@ public partial class RemovedClient public RemovedClient(Uri endpoint, RemovedClientOptions options) => throw null; + [Experimental("SCME0002")] + public RemovedClient(RemovedClientSettings settings) : this(settings?.Endpoint, settings?.Options) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult V1(BinaryContent content, RequestOptions options = null) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/removed/v2Preview/src/Generated/RemovedClientOptions.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/removed/v2Preview/src/Generated/RemovedClientOptions.cs index 43faac8d671..f7d8d97afa9 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/removed/v2Preview/src/Generated/RemovedClientOptions.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/removed/v2Preview/src/Generated/RemovedClientOptions.cs @@ -3,6 +3,8 @@ #nullable disable using System.ClientModel.Primitives; +using System.Diagnostics.CodeAnalysis; +using Microsoft.Extensions.Configuration; namespace Versioning.Removed { @@ -12,6 +14,9 @@ public partial class RemovedClientOptions : ClientPipelineOptions public RemovedClientOptions(ServiceVersion version = LatestVersion) => throw null; + [Experimental("SCME0002")] + internal RemovedClientOptions(IConfigurationSection section) : base(section) => throw null; + public enum ServiceVersion { /// The version v1. diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/removed/v2Preview/src/Generated/RemovedClientSettings.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/removed/v2Preview/src/Generated/RemovedClientSettings.cs new file mode 100644 index 00000000000..ff06e89e8df --- /dev/null +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/removed/v2Preview/src/Generated/RemovedClientSettings.cs @@ -0,0 +1,29 @@ +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Diagnostics.CodeAnalysis; +using Microsoft.Extensions.Configuration; + +namespace Versioning.Removed +{ + [Experimental("SCME0002")] + public partial class RemovedClientSettings : ClientSettings + { + public Uri Endpoint + { + get => throw null; + set => throw null; + } + + public RemovedClientOptions Options + { + get => throw null; + set => throw null; + } + + protected override void BindCore(IConfigurationSection section) => throw null; + } +} diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/renamedFrom/v1/src/Generated/RenamedFromClient.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/renamedFrom/v1/src/Generated/RenamedFromClient.cs index d65af3f3675..77a991092ec 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/renamedFrom/v1/src/Generated/RenamedFromClient.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/renamedFrom/v1/src/Generated/RenamedFromClient.cs @@ -5,6 +5,7 @@ using System; using System.ClientModel; using System.ClientModel.Primitives; +using System.Diagnostics.CodeAnalysis; using System.Threading; using System.Threading.Tasks; @@ -18,6 +19,9 @@ public partial class RenamedFromClient public RenamedFromClient(Uri endpoint, RenamedFromClientOptions options) => throw null; + [Experimental("SCME0002")] + public RenamedFromClient(RenamedFromClientSettings settings) : this(settings?.Endpoint, settings?.Options) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult OldOp(string oldQuery, BinaryContent content, RequestOptions options = null) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/renamedFrom/v1/src/Generated/RenamedFromClientOptions.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/renamedFrom/v1/src/Generated/RenamedFromClientOptions.cs index 079e9e380f8..3119ae73302 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/renamedFrom/v1/src/Generated/RenamedFromClientOptions.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/renamedFrom/v1/src/Generated/RenamedFromClientOptions.cs @@ -3,6 +3,8 @@ #nullable disable using System.ClientModel.Primitives; +using System.Diagnostics.CodeAnalysis; +using Microsoft.Extensions.Configuration; namespace Versioning.RenamedFrom { @@ -12,6 +14,9 @@ public partial class RenamedFromClientOptions : ClientPipelineOptions public RenamedFromClientOptions(ServiceVersion version = LatestVersion) => throw null; + [Experimental("SCME0002")] + internal RenamedFromClientOptions(IConfigurationSection section) : base(section) => throw null; + public enum ServiceVersion { /// The version v1. diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/renamedFrom/v1/src/Generated/RenamedFromClientSettings.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/renamedFrom/v1/src/Generated/RenamedFromClientSettings.cs new file mode 100644 index 00000000000..da511564820 --- /dev/null +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/renamedFrom/v1/src/Generated/RenamedFromClientSettings.cs @@ -0,0 +1,29 @@ +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Diagnostics.CodeAnalysis; +using Microsoft.Extensions.Configuration; + +namespace Versioning.RenamedFrom +{ + [Experimental("SCME0002")] + public partial class RenamedFromClientSettings : ClientSettings + { + public Uri Endpoint + { + get => throw null; + set => throw null; + } + + public RenamedFromClientOptions Options + { + get => throw null; + set => throw null; + } + + protected override void BindCore(IConfigurationSection section) => throw null; + } +} diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/renamedFrom/v2/src/Generated/RenamedFromClient.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/renamedFrom/v2/src/Generated/RenamedFromClient.cs index 6c6eb4de56b..02cd0a8b330 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/renamedFrom/v2/src/Generated/RenamedFromClient.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/renamedFrom/v2/src/Generated/RenamedFromClient.cs @@ -5,6 +5,7 @@ using System; using System.ClientModel; using System.ClientModel.Primitives; +using System.Diagnostics.CodeAnalysis; using System.Threading; using System.Threading.Tasks; @@ -18,6 +19,9 @@ public partial class RenamedFromClient public RenamedFromClient(Uri endpoint, RenamedFromClientOptions options) => throw null; + [Experimental("SCME0002")] + public RenamedFromClient(RenamedFromClientSettings settings) : this(settings?.Endpoint, settings?.Options) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult NewOp(string newQuery, BinaryContent content, RequestOptions options = null) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/renamedFrom/v2/src/Generated/RenamedFromClientOptions.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/renamedFrom/v2/src/Generated/RenamedFromClientOptions.cs index 7d99ad1eb2f..6079b82ab55 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/renamedFrom/v2/src/Generated/RenamedFromClientOptions.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/renamedFrom/v2/src/Generated/RenamedFromClientOptions.cs @@ -3,6 +3,8 @@ #nullable disable using System.ClientModel.Primitives; +using System.Diagnostics.CodeAnalysis; +using Microsoft.Extensions.Configuration; namespace Versioning.RenamedFrom { @@ -12,6 +14,9 @@ public partial class RenamedFromClientOptions : ClientPipelineOptions public RenamedFromClientOptions(ServiceVersion version = LatestVersion) => throw null; + [Experimental("SCME0002")] + internal RenamedFromClientOptions(IConfigurationSection section) : base(section) => throw null; + public enum ServiceVersion { /// The version v1. diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/renamedFrom/v2/src/Generated/RenamedFromClientSettings.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/renamedFrom/v2/src/Generated/RenamedFromClientSettings.cs new file mode 100644 index 00000000000..da511564820 --- /dev/null +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/renamedFrom/v2/src/Generated/RenamedFromClientSettings.cs @@ -0,0 +1,29 @@ +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Diagnostics.CodeAnalysis; +using Microsoft.Extensions.Configuration; + +namespace Versioning.RenamedFrom +{ + [Experimental("SCME0002")] + public partial class RenamedFromClientSettings : ClientSettings + { + public Uri Endpoint + { + get => throw null; + set => throw null; + } + + public RenamedFromClientOptions Options + { + get => throw null; + set => throw null; + } + + protected override void BindCore(IConfigurationSection section) => throw null; + } +} diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/returnTypeChangedFrom/v1/src/Generated/ReturnTypeChangedFromClient.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/returnTypeChangedFrom/v1/src/Generated/ReturnTypeChangedFromClient.cs index aa02fb0c6aa..8841b668a8f 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/returnTypeChangedFrom/v1/src/Generated/ReturnTypeChangedFromClient.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/returnTypeChangedFrom/v1/src/Generated/ReturnTypeChangedFromClient.cs @@ -5,6 +5,7 @@ using System; using System.ClientModel; using System.ClientModel.Primitives; +using System.Diagnostics.CodeAnalysis; using System.Threading; using System.Threading.Tasks; @@ -18,6 +19,9 @@ public partial class ReturnTypeChangedFromClient public ReturnTypeChangedFromClient(Uri endpoint, ReturnTypeChangedFromClientOptions options) => throw null; + [Experimental("SCME0002")] + public ReturnTypeChangedFromClient(ReturnTypeChangedFromClientSettings settings) : this(settings?.Endpoint, settings?.Options) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult Test(BinaryContent content, RequestOptions options = null) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/returnTypeChangedFrom/v1/src/Generated/ReturnTypeChangedFromClientOptions.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/returnTypeChangedFrom/v1/src/Generated/ReturnTypeChangedFromClientOptions.cs index e8bee0a6323..fd2f1ec452c 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/returnTypeChangedFrom/v1/src/Generated/ReturnTypeChangedFromClientOptions.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/returnTypeChangedFrom/v1/src/Generated/ReturnTypeChangedFromClientOptions.cs @@ -3,6 +3,8 @@ #nullable disable using System.ClientModel.Primitives; +using System.Diagnostics.CodeAnalysis; +using Microsoft.Extensions.Configuration; namespace Versioning.ReturnTypeChangedFrom { @@ -12,6 +14,9 @@ public partial class ReturnTypeChangedFromClientOptions : ClientPipelineOptions public ReturnTypeChangedFromClientOptions(ServiceVersion version = LatestVersion) => throw null; + [Experimental("SCME0002")] + internal ReturnTypeChangedFromClientOptions(IConfigurationSection section) : base(section) => throw null; + public enum ServiceVersion { /// The version v1. diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/returnTypeChangedFrom/v1/src/Generated/ReturnTypeChangedFromClientSettings.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/returnTypeChangedFrom/v1/src/Generated/ReturnTypeChangedFromClientSettings.cs new file mode 100644 index 00000000000..d8b043ada18 --- /dev/null +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/returnTypeChangedFrom/v1/src/Generated/ReturnTypeChangedFromClientSettings.cs @@ -0,0 +1,29 @@ +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Diagnostics.CodeAnalysis; +using Microsoft.Extensions.Configuration; + +namespace Versioning.ReturnTypeChangedFrom +{ + [Experimental("SCME0002")] + public partial class ReturnTypeChangedFromClientSettings : ClientSettings + { + public Uri Endpoint + { + get => throw null; + set => throw null; + } + + public ReturnTypeChangedFromClientOptions Options + { + get => throw null; + set => throw null; + } + + protected override void BindCore(IConfigurationSection section) => throw null; + } +} diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/returnTypeChangedFrom/v2/src/Generated/ReturnTypeChangedFromClient.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/returnTypeChangedFrom/v2/src/Generated/ReturnTypeChangedFromClient.cs index 59f110a0c55..4cb7e5f51eb 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/returnTypeChangedFrom/v2/src/Generated/ReturnTypeChangedFromClient.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/returnTypeChangedFrom/v2/src/Generated/ReturnTypeChangedFromClient.cs @@ -5,6 +5,7 @@ using System; using System.ClientModel; using System.ClientModel.Primitives; +using System.Diagnostics.CodeAnalysis; using System.Threading; using System.Threading.Tasks; @@ -18,6 +19,9 @@ public partial class ReturnTypeChangedFromClient public ReturnTypeChangedFromClient(Uri endpoint, ReturnTypeChangedFromClientOptions options) => throw null; + [Experimental("SCME0002")] + public ReturnTypeChangedFromClient(ReturnTypeChangedFromClientSettings settings) : this(settings?.Endpoint, settings?.Options) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult Test(BinaryContent content, RequestOptions options = null) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/returnTypeChangedFrom/v2/src/Generated/ReturnTypeChangedFromClientOptions.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/returnTypeChangedFrom/v2/src/Generated/ReturnTypeChangedFromClientOptions.cs index b6d5d3ef543..6c62310339f 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/returnTypeChangedFrom/v2/src/Generated/ReturnTypeChangedFromClientOptions.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/returnTypeChangedFrom/v2/src/Generated/ReturnTypeChangedFromClientOptions.cs @@ -3,6 +3,8 @@ #nullable disable using System.ClientModel.Primitives; +using System.Diagnostics.CodeAnalysis; +using Microsoft.Extensions.Configuration; namespace Versioning.ReturnTypeChangedFrom { @@ -12,6 +14,9 @@ public partial class ReturnTypeChangedFromClientOptions : ClientPipelineOptions public ReturnTypeChangedFromClientOptions(ServiceVersion version = LatestVersion) => throw null; + [Experimental("SCME0002")] + internal ReturnTypeChangedFromClientOptions(IConfigurationSection section) : base(section) => throw null; + public enum ServiceVersion { /// The version v1. diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/returnTypeChangedFrom/v2/src/Generated/ReturnTypeChangedFromClientSettings.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/returnTypeChangedFrom/v2/src/Generated/ReturnTypeChangedFromClientSettings.cs new file mode 100644 index 00000000000..d8b043ada18 --- /dev/null +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/returnTypeChangedFrom/v2/src/Generated/ReturnTypeChangedFromClientSettings.cs @@ -0,0 +1,29 @@ +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Diagnostics.CodeAnalysis; +using Microsoft.Extensions.Configuration; + +namespace Versioning.ReturnTypeChangedFrom +{ + [Experimental("SCME0002")] + public partial class ReturnTypeChangedFromClientSettings : ClientSettings + { + public Uri Endpoint + { + get => throw null; + set => throw null; + } + + public ReturnTypeChangedFromClientOptions Options + { + get => throw null; + set => throw null; + } + + protected override void BindCore(IConfigurationSection section) => throw null; + } +} diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/typeChangedFrom/v1/src/Generated/TypeChangedFromClient.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/typeChangedFrom/v1/src/Generated/TypeChangedFromClient.cs index cd3284b715d..2d4aaf1394b 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/typeChangedFrom/v1/src/Generated/TypeChangedFromClient.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/typeChangedFrom/v1/src/Generated/TypeChangedFromClient.cs @@ -5,6 +5,7 @@ using System; using System.ClientModel; using System.ClientModel.Primitives; +using System.Diagnostics.CodeAnalysis; using System.Threading; using System.Threading.Tasks; @@ -18,6 +19,9 @@ public partial class TypeChangedFromClient public TypeChangedFromClient(Uri endpoint, TypeChangedFromClientOptions options) => throw null; + [Experimental("SCME0002")] + public TypeChangedFromClient(TypeChangedFromClientSettings settings) : this(settings?.Endpoint, settings?.Options) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult Test(int @param, BinaryContent content, RequestOptions options = null) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/typeChangedFrom/v1/src/Generated/TypeChangedFromClientOptions.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/typeChangedFrom/v1/src/Generated/TypeChangedFromClientOptions.cs index e335851e9c0..2fd14057077 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/typeChangedFrom/v1/src/Generated/TypeChangedFromClientOptions.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/typeChangedFrom/v1/src/Generated/TypeChangedFromClientOptions.cs @@ -3,6 +3,8 @@ #nullable disable using System.ClientModel.Primitives; +using System.Diagnostics.CodeAnalysis; +using Microsoft.Extensions.Configuration; namespace Versioning.TypeChangedFrom { @@ -12,6 +14,9 @@ public partial class TypeChangedFromClientOptions : ClientPipelineOptions public TypeChangedFromClientOptions(ServiceVersion version = LatestVersion) => throw null; + [Experimental("SCME0002")] + internal TypeChangedFromClientOptions(IConfigurationSection section) : base(section) => throw null; + public enum ServiceVersion { /// The version v1. diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/typeChangedFrom/v1/src/Generated/TypeChangedFromClientSettings.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/typeChangedFrom/v1/src/Generated/TypeChangedFromClientSettings.cs new file mode 100644 index 00000000000..51180632a28 --- /dev/null +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/typeChangedFrom/v1/src/Generated/TypeChangedFromClientSettings.cs @@ -0,0 +1,29 @@ +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Diagnostics.CodeAnalysis; +using Microsoft.Extensions.Configuration; + +namespace Versioning.TypeChangedFrom +{ + [Experimental("SCME0002")] + public partial class TypeChangedFromClientSettings : ClientSettings + { + public Uri Endpoint + { + get => throw null; + set => throw null; + } + + public TypeChangedFromClientOptions Options + { + get => throw null; + set => throw null; + } + + protected override void BindCore(IConfigurationSection section) => throw null; + } +} diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/typeChangedFrom/v2/src/Generated/TypeChangedFromClient.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/typeChangedFrom/v2/src/Generated/TypeChangedFromClient.cs index 4ac83f56d47..69ce861f652 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/typeChangedFrom/v2/src/Generated/TypeChangedFromClient.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/typeChangedFrom/v2/src/Generated/TypeChangedFromClient.cs @@ -5,6 +5,7 @@ using System; using System.ClientModel; using System.ClientModel.Primitives; +using System.Diagnostics.CodeAnalysis; using System.Threading; using System.Threading.Tasks; @@ -18,6 +19,9 @@ public partial class TypeChangedFromClient public TypeChangedFromClient(Uri endpoint, TypeChangedFromClientOptions options) => throw null; + [Experimental("SCME0002")] + public TypeChangedFromClient(TypeChangedFromClientSettings settings) : this(settings?.Endpoint, settings?.Options) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult Test(string @param, BinaryContent content, RequestOptions options = null) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/typeChangedFrom/v2/src/Generated/TypeChangedFromClientOptions.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/typeChangedFrom/v2/src/Generated/TypeChangedFromClientOptions.cs index bd3fa375597..7ecdd66c06b 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/typeChangedFrom/v2/src/Generated/TypeChangedFromClientOptions.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/typeChangedFrom/v2/src/Generated/TypeChangedFromClientOptions.cs @@ -3,6 +3,8 @@ #nullable disable using System.ClientModel.Primitives; +using System.Diagnostics.CodeAnalysis; +using Microsoft.Extensions.Configuration; namespace Versioning.TypeChangedFrom { @@ -12,6 +14,9 @@ public partial class TypeChangedFromClientOptions : ClientPipelineOptions public TypeChangedFromClientOptions(ServiceVersion version = LatestVersion) => throw null; + [Experimental("SCME0002")] + internal TypeChangedFromClientOptions(IConfigurationSection section) : base(section) => throw null; + public enum ServiceVersion { /// The version v1. diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/typeChangedFrom/v2/src/Generated/TypeChangedFromClientSettings.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/typeChangedFrom/v2/src/Generated/TypeChangedFromClientSettings.cs new file mode 100644 index 00000000000..51180632a28 --- /dev/null +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/typeChangedFrom/v2/src/Generated/TypeChangedFromClientSettings.cs @@ -0,0 +1,29 @@ +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Diagnostics.CodeAnalysis; +using Microsoft.Extensions.Configuration; + +namespace Versioning.TypeChangedFrom +{ + [Experimental("SCME0002")] + public partial class TypeChangedFromClientSettings : ClientSettings + { + public Uri Endpoint + { + get => throw null; + set => throw null; + } + + public TypeChangedFromClientOptions Options + { + get => throw null; + set => throw null; + } + + protected override void BindCore(IConfigurationSection section) => throw null; + } +} From 04121e3cfaba40c82d2f178376623dec7666e356 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 5 Mar 2026 04:34:59 +0000 Subject: [PATCH 06/38] fix(http-client-csharp): handle non-auth required params in settings, fix API key credential extraction, add default ctor, add package dep Co-authored-by: JoshLove-msft <54595583+JoshLove-msft@users.noreply.github.com> --- .../src/Providers/ClientProvider.cs | 16 +++++++- .../src/Providers/ClientSettingsProvider.cs | 39 +++++++++++++++++++ .../api-key/src/Generated/ApiKeyClient.cs | 2 +- .../src/Generated/ApiKeyClientOptions.cs | 2 + .../http/custom/src/Generated/CustomClient.cs | 2 +- .../src/Generated/CustomClientOptions.cs | 2 + .../src/Generated/OAuth2ClientOptions.cs | 2 + .../union/src/Generated/UnionClientOptions.cs | 2 + .../src/Generated/FirstClient.cs | 2 +- .../src/Generated/FirstClientOptions.cs | 2 + .../src/Generated/FirstClientSettings.cs | 7 ++++ .../src/Generated/SubNamespaceSecondClient.cs | 2 +- .../SubNamespaceSecondClientOptions.cs | 2 + .../SubNamespaceSecondClientSettings.cs | 7 ++++ .../default/src/Generated/ServiceClient.cs | 2 +- .../src/Generated/ServiceClientOptions.cs | 2 + .../src/Generated/ServiceClientSettings.cs | 6 +++ .../src/Generated/ClientAClient.cs | 2 +- .../src/Generated/ClientAClientOptions.cs | 2 + .../src/Generated/ClientAClientSettings.cs | 7 ++++ .../src/Generated/ClientBClient.cs | 2 +- .../src/Generated/ClientBClientOptions.cs | 2 + .../src/Generated/ClientBClientSettings.cs | 7 ++++ .../src/Generated/RenamedOperationClient.cs | 2 +- .../RenamedOperationClientOptions.cs | 2 + .../RenamedOperationClientSettings.cs | 7 ++++ .../src/Generated/TwoOperationGroupClient.cs | 2 +- .../TwoOperationGroupClientOptions.cs | 2 + .../TwoOperationGroupClientSettings.cs | 7 ++++ .../Generated/DocumentationClientOptions.cs | 2 + .../array/src/Generated/ArrayClientOptions.cs | 2 + .../bytes/src/Generated/BytesClientOptions.cs | 2 + .../src/Generated/DatetimeClientOptions.cs | 2 + .../src/Generated/DurationClientOptions.cs | 2 + .../src/Generated/NumericClientOptions.cs | 2 + .../basic/src/Generated/BasicClientOptions.cs | 2 + .../Generated/BodyOptionalityClientOptions.cs | 2 + .../CollectionFormatClientOptions.cs | 2 + .../path/src/Generated/PathClientOptions.cs | 2 + .../query/src/Generated/QueryClientOptions.cs | 2 + .../src/Generated/SpreadClientOptions.cs | 2 + .../ContentNegotiationClientOptions.cs | 2 + .../Generated/JsonMergePatchClientOptions.cs | 2 + .../src/Generated/MediaTypeClientOptions.cs | 2 + .../src/Generated/MultiPartClientOptions.cs | 2 + .../src/Generated/PageableClientOptions.cs | 2 + .../xml/src/Generated/XmlClientOptions.cs | 2 + .../ResiliencyServiceDrivenClient.cs | 2 +- .../ResiliencyServiceDrivenClientSettings.cs | 6 +++ .../ResiliencyServiceDrivenClient.cs | 2 +- .../ResiliencyServiceDrivenClientSettings.cs | 6 +++ .../Generated/StatusCodeRangeClientOptions.cs | 2 + .../src/Generated/RoutesClientOptions.cs | 2 + .../json/src/Generated/JsonClientOptions.cs | 2 + .../src/Generated/NotDefinedClientOptions.cs | 2 + .../src/Generated/SingleClientOptions.cs | 2 + .../Generated/NotVersionedClientOptions.cs | 2 + .../ConditionalRequestClientOptions.cs | 2 + .../Generated/RepeatabilityClientOptions.cs | 2 + .../Generated/SpecialWordsClientOptions.cs | 2 + .../array/src/Generated/ArrayClientOptions.cs | 2 + .../src/Generated/DictionaryClientOptions.cs | 2 + .../src/Generated/ExtensibleClientOptions.cs | 2 + .../fixed/src/Generated/FixedClientOptions.cs | 2 + .../empty/src/Generated/EmptyClientOptions.cs | 2 + .../EnumDiscriminatorClientOptions.cs | 2 + .../NestedDiscriminatorClientOptions.cs | 2 + .../NotDiscriminatedClientOptions.cs | 2 + .../src/Generated/RecursiveClientOptions.cs | 2 + .../SingleDiscriminatorClientOptions.cs | 2 + .../usage/src/Generated/UsageClientOptions.cs | 2 + .../src/Generated/VisibilityClientOptions.cs | 2 + .../AdditionalPropertiesClientOptions.cs | 2 + .../src/Generated/NullableClientOptions.cs | 2 + .../src/Generated/OptionalClientOptions.cs | 2 + .../src/Generated/ValueTypesClientOptions.cs | 2 + .../src/Generated/ScalarClientOptions.cs | 2 + .../union/src/Generated/UnionClientOptions.cs | 2 + 78 files changed, 236 insertions(+), 13 deletions(-) diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Providers/ClientProvider.cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Providers/ClientProvider.cs index f6d93e4e8f5..234882ccf76 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Providers/ClientProvider.cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Providers/ClientProvider.cs @@ -633,6 +633,18 @@ private IEnumerable BuildSettingsConstructors() // endpoint argument - we know EndpointPropertyName is not null at this point args.Add(new MemberExpression(new NullConditionalExpression(settingsParam), ClientSettings.EndpointPropertyName)); + // other required parameters (non-auth, non-endpoint) in primary constructor order + foreach (var param in ClientSettings.OtherRequiredParams) + { + var propName = param.Name.ToIdentifierName(); + var propAccess = new MemberExpression(new NullConditionalExpression(settingsParam), propName); + // Value types (enums, primitives) need ?? default since null-conditional returns T? + ValueExpression arg = param.Type.IsValueType + ? new BinaryOperatorExpression("??", propAccess, new KeywordExpression("default", null)) + : propAccess; + args.Add(arg); + } + // credential argument if (_oauth2Fields != null) { @@ -641,12 +653,12 @@ private IEnumerable BuildSettingsConstructors() } else if (_apiKeyAuthFields != null) { - // settings?.Credential?.Key is string key ? new ApiKeyCredential(key) : null + // settings?.Credential?.Key != null ? new ApiKeyCredential(settings?.Credential?.Key) : null var credentialExpr = new MemberExpression(new NullConditionalExpression(settingsParam), "Credential"); var keyExpr = new MemberExpression(new NullConditionalExpression(credentialExpr), "Key"); var keyNotNull = new BinaryOperatorExpression("!=", keyExpr, Null); var newApiKeyCredExpr = New.Instance(_apiKeyAuthFields.AuthField.Type, - new MemberExpression(new MemberExpression(settingsParam, "Credential"), "Key")); + new MemberExpression(new NullConditionalExpression(new MemberExpression(new NullConditionalExpression(settingsParam), "Credential")), "Key")); args.Add(new TernaryConditionalExpression(keyNotNull, newApiKeyCredExpr, Null)); } diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Providers/ClientSettingsProvider.cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Providers/ClientSettingsProvider.cs index 5920fe4de8a..8af94ae65e0 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Providers/ClientSettingsProvider.cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Providers/ClientSettingsProvider.cs @@ -24,6 +24,7 @@ public class ClientSettingsProvider : TypeProvider private readonly ClientProvider _clientProvider; private readonly InputEndpointParameter? _inputEndpointParam; + private readonly IReadOnlyList _otherRequiredParams; #pragma warning disable SCME0002 // ClientSettings is for evaluation purposes only internal static readonly CSharpType ClientSettingsType = typeof(ClientSettings); @@ -36,10 +37,22 @@ internal ClientSettingsProvider(InputClient inputClient, ClientProvider clientPr _clientProvider = clientProvider; _inputEndpointParam = inputClient.Parameters .FirstOrDefault(p => p is InputEndpointParameter ep && ep.IsEndpoint) as InputEndpointParameter; + + // Collect non-endpoint, non-apiVersion required parameters (auth params come separately via InputClient.Auth) + _otherRequiredParams = inputClient.Parameters + .Where(p => p.IsRequired && !p.IsApiVersion && + !(p is InputEndpointParameter ep && ep.IsEndpoint)) + .Select(p => ScmCodeModelGenerator.Instance.TypeFactory.CreateParameter(p)) + .Where(p => p != null) + .Select(p => p!) + .ToList(); } internal string? EndpointPropertyName => _inputEndpointParam?.Name.ToIdentifierName(); + /// Gets non-endpoint, non-auth required parameters that have settings properties. + internal IReadOnlyList OtherRequiredParams => _otherRequiredParams; + protected override string BuildRelativeFilePath() => Path.Combine("src", "Generated", $"{Name}.cs"); protected override string BuildName() => $"{_clientProvider.Name}Settings"; @@ -68,6 +81,17 @@ protected override PropertyProvider[] BuildProperties() this)); } + foreach (var param in _otherRequiredParams) + { + properties.Add(new PropertyProvider( + null, + MethodSignatureModifiers.Public, + param.Type.WithNullable(true), + param.Name.ToIdentifierName(), + new AutoPropertyBody(true), + this)); + } + if (_clientProvider.ClientOptions != null) { properties.Add(new PropertyProvider( @@ -101,6 +125,21 @@ protected override MethodProvider[] BuildMethods() body.Add(ifStatement); } + foreach (var param in _otherRequiredParams) + { + var propName = param.Name.ToIdentifierName(); + // For string types: if (section[propName] is string val) PropName = val; + if (param.Type.IsFrameworkType && param.Type.FrameworkType == typeof(string)) + { + var valVar = new VariableExpression(new CSharpType(typeof(string), isNullable: true), param.Name.ToVariableName()); + body.Add(Declare(valVar, new IndexerExpression(sectionParam, Literal(propName)))); + var ifStatement = new IfStatement(Not(Static(typeof(string)).Invoke("IsNullOrEmpty", valVar))); + ifStatement.Add(This.Property(propName).Assign(valVar).Terminate()); + body.Add(ifStatement); + } + // Other types are skipped in BindCore (users can customize via partial class) + } + if (_clientProvider.ClientOptions != null) { // IConfigurationSection optionsSection = section.GetSection("Options"); diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/authentication/api-key/src/Generated/ApiKeyClient.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/authentication/api-key/src/Generated/ApiKeyClient.cs index 22df2fbfdb6..84aaa989763 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/authentication/api-key/src/Generated/ApiKeyClient.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/authentication/api-key/src/Generated/ApiKeyClient.cs @@ -22,7 +22,7 @@ public partial class ApiKeyClient public ApiKeyClient(Uri endpoint, ApiKeyCredential credential, ApiKeyClientOptions options) => throw null; [Experimental("SCME0002")] - public ApiKeyClient(ApiKeyClientSettings settings) : this(settings?.Endpoint, settings?.CredentialProvider as ApiKeyCredential, settings?.Options) => throw null; + public ApiKeyClient(ApiKeyClientSettings settings) : this(settings?.Endpoint, settings?.Credential?.Key != null ? new ApiKeyCredential(settings?.Credential?.Key) : null, settings?.Options) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/authentication/api-key/src/Generated/ApiKeyClientOptions.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/authentication/api-key/src/Generated/ApiKeyClientOptions.cs index 2549430598f..7f1d0ec3a4c 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/authentication/api-key/src/Generated/ApiKeyClientOptions.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/authentication/api-key/src/Generated/ApiKeyClientOptions.cs @@ -10,6 +10,8 @@ namespace Authentication.ApiKey { public partial class ApiKeyClientOptions : ClientPipelineOptions { + public ApiKeyClientOptions() => throw null; + [Experimental("SCME0002")] internal ApiKeyClientOptions(IConfigurationSection section) : base(section) => throw null; } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/authentication/http/custom/src/Generated/CustomClient.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/authentication/http/custom/src/Generated/CustomClient.cs index ac905b1751d..63a41cdd265 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/authentication/http/custom/src/Generated/CustomClient.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/authentication/http/custom/src/Generated/CustomClient.cs @@ -22,7 +22,7 @@ public partial class CustomClient public CustomClient(Uri endpoint, ApiKeyCredential credential, CustomClientOptions options) => throw null; [Experimental("SCME0002")] - public CustomClient(CustomClientSettings settings) : this(settings?.Endpoint, settings?.CredentialProvider as ApiKeyCredential, settings?.Options) => throw null; + public CustomClient(CustomClientSettings settings) : this(settings?.Endpoint, settings?.Credential?.Key != null ? new ApiKeyCredential(settings?.Credential?.Key) : null, settings?.Options) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/authentication/http/custom/src/Generated/CustomClientOptions.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/authentication/http/custom/src/Generated/CustomClientOptions.cs index a1809b4d3c8..ae206c5cecf 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/authentication/http/custom/src/Generated/CustomClientOptions.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/authentication/http/custom/src/Generated/CustomClientOptions.cs @@ -10,6 +10,8 @@ namespace Authentication.Http.Custom { public partial class CustomClientOptions : ClientPipelineOptions { + public CustomClientOptions() => throw null; + [Experimental("SCME0002")] internal CustomClientOptions(IConfigurationSection section) : base(section) => throw null; } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/authentication/oauth2/src/Generated/OAuth2ClientOptions.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/authentication/oauth2/src/Generated/OAuth2ClientOptions.cs index c1bbe69ea65..8fc4380d187 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/authentication/oauth2/src/Generated/OAuth2ClientOptions.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/authentication/oauth2/src/Generated/OAuth2ClientOptions.cs @@ -10,6 +10,8 @@ namespace Authentication.OAuth2 { public partial class OAuth2ClientOptions : ClientPipelineOptions { + public OAuth2ClientOptions() => throw null; + [Experimental("SCME0002")] internal OAuth2ClientOptions(IConfigurationSection section) : base(section) => throw null; } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/authentication/union/src/Generated/UnionClientOptions.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/authentication/union/src/Generated/UnionClientOptions.cs index 0d5b7cbb1b5..c75e08f6cee 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/authentication/union/src/Generated/UnionClientOptions.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/authentication/union/src/Generated/UnionClientOptions.cs @@ -10,6 +10,8 @@ namespace Authentication.Union { public partial class UnionClientOptions : ClientPipelineOptions { + public UnionClientOptions() => throw null; + [Experimental("SCME0002")] internal UnionClientOptions(IConfigurationSection section) : base(section) => throw null; } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/client-operation-group/src/Generated/FirstClient.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/client-operation-group/src/Generated/FirstClient.cs index 1d2343ead3b..2d72fa8f02f 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/client-operation-group/src/Generated/FirstClient.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/client-operation-group/src/Generated/FirstClient.cs @@ -21,7 +21,7 @@ public partial class FirstClient public FirstClient(Uri endpoint, ClientType client, FirstClientOptions options) => throw null; [Experimental("SCME0002")] - public FirstClient(FirstClientSettings settings) : this(settings?.Endpoint, settings?.Options) => throw null; + public FirstClient(FirstClientSettings settings) : this(settings?.Endpoint, settings?.Client ?? default, settings?.Options) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/client-operation-group/src/Generated/FirstClientOptions.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/client-operation-group/src/Generated/FirstClientOptions.cs index 1b40294b60a..6a8bb3b3dab 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/client-operation-group/src/Generated/FirstClientOptions.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/client-operation-group/src/Generated/FirstClientOptions.cs @@ -10,6 +10,8 @@ namespace Client.Structure.ClientOperationGroup { public partial class FirstClientOptions : ClientPipelineOptions { + public FirstClientOptions() => throw null; + [Experimental("SCME0002")] internal FirstClientOptions(IConfigurationSection section) : base(section) => throw null; } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/client-operation-group/src/Generated/FirstClientSettings.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/client-operation-group/src/Generated/FirstClientSettings.cs index 0f1ddca0797..47fe311045d 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/client-operation-group/src/Generated/FirstClientSettings.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/client-operation-group/src/Generated/FirstClientSettings.cs @@ -5,6 +5,7 @@ using System; using System.ClientModel.Primitives; using System.Diagnostics.CodeAnalysis; +using Client.Structure.Service; using Microsoft.Extensions.Configuration; namespace Client.Structure.ClientOperationGroup @@ -18,6 +19,12 @@ public Uri Endpoint set => throw null; } + public ClientType? Client + { + get => throw null; + set => throw null; + } + public FirstClientOptions Options { get => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/client-operation-group/src/Generated/SubNamespaceSecondClient.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/client-operation-group/src/Generated/SubNamespaceSecondClient.cs index 6dff3cfb8d2..999e911015f 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/client-operation-group/src/Generated/SubNamespaceSecondClient.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/client-operation-group/src/Generated/SubNamespaceSecondClient.cs @@ -21,7 +21,7 @@ public partial class SubNamespaceSecondClient public SubNamespaceSecondClient(Uri endpoint, ClientType client, SubNamespaceSecondClientOptions options) => throw null; [Experimental("SCME0002")] - public SubNamespaceSecondClient(SubNamespaceSecondClientSettings settings) : this(settings?.Endpoint, settings?.Options) => throw null; + public SubNamespaceSecondClient(SubNamespaceSecondClientSettings settings) : this(settings?.Endpoint, settings?.Client ?? default, settings?.Options) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/client-operation-group/src/Generated/SubNamespaceSecondClientOptions.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/client-operation-group/src/Generated/SubNamespaceSecondClientOptions.cs index 48fb05e53cf..9bdb3865466 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/client-operation-group/src/Generated/SubNamespaceSecondClientOptions.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/client-operation-group/src/Generated/SubNamespaceSecondClientOptions.cs @@ -10,6 +10,8 @@ namespace Client.Structure.AnotherClientOperationGroup { public partial class SubNamespaceSecondClientOptions : ClientPipelineOptions { + public SubNamespaceSecondClientOptions() => throw null; + [Experimental("SCME0002")] internal SubNamespaceSecondClientOptions(IConfigurationSection section) : base(section) => throw null; } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/client-operation-group/src/Generated/SubNamespaceSecondClientSettings.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/client-operation-group/src/Generated/SubNamespaceSecondClientSettings.cs index c70137cb6ab..1f632d30799 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/client-operation-group/src/Generated/SubNamespaceSecondClientSettings.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/client-operation-group/src/Generated/SubNamespaceSecondClientSettings.cs @@ -5,6 +5,7 @@ using System; using System.ClientModel.Primitives; using System.Diagnostics.CodeAnalysis; +using Client.Structure.Service; using Microsoft.Extensions.Configuration; namespace Client.Structure.AnotherClientOperationGroup @@ -18,6 +19,12 @@ public Uri Endpoint set => throw null; } + public ClientType? Client + { + get => throw null; + set => throw null; + } + public SubNamespaceSecondClientOptions Options { get => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/default/src/Generated/ServiceClient.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/default/src/Generated/ServiceClient.cs index 3fa3afbd9fc..36534cbc6b0 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/default/src/Generated/ServiceClient.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/default/src/Generated/ServiceClient.cs @@ -22,7 +22,7 @@ public partial class ServiceClient public ServiceClient(Uri endpoint, ClientType client, ServiceClientOptions options) => throw null; [Experimental("SCME0002")] - public ServiceClient(ServiceClientSettings settings) : this(settings?.Endpoint, settings?.Options) => throw null; + public ServiceClient(ServiceClientSettings settings) : this(settings?.Endpoint, settings?.Client ?? default, settings?.Options) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/default/src/Generated/ServiceClientOptions.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/default/src/Generated/ServiceClientOptions.cs index e2ea98ab218..629dbd99553 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/default/src/Generated/ServiceClientOptions.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/default/src/Generated/ServiceClientOptions.cs @@ -10,6 +10,8 @@ namespace Client.Structure.Service { public partial class ServiceClientOptions : ClientPipelineOptions { + public ServiceClientOptions() => throw null; + [Experimental("SCME0002")] internal ServiceClientOptions(IConfigurationSection section) : base(section) => throw null; } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/default/src/Generated/ServiceClientSettings.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/default/src/Generated/ServiceClientSettings.cs index 7b3623819c6..3f55cc86a90 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/default/src/Generated/ServiceClientSettings.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/default/src/Generated/ServiceClientSettings.cs @@ -18,6 +18,12 @@ public Uri Endpoint set => throw null; } + public ClientType? Client + { + get => throw null; + set => throw null; + } + public ServiceClientOptions Options { get => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/multi-client/src/Generated/ClientAClient.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/multi-client/src/Generated/ClientAClient.cs index 9ead52f28b5..ee68e7681a6 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/multi-client/src/Generated/ClientAClient.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/multi-client/src/Generated/ClientAClient.cs @@ -21,7 +21,7 @@ public partial class ClientAClient public ClientAClient(Uri endpoint, ClientType client, ClientAClientOptions options) => throw null; [Experimental("SCME0002")] - public ClientAClient(ClientAClientSettings settings) : this(settings?.Endpoint, settings?.Options) => throw null; + public ClientAClient(ClientAClientSettings settings) : this(settings?.Endpoint, settings?.Client ?? default, settings?.Options) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/multi-client/src/Generated/ClientAClientOptions.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/multi-client/src/Generated/ClientAClientOptions.cs index b6a2f789659..3eb91cb70a2 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/multi-client/src/Generated/ClientAClientOptions.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/multi-client/src/Generated/ClientAClientOptions.cs @@ -10,6 +10,8 @@ namespace Client.Structure.MultiClient { public partial class ClientAClientOptions : ClientPipelineOptions { + public ClientAClientOptions() => throw null; + [Experimental("SCME0002")] internal ClientAClientOptions(IConfigurationSection section) : base(section) => throw null; } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/multi-client/src/Generated/ClientAClientSettings.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/multi-client/src/Generated/ClientAClientSettings.cs index d6693b0abe6..6f0bbb16861 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/multi-client/src/Generated/ClientAClientSettings.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/multi-client/src/Generated/ClientAClientSettings.cs @@ -5,6 +5,7 @@ using System; using System.ClientModel.Primitives; using System.Diagnostics.CodeAnalysis; +using Client.Structure.Service; using Microsoft.Extensions.Configuration; namespace Client.Structure.MultiClient @@ -18,6 +19,12 @@ public Uri Endpoint set => throw null; } + public ClientType? Client + { + get => throw null; + set => throw null; + } + public ClientAClientOptions Options { get => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/multi-client/src/Generated/ClientBClient.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/multi-client/src/Generated/ClientBClient.cs index 1f5101a866d..72c3b2441ef 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/multi-client/src/Generated/ClientBClient.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/multi-client/src/Generated/ClientBClient.cs @@ -21,7 +21,7 @@ public partial class ClientBClient public ClientBClient(Uri endpoint, ClientType client, ClientBClientOptions options) => throw null; [Experimental("SCME0002")] - public ClientBClient(ClientBClientSettings settings) : this(settings?.Endpoint, settings?.Options) => throw null; + public ClientBClient(ClientBClientSettings settings) : this(settings?.Endpoint, settings?.Client ?? default, settings?.Options) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/multi-client/src/Generated/ClientBClientOptions.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/multi-client/src/Generated/ClientBClientOptions.cs index be5cddbd4e5..5a0fed08e44 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/multi-client/src/Generated/ClientBClientOptions.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/multi-client/src/Generated/ClientBClientOptions.cs @@ -10,6 +10,8 @@ namespace Client.Structure.MultiClient { public partial class ClientBClientOptions : ClientPipelineOptions { + public ClientBClientOptions() => throw null; + [Experimental("SCME0002")] internal ClientBClientOptions(IConfigurationSection section) : base(section) => throw null; } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/multi-client/src/Generated/ClientBClientSettings.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/multi-client/src/Generated/ClientBClientSettings.cs index 236592b75b9..e7fc25b871d 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/multi-client/src/Generated/ClientBClientSettings.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/multi-client/src/Generated/ClientBClientSettings.cs @@ -5,6 +5,7 @@ using System; using System.ClientModel.Primitives; using System.Diagnostics.CodeAnalysis; +using Client.Structure.Service; using Microsoft.Extensions.Configuration; namespace Client.Structure.MultiClient @@ -18,6 +19,12 @@ public Uri Endpoint set => throw null; } + public ClientType? Client + { + get => throw null; + set => throw null; + } + public ClientBClientOptions Options { get => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/renamed-operation/src/Generated/RenamedOperationClient.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/renamed-operation/src/Generated/RenamedOperationClient.cs index e5e3c0a9944..93d800011fd 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/renamed-operation/src/Generated/RenamedOperationClient.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/renamed-operation/src/Generated/RenamedOperationClient.cs @@ -21,7 +21,7 @@ public partial class RenamedOperationClient public RenamedOperationClient(Uri endpoint, ClientType client, RenamedOperationClientOptions options) => throw null; [Experimental("SCME0002")] - public RenamedOperationClient(RenamedOperationClientSettings settings) : this(settings?.Endpoint, settings?.Options) => throw null; + public RenamedOperationClient(RenamedOperationClientSettings settings) : this(settings?.Endpoint, settings?.Client ?? default, settings?.Options) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/renamed-operation/src/Generated/RenamedOperationClientOptions.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/renamed-operation/src/Generated/RenamedOperationClientOptions.cs index 43bff10973b..d0992ccf0df 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/renamed-operation/src/Generated/RenamedOperationClientOptions.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/renamed-operation/src/Generated/RenamedOperationClientOptions.cs @@ -10,6 +10,8 @@ namespace Client.Structure.RenamedOperation { public partial class RenamedOperationClientOptions : ClientPipelineOptions { + public RenamedOperationClientOptions() => throw null; + [Experimental("SCME0002")] internal RenamedOperationClientOptions(IConfigurationSection section) : base(section) => throw null; } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/renamed-operation/src/Generated/RenamedOperationClientSettings.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/renamed-operation/src/Generated/RenamedOperationClientSettings.cs index 4e4434c1ae5..ad180f069ef 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/renamed-operation/src/Generated/RenamedOperationClientSettings.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/renamed-operation/src/Generated/RenamedOperationClientSettings.cs @@ -5,6 +5,7 @@ using System; using System.ClientModel.Primitives; using System.Diagnostics.CodeAnalysis; +using Client.Structure.Service; using Microsoft.Extensions.Configuration; namespace Client.Structure.RenamedOperation @@ -18,6 +19,12 @@ public Uri Endpoint set => throw null; } + public ClientType? Client + { + get => throw null; + set => throw null; + } + public RenamedOperationClientOptions Options { get => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/two-operation-group/src/Generated/TwoOperationGroupClient.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/two-operation-group/src/Generated/TwoOperationGroupClient.cs index 286aa46f7e1..724f534da1e 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/two-operation-group/src/Generated/TwoOperationGroupClient.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/two-operation-group/src/Generated/TwoOperationGroupClient.cs @@ -18,7 +18,7 @@ public partial class TwoOperationGroupClient public TwoOperationGroupClient(Uri endpoint, ClientType client, TwoOperationGroupClientOptions options) => throw null; [Experimental("SCME0002")] - public TwoOperationGroupClient(TwoOperationGroupClientSettings settings) : this(settings?.Endpoint, settings?.Options) => throw null; + public TwoOperationGroupClient(TwoOperationGroupClientSettings settings) : this(settings?.Endpoint, settings?.Client ?? default, settings?.Options) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/two-operation-group/src/Generated/TwoOperationGroupClientOptions.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/two-operation-group/src/Generated/TwoOperationGroupClientOptions.cs index 8c55bff86c7..f2f71a70cb9 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/two-operation-group/src/Generated/TwoOperationGroupClientOptions.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/two-operation-group/src/Generated/TwoOperationGroupClientOptions.cs @@ -10,6 +10,8 @@ namespace Client.Structure.TwoOperationGroup { public partial class TwoOperationGroupClientOptions : ClientPipelineOptions { + public TwoOperationGroupClientOptions() => throw null; + [Experimental("SCME0002")] internal TwoOperationGroupClientOptions(IConfigurationSection section) : base(section) => throw null; } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/two-operation-group/src/Generated/TwoOperationGroupClientSettings.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/two-operation-group/src/Generated/TwoOperationGroupClientSettings.cs index e418ebf8e9f..95a3a7d145b 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/two-operation-group/src/Generated/TwoOperationGroupClientSettings.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/two-operation-group/src/Generated/TwoOperationGroupClientSettings.cs @@ -5,6 +5,7 @@ using System; using System.ClientModel.Primitives; using System.Diagnostics.CodeAnalysis; +using Client.Structure.Service; using Microsoft.Extensions.Configuration; namespace Client.Structure.TwoOperationGroup @@ -18,6 +19,12 @@ public Uri Endpoint set => throw null; } + public ClientType? Client + { + get => throw null; + set => throw null; + } + public TwoOperationGroupClientOptions Options { get => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/documentation/src/Generated/DocumentationClientOptions.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/documentation/src/Generated/DocumentationClientOptions.cs index aaf844ca9bb..71abccf911b 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/documentation/src/Generated/DocumentationClientOptions.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/documentation/src/Generated/DocumentationClientOptions.cs @@ -10,6 +10,8 @@ namespace Documentation { public partial class DocumentationClientOptions : ClientPipelineOptions { + public DocumentationClientOptions() => throw null; + [Experimental("SCME0002")] internal DocumentationClientOptions(IConfigurationSection section) : base(section) => throw null; } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/array/src/Generated/ArrayClientOptions.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/array/src/Generated/ArrayClientOptions.cs index ddaaf1e669f..53bc44de8ab 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/array/src/Generated/ArrayClientOptions.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/array/src/Generated/ArrayClientOptions.cs @@ -10,6 +10,8 @@ namespace Encode._Array { public partial class ArrayClientOptions : ClientPipelineOptions { + public ArrayClientOptions() => throw null; + [Experimental("SCME0002")] internal ArrayClientOptions(IConfigurationSection section) : base(section) => throw null; } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/bytes/src/Generated/BytesClientOptions.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/bytes/src/Generated/BytesClientOptions.cs index 54102fe0cf4..9e4ed241a12 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/bytes/src/Generated/BytesClientOptions.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/bytes/src/Generated/BytesClientOptions.cs @@ -10,6 +10,8 @@ namespace Encode.Bytes { public partial class BytesClientOptions : ClientPipelineOptions { + public BytesClientOptions() => throw null; + [Experimental("SCME0002")] internal BytesClientOptions(IConfigurationSection section) : base(section) => throw null; } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/datetime/src/Generated/DatetimeClientOptions.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/datetime/src/Generated/DatetimeClientOptions.cs index 3e47968e597..39b0653f0a2 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/datetime/src/Generated/DatetimeClientOptions.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/datetime/src/Generated/DatetimeClientOptions.cs @@ -10,6 +10,8 @@ namespace Encode.Datetime { public partial class DatetimeClientOptions : ClientPipelineOptions { + public DatetimeClientOptions() => throw null; + [Experimental("SCME0002")] internal DatetimeClientOptions(IConfigurationSection section) : base(section) => throw null; } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/duration/src/Generated/DurationClientOptions.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/duration/src/Generated/DurationClientOptions.cs index 29e1b4603a2..a3259a567ec 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/duration/src/Generated/DurationClientOptions.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/duration/src/Generated/DurationClientOptions.cs @@ -10,6 +10,8 @@ namespace Encode.Duration { public partial class DurationClientOptions : ClientPipelineOptions { + public DurationClientOptions() => throw null; + [Experimental("SCME0002")] internal DurationClientOptions(IConfigurationSection section) : base(section) => throw null; } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/numeric/src/Generated/NumericClientOptions.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/numeric/src/Generated/NumericClientOptions.cs index 11858671eed..678f0fd0618 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/numeric/src/Generated/NumericClientOptions.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/numeric/src/Generated/NumericClientOptions.cs @@ -10,6 +10,8 @@ namespace Encode.Numeric { public partial class NumericClientOptions : ClientPipelineOptions { + public NumericClientOptions() => throw null; + [Experimental("SCME0002")] internal NumericClientOptions(IConfigurationSection section) : base(section) => throw null; } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/basic/src/Generated/BasicClientOptions.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/basic/src/Generated/BasicClientOptions.cs index 6275ed4f48b..a537b38f60a 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/basic/src/Generated/BasicClientOptions.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/basic/src/Generated/BasicClientOptions.cs @@ -10,6 +10,8 @@ namespace Parameters.Basic { public partial class BasicClientOptions : ClientPipelineOptions { + public BasicClientOptions() => throw null; + [Experimental("SCME0002")] internal BasicClientOptions(IConfigurationSection section) : base(section) => throw null; } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/body-optionality/src/Generated/BodyOptionalityClientOptions.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/body-optionality/src/Generated/BodyOptionalityClientOptions.cs index d16cd1e6a9d..33804b10acc 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/body-optionality/src/Generated/BodyOptionalityClientOptions.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/body-optionality/src/Generated/BodyOptionalityClientOptions.cs @@ -10,6 +10,8 @@ namespace Parameters.BodyOptionality { public partial class BodyOptionalityClientOptions : ClientPipelineOptions { + public BodyOptionalityClientOptions() => throw null; + [Experimental("SCME0002")] internal BodyOptionalityClientOptions(IConfigurationSection section) : base(section) => throw null; } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/collection-format/src/Generated/CollectionFormatClientOptions.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/collection-format/src/Generated/CollectionFormatClientOptions.cs index aa251fcd4e5..227d9ffd344 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/collection-format/src/Generated/CollectionFormatClientOptions.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/collection-format/src/Generated/CollectionFormatClientOptions.cs @@ -10,6 +10,8 @@ namespace Parameters.CollectionFormat { public partial class CollectionFormatClientOptions : ClientPipelineOptions { + public CollectionFormatClientOptions() => throw null; + [Experimental("SCME0002")] internal CollectionFormatClientOptions(IConfigurationSection section) : base(section) => throw null; } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/path/src/Generated/PathClientOptions.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/path/src/Generated/PathClientOptions.cs index 777d6cb255a..b544589353f 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/path/src/Generated/PathClientOptions.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/path/src/Generated/PathClientOptions.cs @@ -10,6 +10,8 @@ namespace Parameters.Path { public partial class PathClientOptions : ClientPipelineOptions { + public PathClientOptions() => throw null; + [Experimental("SCME0002")] internal PathClientOptions(IConfigurationSection section) : base(section) => throw null; } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/query/src/Generated/QueryClientOptions.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/query/src/Generated/QueryClientOptions.cs index feac4c1e466..a785237dffc 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/query/src/Generated/QueryClientOptions.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/query/src/Generated/QueryClientOptions.cs @@ -10,6 +10,8 @@ namespace Parameters.Query { public partial class QueryClientOptions : ClientPipelineOptions { + public QueryClientOptions() => throw null; + [Experimental("SCME0002")] internal QueryClientOptions(IConfigurationSection section) : base(section) => throw null; } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/spread/src/Generated/SpreadClientOptions.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/spread/src/Generated/SpreadClientOptions.cs index c4bac49d9b2..27baba6242d 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/spread/src/Generated/SpreadClientOptions.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/spread/src/Generated/SpreadClientOptions.cs @@ -10,6 +10,8 @@ namespace Parameters.Spread { public partial class SpreadClientOptions : ClientPipelineOptions { + public SpreadClientOptions() => throw null; + [Experimental("SCME0002")] internal SpreadClientOptions(IConfigurationSection section) : base(section) => throw null; } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/content-negotiation/src/Generated/ContentNegotiationClientOptions.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/content-negotiation/src/Generated/ContentNegotiationClientOptions.cs index 65f6c5f01d8..c6e914d7f4c 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/content-negotiation/src/Generated/ContentNegotiationClientOptions.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/content-negotiation/src/Generated/ContentNegotiationClientOptions.cs @@ -10,6 +10,8 @@ namespace Payload.ContentNegotiation { public partial class ContentNegotiationClientOptions : ClientPipelineOptions { + public ContentNegotiationClientOptions() => throw null; + [Experimental("SCME0002")] internal ContentNegotiationClientOptions(IConfigurationSection section) : base(section) => throw null; } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/json-merge-patch/src/Generated/JsonMergePatchClientOptions.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/json-merge-patch/src/Generated/JsonMergePatchClientOptions.cs index 5a459a6229e..c64a14e0ec1 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/json-merge-patch/src/Generated/JsonMergePatchClientOptions.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/json-merge-patch/src/Generated/JsonMergePatchClientOptions.cs @@ -10,6 +10,8 @@ namespace Payload.JsonMergePatch { public partial class JsonMergePatchClientOptions : ClientPipelineOptions { + public JsonMergePatchClientOptions() => throw null; + [Experimental("SCME0002")] internal JsonMergePatchClientOptions(IConfigurationSection section) : base(section) => throw null; } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/media-type/src/Generated/MediaTypeClientOptions.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/media-type/src/Generated/MediaTypeClientOptions.cs index 56323e88093..eb36f49a44c 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/media-type/src/Generated/MediaTypeClientOptions.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/media-type/src/Generated/MediaTypeClientOptions.cs @@ -10,6 +10,8 @@ namespace Payload.MediaType { public partial class MediaTypeClientOptions : ClientPipelineOptions { + public MediaTypeClientOptions() => throw null; + [Experimental("SCME0002")] internal MediaTypeClientOptions(IConfigurationSection section) : base(section) => throw null; } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/multipart/src/Generated/MultiPartClientOptions.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/multipart/src/Generated/MultiPartClientOptions.cs index a585956cfcd..8c4e0bdd9bc 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/multipart/src/Generated/MultiPartClientOptions.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/multipart/src/Generated/MultiPartClientOptions.cs @@ -10,6 +10,8 @@ namespace Payload.MultiPart { public partial class MultiPartClientOptions : ClientPipelineOptions { + public MultiPartClientOptions() => throw null; + [Experimental("SCME0002")] internal MultiPartClientOptions(IConfigurationSection section) : base(section) => throw null; } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/pageable/src/Generated/PageableClientOptions.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/pageable/src/Generated/PageableClientOptions.cs index f60308ebdce..42a316d9908 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/pageable/src/Generated/PageableClientOptions.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/pageable/src/Generated/PageableClientOptions.cs @@ -10,6 +10,8 @@ namespace Payload.Pageable { public partial class PageableClientOptions : ClientPipelineOptions { + public PageableClientOptions() => throw null; + [Experimental("SCME0002")] internal PageableClientOptions(IConfigurationSection section) : base(section) => throw null; } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/xml/src/Generated/XmlClientOptions.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/xml/src/Generated/XmlClientOptions.cs index 2f59c52886b..8969f41eb08 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/xml/src/Generated/XmlClientOptions.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/xml/src/Generated/XmlClientOptions.cs @@ -10,6 +10,8 @@ namespace Payload.Xml { public partial class XmlClientOptions : ClientPipelineOptions { + public XmlClientOptions() => throw null; + [Experimental("SCME0002")] internal XmlClientOptions(IConfigurationSection section) : base(section) => throw null; } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/resiliency/srv-driven/v1/src/Generated/ResiliencyServiceDrivenClient.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/resiliency/srv-driven/v1/src/Generated/ResiliencyServiceDrivenClient.cs index 39c24de3c65..d1576cf1e2d 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/resiliency/srv-driven/v1/src/Generated/ResiliencyServiceDrivenClient.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/resiliency/srv-driven/v1/src/Generated/ResiliencyServiceDrivenClient.cs @@ -20,7 +20,7 @@ public partial class ResiliencyServiceDrivenClient public ResiliencyServiceDrivenClient(Uri endpoint, string serviceDeploymentVersion, ResiliencyServiceDrivenClientOptions options) => throw null; [Experimental("SCME0002")] - public ResiliencyServiceDrivenClient(ResiliencyServiceDrivenClientSettings settings) : this(settings?.Endpoint, settings?.Options) => throw null; + public ResiliencyServiceDrivenClient(ResiliencyServiceDrivenClientSettings settings) : this(settings?.Endpoint, settings?.ServiceDeploymentVersion, settings?.Options) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/resiliency/srv-driven/v1/src/Generated/ResiliencyServiceDrivenClientSettings.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/resiliency/srv-driven/v1/src/Generated/ResiliencyServiceDrivenClientSettings.cs index 8fc780e6f90..dd1dd517226 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/resiliency/srv-driven/v1/src/Generated/ResiliencyServiceDrivenClientSettings.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/resiliency/srv-driven/v1/src/Generated/ResiliencyServiceDrivenClientSettings.cs @@ -18,6 +18,12 @@ public Uri Endpoint set => throw null; } + public string ServiceDeploymentVersion + { + get => throw null; + set => throw null; + } + public ResiliencyServiceDrivenClientOptions Options { get => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/resiliency/srv-driven/v2/src/Generated/ResiliencyServiceDrivenClient.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/resiliency/srv-driven/v2/src/Generated/ResiliencyServiceDrivenClient.cs index 83002c7a037..c44274d26d8 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/resiliency/srv-driven/v2/src/Generated/ResiliencyServiceDrivenClient.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/resiliency/srv-driven/v2/src/Generated/ResiliencyServiceDrivenClient.cs @@ -20,7 +20,7 @@ public partial class ResiliencyServiceDrivenClient public ResiliencyServiceDrivenClient(Uri endpoint, string serviceDeploymentVersion, ResiliencyServiceDrivenClientOptions options) => throw null; [Experimental("SCME0002")] - public ResiliencyServiceDrivenClient(ResiliencyServiceDrivenClientSettings settings) : this(settings?.Endpoint, settings?.Options) => throw null; + public ResiliencyServiceDrivenClient(ResiliencyServiceDrivenClientSettings settings) : this(settings?.Endpoint, settings?.ServiceDeploymentVersion, settings?.Options) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/resiliency/srv-driven/v2/src/Generated/ResiliencyServiceDrivenClientSettings.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/resiliency/srv-driven/v2/src/Generated/ResiliencyServiceDrivenClientSettings.cs index 8fc780e6f90..dd1dd517226 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/resiliency/srv-driven/v2/src/Generated/ResiliencyServiceDrivenClientSettings.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/resiliency/srv-driven/v2/src/Generated/ResiliencyServiceDrivenClientSettings.cs @@ -18,6 +18,12 @@ public Uri Endpoint set => throw null; } + public string ServiceDeploymentVersion + { + get => throw null; + set => throw null; + } + public ResiliencyServiceDrivenClientOptions Options { get => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/response/status-code-range/src/Generated/StatusCodeRangeClientOptions.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/response/status-code-range/src/Generated/StatusCodeRangeClientOptions.cs index 60107960db0..6c81e4b3cb9 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/response/status-code-range/src/Generated/StatusCodeRangeClientOptions.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/response/status-code-range/src/Generated/StatusCodeRangeClientOptions.cs @@ -10,6 +10,8 @@ namespace Response.StatusCodeRange { public partial class StatusCodeRangeClientOptions : ClientPipelineOptions { + public StatusCodeRangeClientOptions() => throw null; + [Experimental("SCME0002")] internal StatusCodeRangeClientOptions(IConfigurationSection section) : base(section) => throw null; } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/RoutesClientOptions.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/RoutesClientOptions.cs index d3f721a8793..7baddfceeb4 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/RoutesClientOptions.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/RoutesClientOptions.cs @@ -10,6 +10,8 @@ namespace Routes { public partial class RoutesClientOptions : ClientPipelineOptions { + public RoutesClientOptions() => throw null; + [Experimental("SCME0002")] internal RoutesClientOptions(IConfigurationSection section) : base(section) => throw null; } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/serialization/encoded-name/json/src/Generated/JsonClientOptions.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/serialization/encoded-name/json/src/Generated/JsonClientOptions.cs index 28328fcb891..9ecf64e286d 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/serialization/encoded-name/json/src/Generated/JsonClientOptions.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/serialization/encoded-name/json/src/Generated/JsonClientOptions.cs @@ -10,6 +10,8 @@ namespace Serialization.EncodedName.Json { public partial class JsonClientOptions : ClientPipelineOptions { + public JsonClientOptions() => throw null; + [Experimental("SCME0002")] internal JsonClientOptions(IConfigurationSection section) : base(section) => throw null; } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/server/endpoint/not-defined/src/Generated/NotDefinedClientOptions.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/server/endpoint/not-defined/src/Generated/NotDefinedClientOptions.cs index 88f228a9f3f..4b087e11457 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/server/endpoint/not-defined/src/Generated/NotDefinedClientOptions.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/server/endpoint/not-defined/src/Generated/NotDefinedClientOptions.cs @@ -10,6 +10,8 @@ namespace Server.Endpoint.NotDefined { public partial class NotDefinedClientOptions : ClientPipelineOptions { + public NotDefinedClientOptions() => throw null; + [Experimental("SCME0002")] internal NotDefinedClientOptions(IConfigurationSection section) : base(section) => throw null; } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/server/path/single/src/Generated/SingleClientOptions.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/server/path/single/src/Generated/SingleClientOptions.cs index 78e65f3988e..2437f3efb2e 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/server/path/single/src/Generated/SingleClientOptions.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/server/path/single/src/Generated/SingleClientOptions.cs @@ -10,6 +10,8 @@ namespace Server.Path.Single { public partial class SingleClientOptions : ClientPipelineOptions { + public SingleClientOptions() => throw null; + [Experimental("SCME0002")] internal SingleClientOptions(IConfigurationSection section) : base(section) => throw null; } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/server/versions/not-versioned/src/Generated/NotVersionedClientOptions.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/server/versions/not-versioned/src/Generated/NotVersionedClientOptions.cs index 9568cf0dff4..d799204f298 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/server/versions/not-versioned/src/Generated/NotVersionedClientOptions.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/server/versions/not-versioned/src/Generated/NotVersionedClientOptions.cs @@ -10,6 +10,8 @@ namespace Server.Versions.NotVersioned { public partial class NotVersionedClientOptions : ClientPipelineOptions { + public NotVersionedClientOptions() => throw null; + [Experimental("SCME0002")] internal NotVersionedClientOptions(IConfigurationSection section) : base(section) => throw null; } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/special-headers/conditional-request/src/Generated/ConditionalRequestClientOptions.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/special-headers/conditional-request/src/Generated/ConditionalRequestClientOptions.cs index 9f62811ed8f..95d658caefb 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/special-headers/conditional-request/src/Generated/ConditionalRequestClientOptions.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/special-headers/conditional-request/src/Generated/ConditionalRequestClientOptions.cs @@ -10,6 +10,8 @@ namespace SpecialHeaders.ConditionalRequest { public partial class ConditionalRequestClientOptions : ClientPipelineOptions { + public ConditionalRequestClientOptions() => throw null; + [Experimental("SCME0002")] internal ConditionalRequestClientOptions(IConfigurationSection section) : base(section) => throw null; } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/special-headers/repeatability/src/Generated/RepeatabilityClientOptions.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/special-headers/repeatability/src/Generated/RepeatabilityClientOptions.cs index cf921921a90..fb088f71dbb 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/special-headers/repeatability/src/Generated/RepeatabilityClientOptions.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/special-headers/repeatability/src/Generated/RepeatabilityClientOptions.cs @@ -10,6 +10,8 @@ namespace SpecialHeaders.Repeatability { public partial class RepeatabilityClientOptions : ClientPipelineOptions { + public RepeatabilityClientOptions() => throw null; + [Experimental("SCME0002")] internal RepeatabilityClientOptions(IConfigurationSection section) : base(section) => throw null; } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/special-words/src/Generated/SpecialWordsClientOptions.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/special-words/src/Generated/SpecialWordsClientOptions.cs index ac465ad1fb5..62880034a3c 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/special-words/src/Generated/SpecialWordsClientOptions.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/special-words/src/Generated/SpecialWordsClientOptions.cs @@ -10,6 +10,8 @@ namespace SpecialWords { public partial class SpecialWordsClientOptions : ClientPipelineOptions { + public SpecialWordsClientOptions() => throw null; + [Experimental("SCME0002")] internal SpecialWordsClientOptions(IConfigurationSection section) : base(section) => throw null; } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/array/src/Generated/ArrayClientOptions.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/array/src/Generated/ArrayClientOptions.cs index 7b9c9fba908..dc7837266e1 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/array/src/Generated/ArrayClientOptions.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/array/src/Generated/ArrayClientOptions.cs @@ -10,6 +10,8 @@ namespace _Type._Array { public partial class ArrayClientOptions : ClientPipelineOptions { + public ArrayClientOptions() => throw null; + [Experimental("SCME0002")] internal ArrayClientOptions(IConfigurationSection section) : base(section) => throw null; } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/dictionary/src/Generated/DictionaryClientOptions.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/dictionary/src/Generated/DictionaryClientOptions.cs index 0bc7f38ee76..ffc737d6134 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/dictionary/src/Generated/DictionaryClientOptions.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/dictionary/src/Generated/DictionaryClientOptions.cs @@ -10,6 +10,8 @@ namespace _Type.Dictionary { public partial class DictionaryClientOptions : ClientPipelineOptions { + public DictionaryClientOptions() => throw null; + [Experimental("SCME0002")] internal DictionaryClientOptions(IConfigurationSection section) : base(section) => throw null; } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/enum/extensible/src/Generated/ExtensibleClientOptions.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/enum/extensible/src/Generated/ExtensibleClientOptions.cs index b9a7b5af8cf..8abce3f7be1 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/enum/extensible/src/Generated/ExtensibleClientOptions.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/enum/extensible/src/Generated/ExtensibleClientOptions.cs @@ -10,6 +10,8 @@ namespace _Type._Enum.Extensible { public partial class ExtensibleClientOptions : ClientPipelineOptions { + public ExtensibleClientOptions() => throw null; + [Experimental("SCME0002")] internal ExtensibleClientOptions(IConfigurationSection section) : base(section) => throw null; } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/enum/fixed/src/Generated/FixedClientOptions.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/enum/fixed/src/Generated/FixedClientOptions.cs index 457e9d5eade..5aa2c9da80c 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/enum/fixed/src/Generated/FixedClientOptions.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/enum/fixed/src/Generated/FixedClientOptions.cs @@ -10,6 +10,8 @@ namespace _Type._Enum.Fixed { public partial class FixedClientOptions : ClientPipelineOptions { + public FixedClientOptions() => throw null; + [Experimental("SCME0002")] internal FixedClientOptions(IConfigurationSection section) : base(section) => throw null; } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/empty/src/Generated/EmptyClientOptions.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/empty/src/Generated/EmptyClientOptions.cs index d907b861126..624ba0c0143 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/empty/src/Generated/EmptyClientOptions.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/empty/src/Generated/EmptyClientOptions.cs @@ -10,6 +10,8 @@ namespace _Type.Model.Empty { public partial class EmptyClientOptions : ClientPipelineOptions { + public EmptyClientOptions() => throw null; + [Experimental("SCME0002")] internal EmptyClientOptions(IConfigurationSection section) : base(section) => throw null; } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/inheritance/enum-discriminator/src/Generated/EnumDiscriminatorClientOptions.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/inheritance/enum-discriminator/src/Generated/EnumDiscriminatorClientOptions.cs index 68d5a012cec..3945cd829b8 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/inheritance/enum-discriminator/src/Generated/EnumDiscriminatorClientOptions.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/inheritance/enum-discriminator/src/Generated/EnumDiscriminatorClientOptions.cs @@ -10,6 +10,8 @@ namespace _Type.Model.Inheritance.EnumDiscriminator { public partial class EnumDiscriminatorClientOptions : ClientPipelineOptions { + public EnumDiscriminatorClientOptions() => throw null; + [Experimental("SCME0002")] internal EnumDiscriminatorClientOptions(IConfigurationSection section) : base(section) => throw null; } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/inheritance/nested-discriminator/src/Generated/NestedDiscriminatorClientOptions.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/inheritance/nested-discriminator/src/Generated/NestedDiscriminatorClientOptions.cs index 93e0996b13c..f6c8cb646ab 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/inheritance/nested-discriminator/src/Generated/NestedDiscriminatorClientOptions.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/inheritance/nested-discriminator/src/Generated/NestedDiscriminatorClientOptions.cs @@ -10,6 +10,8 @@ namespace _Type.Model.Inheritance.NestedDiscriminator { public partial class NestedDiscriminatorClientOptions : ClientPipelineOptions { + public NestedDiscriminatorClientOptions() => throw null; + [Experimental("SCME0002")] internal NestedDiscriminatorClientOptions(IConfigurationSection section) : base(section) => throw null; } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/inheritance/not-discriminated/src/Generated/NotDiscriminatedClientOptions.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/inheritance/not-discriminated/src/Generated/NotDiscriminatedClientOptions.cs index 619298ff0f0..7b39c39bee2 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/inheritance/not-discriminated/src/Generated/NotDiscriminatedClientOptions.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/inheritance/not-discriminated/src/Generated/NotDiscriminatedClientOptions.cs @@ -10,6 +10,8 @@ namespace _Type.Model.Inheritance.NotDiscriminated { public partial class NotDiscriminatedClientOptions : ClientPipelineOptions { + public NotDiscriminatedClientOptions() => throw null; + [Experimental("SCME0002")] internal NotDiscriminatedClientOptions(IConfigurationSection section) : base(section) => throw null; } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/inheritance/recursive/src/Generated/RecursiveClientOptions.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/inheritance/recursive/src/Generated/RecursiveClientOptions.cs index d68c5ba6913..3d72ed64ff1 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/inheritance/recursive/src/Generated/RecursiveClientOptions.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/inheritance/recursive/src/Generated/RecursiveClientOptions.cs @@ -10,6 +10,8 @@ namespace _Type.Model.Inheritance.Recursive { public partial class RecursiveClientOptions : ClientPipelineOptions { + public RecursiveClientOptions() => throw null; + [Experimental("SCME0002")] internal RecursiveClientOptions(IConfigurationSection section) : base(section) => throw null; } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/inheritance/single-discriminator/src/Generated/SingleDiscriminatorClientOptions.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/inheritance/single-discriminator/src/Generated/SingleDiscriminatorClientOptions.cs index 0b6e4e01cb8..2b4f31e4023 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/inheritance/single-discriminator/src/Generated/SingleDiscriminatorClientOptions.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/inheritance/single-discriminator/src/Generated/SingleDiscriminatorClientOptions.cs @@ -10,6 +10,8 @@ namespace _Type.Model.Inheritance.SingleDiscriminator { public partial class SingleDiscriminatorClientOptions : ClientPipelineOptions { + public SingleDiscriminatorClientOptions() => throw null; + [Experimental("SCME0002")] internal SingleDiscriminatorClientOptions(IConfigurationSection section) : base(section) => throw null; } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/usage/src/Generated/UsageClientOptions.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/usage/src/Generated/UsageClientOptions.cs index b7df89f0a4a..d5df51bba00 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/usage/src/Generated/UsageClientOptions.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/usage/src/Generated/UsageClientOptions.cs @@ -10,6 +10,8 @@ namespace _Type.Model.Usage { public partial class UsageClientOptions : ClientPipelineOptions { + public UsageClientOptions() => throw null; + [Experimental("SCME0002")] internal UsageClientOptions(IConfigurationSection section) : base(section) => throw null; } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/visibility/src/Generated/VisibilityClientOptions.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/visibility/src/Generated/VisibilityClientOptions.cs index a77f4b26aea..520f19501ba 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/visibility/src/Generated/VisibilityClientOptions.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/visibility/src/Generated/VisibilityClientOptions.cs @@ -10,6 +10,8 @@ namespace _Type.Model.Visibility { public partial class VisibilityClientOptions : ClientPipelineOptions { + public VisibilityClientOptions() => throw null; + [Experimental("SCME0002")] internal VisibilityClientOptions(IConfigurationSection section) : base(section) => throw null; } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/AdditionalPropertiesClientOptions.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/AdditionalPropertiesClientOptions.cs index b0c26ef9d7d..6564b4c3c8b 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/AdditionalPropertiesClientOptions.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/AdditionalPropertiesClientOptions.cs @@ -10,6 +10,8 @@ namespace _Type.Property.AdditionalProperties { public partial class AdditionalPropertiesClientOptions : ClientPipelineOptions { + public AdditionalPropertiesClientOptions() => throw null; + [Experimental("SCME0002")] internal AdditionalPropertiesClientOptions(IConfigurationSection section) : base(section) => throw null; } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/nullable/src/Generated/NullableClientOptions.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/nullable/src/Generated/NullableClientOptions.cs index fac74cb122c..4e33d510c38 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/nullable/src/Generated/NullableClientOptions.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/nullable/src/Generated/NullableClientOptions.cs @@ -10,6 +10,8 @@ namespace _Type.Property.Nullable { public partial class NullableClientOptions : ClientPipelineOptions { + public NullableClientOptions() => throw null; + [Experimental("SCME0002")] internal NullableClientOptions(IConfigurationSection section) : base(section) => throw null; } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/optionality/src/Generated/OptionalClientOptions.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/optionality/src/Generated/OptionalClientOptions.cs index 30be22458c0..822e91c77df 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/optionality/src/Generated/OptionalClientOptions.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/optionality/src/Generated/OptionalClientOptions.cs @@ -10,6 +10,8 @@ namespace _Type.Property.Optional { public partial class OptionalClientOptions : ClientPipelineOptions { + public OptionalClientOptions() => throw null; + [Experimental("SCME0002")] internal OptionalClientOptions(IConfigurationSection section) : base(section) => throw null; } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/ValueTypesClientOptions.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/ValueTypesClientOptions.cs index 4dc4307a63b..2a908e1bd20 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/ValueTypesClientOptions.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/ValueTypesClientOptions.cs @@ -10,6 +10,8 @@ namespace _Type.Property.ValueTypes { public partial class ValueTypesClientOptions : ClientPipelineOptions { + public ValueTypesClientOptions() => throw null; + [Experimental("SCME0002")] internal ValueTypesClientOptions(IConfigurationSection section) : base(section) => throw null; } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/scalar/src/Generated/ScalarClientOptions.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/scalar/src/Generated/ScalarClientOptions.cs index 0cd9b666e34..16a42e8a09c 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/scalar/src/Generated/ScalarClientOptions.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/scalar/src/Generated/ScalarClientOptions.cs @@ -10,6 +10,8 @@ namespace _Type.Scalar { public partial class ScalarClientOptions : ClientPipelineOptions { + public ScalarClientOptions() => throw null; + [Experimental("SCME0002")] internal ScalarClientOptions(IConfigurationSection section) : base(section) => throw null; } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/union/src/Generated/UnionClientOptions.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/union/src/Generated/UnionClientOptions.cs index b434d0884c2..9352bd0c9c3 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/union/src/Generated/UnionClientOptions.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/union/src/Generated/UnionClientOptions.cs @@ -10,6 +10,8 @@ namespace _Type.Union { public partial class UnionClientOptions : ClientPipelineOptions { + public UnionClientOptions() => throw null; + [Experimental("SCME0002")] internal UnionClientOptions(IConfigurationSection section) : base(section) => throw null; } From 9174c45ceaec427baf34757f34e84178859a946a Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 6 Mar 2026 03:11:39 +0000 Subject: [PATCH 07/38] fix(http-client-csharp): set Version to latest in IConfigurationSection constructor before guard Co-authored-by: JoshLove-msft <54595583+JoshLove-msft@users.noreply.github.com> --- .../src/Providers/ClientOptionsProvider.cs | 16 +++++++++++++++- ...rviceClient_GeneratesExpectedClientOptions.cs | 2 ++ ...reeServices_GeneratesExpectedClientOptions.cs | 3 +++ ...binedClient_GeneratesExpectedClientOptions.cs | 2 ++ ...reeServices_GeneratesExpectedClientOptions.cs | 3 +++ .../src/Generated/SampleTypeSpecClientOptions.cs | 1 + 6 files changed, 26 insertions(+), 1 deletion(-) diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Providers/ClientOptionsProvider.cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Providers/ClientOptionsProvider.cs index a0d0a6bf1e8..1e1d16c20e6 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Providers/ClientOptionsProvider.cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Providers/ClientOptionsProvider.cs @@ -302,12 +302,26 @@ private ConstructorProvider BuildConfigurationSectionConstructor() typeof(System.Diagnostics.CodeAnalysis.ExperimentalAttribute), [Literal(ClientSettingsProvider.ClientSettingsDiagnosticId)]); + // Set version to latest version before the guard so it is always initialized + var body = new List(); + if (LatestVersionsFields != null && VersionProperties != null) + { + foreach (var (_, serviceVersionEnum) in LatestVersionsFields) + { + if (VersionProperties.TryGetValue(serviceVersionEnum, out var versionProperty)) + { + var latestVersion = serviceVersionEnum.EnumValues[^1]; + body.Add(versionProperty.Assign(Literal(latestVersion.Value)).Terminate()); + } + } + } + // if (section is null || !section.Exists()) { return; } var guardCondition = sectionParam.Is(Null).Or(Not(sectionParam.Invoke("Exists"))); var guardStatement = new IfStatement(guardCondition); guardStatement.Add(Return()); - var body = new List { guardStatement }; + body.Add(guardStatement); // Build a set of version property names for O(1) lookup var versionPropertyNames = VersionProperties?.Values.Select(vp => vp.Name).ToHashSet(); diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/TestData/ClientOptionsProviderTests/MultiServiceClient_GeneratesExpectedClientOptions.cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/TestData/ClientOptionsProviderTests/MultiServiceClient_GeneratesExpectedClientOptions.cs index 7f679a6aa69..793a7a38ff5 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/TestData/ClientOptionsProviderTests/MultiServiceClient_GeneratesExpectedClientOptions.cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/TestData/ClientOptionsProviderTests/MultiServiceClient_GeneratesExpectedClientOptions.cs @@ -33,6 +33,8 @@ public TestClientOptions(global::Sample.TestClientOptions.ServiceAVersion servic [global::System.Diagnostics.CodeAnalysis.ExperimentalAttribute("SCME0002")] internal TestClientOptions(global::Microsoft.Extensions.Configuration.IConfigurationSection section) : base(section) { + ServiceAApiVersion = "2.0"; + ServiceBApiVersion = "4.0"; if (((section is null) || !section.Exists())) { return; diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/TestData/ClientOptionsProviderTests/MultiServiceClient_WithThreeServices_GeneratesExpectedClientOptions.cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/TestData/ClientOptionsProviderTests/MultiServiceClient_WithThreeServices_GeneratesExpectedClientOptions.cs index 2aeaa9f00ad..ea82828c46b 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/TestData/ClientOptionsProviderTests/MultiServiceClient_WithThreeServices_GeneratesExpectedClientOptions.cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/TestData/ClientOptionsProviderTests/MultiServiceClient_WithThreeServices_GeneratesExpectedClientOptions.cs @@ -41,6 +41,9 @@ public TestClientOptions(global::Sample.TestClientOptions.ServiceKeyVaultVersion [global::System.Diagnostics.CodeAnalysis.ExperimentalAttribute("SCME0002")] internal TestClientOptions(global::Microsoft.Extensions.Configuration.IConfigurationSection section) : base(section) { + ServiceKeyVaultApiVersion = "7.5"; + ServiceStorageApiVersion = "2024-01-01"; + ServiceComputeApiVersion = "2024-07-01"; if (((section is null) || !section.Exists())) { return; diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/TestData/ClientOptionsProviderTests/MultiServiceCombinedClient_GeneratesExpectedClientOptions.cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/TestData/ClientOptionsProviderTests/MultiServiceCombinedClient_GeneratesExpectedClientOptions.cs index 7f679a6aa69..793a7a38ff5 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/TestData/ClientOptionsProviderTests/MultiServiceCombinedClient_GeneratesExpectedClientOptions.cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/TestData/ClientOptionsProviderTests/MultiServiceCombinedClient_GeneratesExpectedClientOptions.cs @@ -33,6 +33,8 @@ public TestClientOptions(global::Sample.TestClientOptions.ServiceAVersion servic [global::System.Diagnostics.CodeAnalysis.ExperimentalAttribute("SCME0002")] internal TestClientOptions(global::Microsoft.Extensions.Configuration.IConfigurationSection section) : base(section) { + ServiceAApiVersion = "2.0"; + ServiceBApiVersion = "4.0"; if (((section is null) || !section.Exists())) { return; diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/TestData/ClientOptionsProviderTests/MultiServiceCombinedClient_WithThreeServices_GeneratesExpectedClientOptions.cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/TestData/ClientOptionsProviderTests/MultiServiceCombinedClient_WithThreeServices_GeneratesExpectedClientOptions.cs index 2aeaa9f00ad..ea82828c46b 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/TestData/ClientOptionsProviderTests/MultiServiceCombinedClient_WithThreeServices_GeneratesExpectedClientOptions.cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/TestData/ClientOptionsProviderTests/MultiServiceCombinedClient_WithThreeServices_GeneratesExpectedClientOptions.cs @@ -41,6 +41,9 @@ public TestClientOptions(global::Sample.TestClientOptions.ServiceKeyVaultVersion [global::System.Diagnostics.CodeAnalysis.ExperimentalAttribute("SCME0002")] internal TestClientOptions(global::Microsoft.Extensions.Configuration.IConfigurationSection section) : base(section) { + ServiceKeyVaultApiVersion = "7.5"; + ServiceStorageApiVersion = "2024-01-01"; + ServiceComputeApiVersion = "2024-07-01"; if (((section is null) || !section.Exists())) { return; diff --git a/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/SampleTypeSpecClientOptions.cs b/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/SampleTypeSpecClientOptions.cs index 2c16a5ed792..f697b689145 100644 --- a/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/SampleTypeSpecClientOptions.cs +++ b/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/SampleTypeSpecClientOptions.cs @@ -34,6 +34,7 @@ public SampleTypeSpecClientOptions(ServiceVersion version = LatestVersion) [Experimental("SCME0002")] internal SampleTypeSpecClientOptions(IConfigurationSection section) : base(section) { + Version = "2024-08-16-preview"; if (section is null || !section.Exists()) { return; From 6ecdd2dc864374100d7befa9ef456aaefa301add Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 10 Mar 2026 23:36:41 +0000 Subject: [PATCH 08/38] feat: AuthenticationPolicy internal constructor, Uri.TryCreate, Version from config Co-authored-by: JoshLove-msft <54595583+JoshLove-msft@users.noreply.github.com> --- .../src/Providers/ClientOptionsProvider.cs | 16 +++ .../src/Providers/ClientProvider.cs | 132 ++++++++++++------ .../src/Providers/ClientSettingsProvider.cs | 17 ++- .../ClientProviders/ClientProviderTests.cs | 129 ++++++++--------- 4 files changed, 181 insertions(+), 113 deletions(-) diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Providers/ClientOptionsProvider.cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Providers/ClientOptionsProvider.cs index 1e1d16c20e6..1e418c24eb6 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Providers/ClientOptionsProvider.cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Providers/ClientOptionsProvider.cs @@ -323,6 +323,22 @@ private ConstructorProvider BuildConfigurationSectionConstructor() body.Add(guardStatement); + // Bind version properties from configuration (after guard, default already set before guard) + if (LatestVersionsFields != null && VersionProperties != null) + { + foreach (var (_, serviceVersionEnum) in LatestVersionsFields) + { + if (VersionProperties.TryGetValue(serviceVersionEnum, out var versionProperty)) + { + // if (section["VersionPropertyName"] is string version) { Version = version; } + var versionVarDecl = Declare(versionProperty.Name.ToVariableName(), new CSharpType(typeof(string)), out var versionVar); + var ifVersionStatement = new IfStatement(new IndexerExpression(sectionParam, Literal(versionProperty.Name)).Is(versionVarDecl)); + ifVersionStatement.Add(This.Property(versionProperty.Name).Assign(versionVar).Terminate()); + body.Add(ifVersionStatement); + } + } + } + // Build a set of version property names for O(1) lookup var versionPropertyNames = VersionProperties?.Values.Select(vp => vp.Name).ToHashSet(); diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Providers/ClientProvider.cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Providers/ClientProvider.cs index 234882ccf76..9e7f7f4c4d6 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Providers/ClientProvider.cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Providers/ClientProvider.cs @@ -381,7 +381,7 @@ protected override FieldProvider[] BuildFields() if (_apiKeyAuthFields != null) { - fields.Add(_apiKeyAuthFields.AuthField); + // No longer add AuthField (_keyCredential) — auth is handled via AuthenticationPolicy parameter in the internal constructor fields.Add(_apiKeyAuthFields.AuthorizationHeaderField); if (_apiKeyAuthFields.AuthorizationApiKeyPrefixField != null) { @@ -391,7 +391,7 @@ protected override FieldProvider[] BuildFields() if (_oauth2Fields != null) { - fields.Add(_oauth2Fields.AuthField); + // No longer add AuthField (_tokenProvider) — auth is handled via AuthenticationPolicy parameter in the internal constructor fields.Add(_oauth2Fields.AuthorizationScopesField); } @@ -585,15 +585,40 @@ void AppendConstructors( List secondaryConstructors, bool onlyContainsUnsupportedAuth = false) { + // The internal implementation constructor takes AuthenticationPolicy? as first parameter. + var authPolicyParam = new ParameterProvider( + "authenticationPolicy", + $"The authentication policy to use for pipeline creation.", + new CSharpType(typeof(AuthenticationPolicy), isNullable: true)); + + // Non-auth required parameters (all required non-endpoint params except auth credential) + var requiredNonAuthParams = GetRequiredParameters(null); + ParameterProvider[] internalConstructorParameters = [authPolicyParam, _endpointParameter, .. requiredNonAuthParams, ClientOptionsParameter]; + + // Internal constructor is the sole implementation constructor + var internalConstructor = new ConstructorProvider( + new ConstructorSignature(Type, _publicCtorDescription, MethodSignatureModifiers.Internal, internalConstructorParameters), + BuildPrimaryConstructorBody(internalConstructorParameters, authFields, authPolicyParam, ClientOptions, ClientOptionsParameter), + this); + primaryConstructors.Add(internalConstructor); + + // Public constructor with credential parameter — delegates to the internal constructor. var requiredParameters = GetRequiredParameters(authFields?.AuthField); ParameterProvider[] primaryConstructorParameters = [_endpointParameter, .. requiredParameters, ClientOptionsParameter]; - // If auth exists but it's not supported, we will make the constructor internal. var constructorModifier = onlyContainsUnsupportedAuth ? MethodSignatureModifiers.Internal : MethodSignatureModifiers.Public; + + // Build the auth policy expression for the this() initializer + ValueExpression authPolicyArg = BuildAuthPolicyArgument(authFields, requiredParameters); + var initializerArgs = new List { authPolicyArg, _endpointParameter }; + foreach (var p in requiredNonAuthParams) + initializerArgs.Add(p); + initializerArgs.Add(ClientOptionsParameter!); + var primaryConstructor = new ConstructorProvider( - new ConstructorSignature(Type, _publicCtorDescription, constructorModifier, primaryConstructorParameters), - BuildPrimaryConstructorBody(primaryConstructorParameters, authFields, ClientOptions, ClientOptionsParameter), + new ConstructorSignature(Type, _publicCtorDescription, constructorModifier, primaryConstructorParameters, + initializer: new ConstructorInitializer(false, initializerArgs)), + MethodBodyStatement.Empty, this); - primaryConstructors.Add(primaryConstructor); // If the endpoint parameter contains an initialization value, it is not required. @@ -627,9 +652,15 @@ private IEnumerable BuildSettingsConstructors() var settingsParam = new ParameterProvider("settings", $"The settings for {Name}.", ClientSettings.Type); var experimentalAttr = new AttributeStatement(typeof(ExperimentalAttribute), [Literal(ClientSettingsProvider.ClientSettingsDiagnosticId)]); - // Build the arguments for the this(...) initializer to call primary constructor + // Build the arguments for the this(...) internal constructor initializer: + // this(AuthenticationPolicy.Create(settings), settings?.Endpoint, otherParams..., settings?.Options) var args = new List(); + // auth policy argument: AuthenticationPolicy.Create(settings) +#pragma warning disable SCME0002 + args.Add(Static(typeof(AuthenticationPolicy)).Invoke("Create", settingsParam)); +#pragma warning restore SCME0002 + // endpoint argument - we know EndpointPropertyName is not null at this point args.Add(new MemberExpression(new NullConditionalExpression(settingsParam), ClientSettings.EndpointPropertyName)); @@ -645,23 +676,6 @@ private IEnumerable BuildSettingsConstructors() args.Add(arg); } - // credential argument - if (_oauth2Fields != null) - { - var credentialExpr = new MemberExpression(new NullConditionalExpression(settingsParam), "CredentialProvider"); - args.Add(new AsExpression(credentialExpr, _oauth2Fields.AuthField.Type)); - } - else if (_apiKeyAuthFields != null) - { - // settings?.Credential?.Key != null ? new ApiKeyCredential(settings?.Credential?.Key) : null - var credentialExpr = new MemberExpression(new NullConditionalExpression(settingsParam), "Credential"); - var keyExpr = new MemberExpression(new NullConditionalExpression(credentialExpr), "Key"); - var keyNotNull = new BinaryOperatorExpression("!=", keyExpr, Null); - var newApiKeyCredExpr = New.Instance(_apiKeyAuthFields.AuthField.Type, - new MemberExpression(new NullConditionalExpression(new MemberExpression(new NullConditionalExpression(settingsParam), "Credential")), "Key")); - args.Add(new TernaryConditionalExpression(keyNotNull, newApiKeyCredExpr, Null)); - } - // options argument args.Add(new MemberExpression(new NullConditionalExpression(settingsParam), "Options")); @@ -728,7 +742,7 @@ void AppendSubClientPublicConstructorsForAuth( ParameterProvider[] primaryConstructorParameters = [_endpointParameter, .. requiredParameters, clientOptionsParameter]; var primaryConstructor = new ConstructorProvider( new ConstructorSignature(Type, _publicCtorDescription, MethodSignatureModifiers.Public, primaryConstructorParameters), - BuildPrimaryConstructorBody(primaryConstructorParameters, authFields, clientOptionsProvider, clientOptionsParameter), + BuildPrimaryConstructorBody(primaryConstructorParameters, authFields, null, clientOptionsProvider, clientOptionsParameter), this); primaryConstructors.Add(primaryConstructor); @@ -801,7 +815,7 @@ private IReadOnlyList GetRequiredParameters(FieldProvider? au return param; } - private MethodBodyStatement[] BuildPrimaryConstructorBody(IReadOnlyList primaryConstructorParameters, AuthFields? authFields, ClientOptionsProvider? clientOptionsProvider, ParameterProvider? clientOptionsParameter) + private MethodBodyStatement[] BuildPrimaryConstructorBody(IReadOnlyList primaryConstructorParameters, AuthFields? authFields, ParameterProvider? authPolicyParam, ClientOptionsProvider? clientOptionsProvider, ParameterProvider? clientOptionsParameter) { if (clientOptionsProvider is null || clientOptionsParameter is null) { @@ -846,20 +860,29 @@ private MethodBodyStatement[] BuildPrimaryConstructorBody(IReadOnlyList().KeyAuthorizationPolicy(keyAuthFields.AuthField, keyAuthFields.AuthorizationHeaderField, keyPrefixExpression)); - perRetryPolicies = New.Array(ScmCodeModelGenerator.Instance.TypeFactory.ClientPipelineApi.PipelinePolicyType, isInline: true, [.. perRetryPoliciesList]); - break; - case OAuth2Fields oauth2AuthFields: - perRetryPoliciesList.Add(This.ToApi().TokenAuthorizationPolicy(oauth2AuthFields.AuthField, oauth2AuthFields.AuthorizationScopesField)); - perRetryPolicies = New.Array(ScmCodeModelGenerator.Instance.TypeFactory.ClientPipelineApi.PipelinePolicyType, isInline: true, [.. perRetryPoliciesList]); - break; - default: - perRetryPolicies = New.Array(ScmCodeModelGenerator.Instance.TypeFactory.ClientPipelineApi.PipelinePolicyType, isInline: true, [.. perRetryPoliciesList]); - break; + // Internal implementation constructor: use the authenticationPolicy parameter directly + perRetryPoliciesList.Add(authPolicyParam); + perRetryPolicies = New.Array(ScmCodeModelGenerator.Instance.TypeFactory.ClientPipelineApi.PipelinePolicyType, isInline: true, [.. perRetryPoliciesList]); + } + else + { + switch (authFields) + { + case ApiKeyFields keyAuthFields: + ValueExpression? keyPrefixExpression = keyAuthFields.AuthorizationApiKeyPrefixField != null ? (ValueExpression)keyAuthFields.AuthorizationApiKeyPrefixField : null; + perRetryPoliciesList.Add(This.ToApi().KeyAuthorizationPolicy(keyAuthFields.AuthField, keyAuthFields.AuthorizationHeaderField, keyPrefixExpression)); + perRetryPolicies = New.Array(ScmCodeModelGenerator.Instance.TypeFactory.ClientPipelineApi.PipelinePolicyType, isInline: true, [.. perRetryPoliciesList]); + break; + case OAuth2Fields oauth2AuthFields: + perRetryPoliciesList.Add(This.ToApi().TokenAuthorizationPolicy(oauth2AuthFields.AuthField, oauth2AuthFields.AuthorizationScopesField)); + perRetryPolicies = New.Array(ScmCodeModelGenerator.Instance.TypeFactory.ClientPipelineApi.PipelinePolicyType, isInline: true, [.. perRetryPoliciesList]); + break; + default: + perRetryPolicies = New.Array(ScmCodeModelGenerator.Instance.TypeFactory.ClientPipelineApi.PipelinePolicyType, isInline: true, [.. perRetryPoliciesList]); + break; + } } body.Add(PipelineProperty.Assign(This.ToApi().Create(clientOptionsParameter, perRetryPolicies)).Terminate()); @@ -876,6 +899,37 @@ private MethodBodyStatement[] BuildPrimaryConstructorBody(IReadOnlyList + /// Builds the ValueExpression for the AuthenticationPolicy argument passed to the internal constructor initializer. + /// + private ValueExpression BuildAuthPolicyArgument(AuthFields? authFields, IReadOnlyList requiredParameters) + { + if (authFields is ApiKeyFields keyFields) + { + // ApiKeyAuthenticationPolicy.CreateHeaderApiKeyPolicy(credential, AuthorizationHeader, prefix?) + var credParam = requiredParameters.FirstOrDefault(p => p.Name == "credential"); + if (credParam != null) + { + ValueExpression? keyPrefixExpression = keyFields.AuthorizationApiKeyPrefixField != null ? (ValueExpression)keyFields.AuthorizationApiKeyPrefixField : null; + return This.ToApi().KeyAuthorizationPolicy(credParam, keyFields.AuthorizationHeaderField, keyPrefixExpression); + } + } + else if (authFields is OAuth2Fields oauth2Fields) + { + // new BearerTokenPolicy(tokenProvider, AuthorizationScopes) + // The param name is derived from the field name: _tokenProvider → tokenProvider, _tokenCredential → credential + var credParam = requiredParameters.FirstOrDefault(p => + p.Name == TokenProviderFieldName.TrimStart('_') || + p.Name == "credential"); + if (credParam != null) + { + return This.ToApi().TokenAuthorizationPolicy(credParam, oauth2Fields.AuthorizationScopesField); + } + } + + return Null; + } + /// /// Builds the secondary constructor for the client. The secondary constructor contains all required parameters as arguments. /// diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Providers/ClientSettingsProvider.cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Providers/ClientSettingsProvider.cs index 8af94ae65e0..febe6ca2e90 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Providers/ClientSettingsProvider.cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Providers/ClientSettingsProvider.cs @@ -115,13 +115,16 @@ protected override MethodProvider[] BuildMethods() { var endpointPropertyName = EndpointPropertyName!; - // string? endpoint = section["EndpointPropertyName"]; - var endpointVar = new VariableExpression(new CSharpType(typeof(string), isNullable: true), "endpoint"); - body.Add(Declare(endpointVar, new IndexerExpression(sectionParam, Literal(endpointPropertyName)))); - - // if (!string.IsNullOrEmpty(endpoint)) { EndpointProperty = new Uri(endpoint); } - var ifStatement = new IfStatement(Not(Static(typeof(string)).Invoke("IsNullOrEmpty", endpointVar))); - ifStatement.Add(This.Property(endpointPropertyName).Assign(New.Instance(typeof(Uri), endpointVar)).Terminate()); + // if (Uri.TryCreate(section["EndpointPropertyName"], UriKind.Absolute, out Uri varName)) { EndpointProperty = varName; } + var outUriDecl = new DeclarationExpression(typeof(Uri), endpointPropertyName.ToVariableName(), out var uriVar, isOut: true); + var ifStatement = new IfStatement(Static(typeof(Uri)).Invoke("TryCreate", + new ValueExpression[] + { + new IndexerExpression(sectionParam, Literal(endpointPropertyName)), + new MemberExpression(typeof(UriKind), nameof(UriKind.Absolute)), + outUriDecl + })); + ifStatement.Add(This.Property(endpointPropertyName).Assign(uriVar).Terminate()); body.Add(ifStatement); } diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientProviders/ClientProviderTests.cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientProviders/ClientProviderTests.cs index 3f5bf0e4a88..73f28a26192 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientProviders/ClientProviderTests.cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientProviders/ClientProviderTests.cs @@ -160,31 +160,34 @@ public void TestBuildAuthFields_WithAuth(List inputParameters) if (_hasKeyAuth) { - // key auth should have the following fields: AuthorizationHeader, _keyCredential + // key auth should have the AuthorizationHeader const field; _keyCredential is no longer stored AssertHasFields(clientProvider, new List { new(FieldModifiers.Private | FieldModifiers.Const, new CSharpType(typeof(string)), "AuthorizationHeader"), - new(FieldModifiers.Private | FieldModifiers.ReadOnly, new CSharpType(typeof(ApiKeyCredential)), "_keyCredential") }); + // _keyCredential field is no longer on the client (auth handled via AuthenticationPolicy parameter) + Assert.IsFalse(clientProvider.Fields.Any(f => f.Name == "_keyCredential")); } if (_hasOAuth2) { - // oauth2 auth should have the following fields: _flows, _tokenProvider + // oauth2 auth should have the _flows field; _tokenProvider is no longer stored AssertHasFields(clientProvider, new List { new(FieldModifiers.Private | FieldModifiers.ReadOnly, new CSharpType(typeof(Dictionary[])), "_flows"), - new(FieldModifiers.Private | FieldModifiers.ReadOnly, new CSharpType(typeof(AuthenticationTokenProvider)), "_tokenProvider"), }); + // _tokenProvider field is no longer on the client (auth handled via AuthenticationPolicy parameter) + Assert.IsFalse(clientProvider.Fields.Any(f => f.Name == "_tokenProvider")); } if (_hasOAuth2WithOtherCredType) { - // if another cred type other than the SCM type is used, then the client should default to the following fields: _scopes, _tokenCredential + // if another cred type other than the SCM type is used, then the client should default to the following fields: _scopes (no _tokenCredential) AssertHasFields(clientProvider, new List { new(FieldModifiers.Private | FieldModifiers.Static | FieldModifiers.ReadOnly, new CSharpType(typeof(string[])), "AuthorizationScopes"), - new(FieldModifiers.Private | FieldModifiers.ReadOnly, new CSharpType(typeof(FakeTokenCredential)), "_tokenCredential"), }); + // _tokenCredential field is no longer on the client (auth handled via AuthenticationPolicy parameter) + Assert.IsFalse(clientProvider.Fields.Any(f => f.Name == "_tokenCredential")); } if (_hasOnlyUnsupportedAuth) @@ -206,12 +209,12 @@ public void TestBuildOAuth2FlowsField(IEnumerable inputFlows) Assert.IsNotNull(clientProvider); - // oauth2 auth should have the following fields: _flows, _tokenProvider + // oauth2 auth should have the _flows field; _tokenProvider is no longer stored on the client AssertHasFields(clientProvider, new List { - new(FieldModifiers.Private | FieldModifiers.ReadOnly, new CSharpType(typeof(AuthenticationTokenProvider)), "_tokenProvider"), new(FieldModifiers.Private | FieldModifiers.ReadOnly, new CSharpType(typeof(Dictionary[])), "_flows"), }); + Assert.IsFalse(clientProvider.Fields.Any(f => f.Name == "_tokenProvider"), "_tokenProvider should not be present - auth handled via AuthenticationPolicy parameter"); // validate the field initialization var testName = TestContext.CurrentContext.Test.Name; @@ -298,29 +301,29 @@ public void TestBuildAuthFields_WithSubClients_WithAuth(InputClient client) if (_hasKeyAuth) { - // key auth should have the following fields: AuthorizationHeader, _keyCredential + // key auth should have AuthorizationHeader const field; _keyCredential is no longer stored AssertHasFields(clientProvider, new List { new(FieldModifiers.Private | FieldModifiers.Const, new CSharpType(typeof(string)), "AuthorizationHeader"), - new(FieldModifiers.Private | FieldModifiers.ReadOnly, new CSharpType(typeof(ApiKeyCredential)), "_keyCredential") }); + Assert.IsFalse(clientProvider.Fields.Any(f => f.Name == "_keyCredential")); } if (_hasOAuth2) { - // oauth2 auth should have the following fields: _flows, _tokenProvider + // oauth2 auth should have _flows field; _tokenProvider is no longer stored AssertHasFields(clientProvider, new List { new(FieldModifiers.Private | FieldModifiers.ReadOnly, new CSharpType(typeof(Dictionary[])), "_flows"), - new(FieldModifiers.Private | FieldModifiers.ReadOnly, new CSharpType(typeof(AuthenticationTokenProvider)), "_tokenProvider"), }); + Assert.IsFalse(clientProvider.Fields.Any(f => f.Name == "_tokenProvider")); } if (_hasOAuth2WithOtherCredType) { AssertHasFields(clientProvider, new List { new(FieldModifiers.Private | FieldModifiers.Static | FieldModifiers.ReadOnly, new CSharpType(typeof(string[])), "AuthorizationScopes"), - new(FieldModifiers.Private | FieldModifiers.ReadOnly, new CSharpType(typeof(FakeTokenCredential)), "_tokenCredential"), }); + Assert.IsFalse(clientProvider.Fields.Any(f => f.Name == "_tokenCredential")); } } @@ -366,26 +369,19 @@ public void TestBuildConstructors_PrimaryConstructor(List inputP var constructors = clientProvider.Constructors; - var primaryPublicConstructors = constructors.Where( - c => c.Signature?.Initializer == null && c.Signature?.Modifiers == MethodSignatureModifiers.Public).ToArray(); + // The implementation constructors are now INTERNAL (taking AuthenticationPolicy? as first param) + var implementationConstructors = constructors.Where( + c => c.Signature?.Initializer == null && c.Signature?.Modifiers == MethodSignatureModifiers.Internal).ToArray(); // for no auth or one auth case, this should be 1 // for both auth case, this should be 2 - // for only unsupported auth case, this should be 0 - int expectedPrimaryCtorCount; - if (_hasOnlyUnsupportedAuth) - { - expectedPrimaryCtorCount = 0; - } - else - { - expectedPrimaryCtorCount = _hasKeyAuth && _hasOAuth2 ? 2 : 1; - } - Assert.AreEqual(expectedPrimaryCtorCount, primaryPublicConstructors.Length); + // for only unsupported auth case, this should be 1 (still has internal implementation ctor) + int expectedImplCtorCount = _hasKeyAuth && _hasOAuth2 ? 2 : 1; + Assert.AreEqual(expectedImplCtorCount, implementationConstructors.Length); - for (int i = 0; i < primaryPublicConstructors.Length; i++) + for (int i = 0; i < implementationConstructors.Length; i++) { - ValidatePrimaryConstructor(primaryPublicConstructors[i], inputParameters, i); + ValidatePrimaryConstructor(implementationConstructors[i], inputParameters, i); } } @@ -404,12 +400,14 @@ public void TestBuildConstructors_SecondaryConstructor(List inpu var constructors = clientProvider.Constructors; - var primaryPublicConstructors = constructors.Where( - c => c.Signature?.Initializer == null && c.Signature?.Modifiers == MethodSignatureModifiers.Public).ToArray(); + var implementationConstructors = constructors.Where( + c => c.Signature?.Initializer == null && c.Signature?.Modifiers == MethodSignatureModifiers.Internal).ToArray(); var secondaryPublicConstructors = constructors.Where( c => c.Signature?.Initializer != null && c.Signature?.Modifiers == MethodSignatureModifiers.Public && - !IsSettingsConstructor(c)).ToArray(); + !IsSettingsConstructor(c) && + !IsPrimaryPassThroughConstructor(c)).ToArray(); + var primaryPassThroughConstructors = constructors.Where(IsPrimaryPassThroughConstructor).ToArray(); // Check if endpoint has a default value var endpointParam = inputParameters.FirstOrDefault(p => p is InputEndpointParameter ep && ep.IsEndpoint); @@ -449,7 +447,7 @@ public void TestBuildConstructors_SecondaryConstructor(List inpu Assert.AreEqual(expectedSecondaryCtorCount, secondaryPublicConstructors.Length); foreach (var secondaryPublicConstructor in secondaryPublicConstructors) { - ValidateSecondaryConstructor(primaryPublicConstructors, secondaryPublicConstructor, inputParameters); + ValidateSecondaryConstructor(primaryPassThroughConstructors, secondaryPublicConstructor, inputParameters); } } @@ -545,11 +543,12 @@ public void TestBuildConstructors_SimplifiedWithOptions_WhenDefaultEndpoint() var constructors = clientProvider.Constructors; - // Get all public constructors with an initializer (secondary constructors), excluding settings constructor + // Get secondary constructors (not primary pass-through, not settings constructor) var secondaryPublicConstructors = constructors.Where( c => c.Signature?.Initializer != null && c.Signature?.Modifiers == MethodSignatureModifiers.Public && - !IsSettingsConstructor(c)).ToList(); + !IsSettingsConstructor(c) && + !IsPrimaryPassThroughConstructor(c)).ToList(); // We should have 2 secondary constructors per auth type: // 1. Client(credential) - simple with just auth @@ -915,15 +914,18 @@ private void ValidatePrimaryConstructor( [CallerFilePath] string filePath = "") { var primaryCtorParams = primaryPublicConstructor?.Signature?.Parameters; - // in no auth case, the ctor only have two parameters: endpoint and options - // in other cases, the ctor should have three parameters: endpoint, credential, options - // specifically, in both auth cases, we should have two ctors corresponding to each credential type as the second parameter - var expectedPrimaryCtorParamCount = !_hasKeyAuth && !_hasOAuth2 ? 2 : 3; + // The internal implementation constructor always has 3 parameters: authenticationPolicy, endpoint, options + var expectedPrimaryCtorParamCount = 3; Assert.AreEqual(expectedPrimaryCtorParamCount, primaryCtorParams?.Count); - // the first should be endpoint - var endpointParam = primaryCtorParams?[0]; + // the first should be authenticationPolicy (AuthenticationPolicy?) + var authPolicyParam = primaryCtorParams?[0]; + Assert.AreEqual("authenticationPolicy", authPolicyParam?.Name); + Assert.IsTrue(authPolicyParam?.Type.Equals(new CSharpType(typeof(AuthenticationPolicy), isNullable: true))); + + // the second should be endpoint + var endpointParam = primaryCtorParams?[1]; Assert.AreEqual(KnownParameters.Endpoint.Name, endpointParam?.Name); if (endpointParam?.DefaultValue != null) @@ -938,25 +940,6 @@ private void ValidatePrimaryConstructor( var optionsParam = primaryCtorParams?[^1]; Assert.AreEqual("options", optionsParam?.Name); - if (_hasSupportedAuth) - { - // when there is any auth, the second should be auth parameter - var authParam = primaryCtorParams?[1]; - Assert.IsNotNull(authParam); - if (authParam?.Type.Equals(typeof(ApiKeyCredential)) == true) - { - Assert.AreEqual("credential", authParam.Name); - } - else if (authParam?.Type.Equals(typeof(AuthenticationTokenProvider)) == true) - { - Assert.AreEqual("tokenProvider", authParam.Name); - } - else - { - Assert.Fail("Unexpected auth parameter"); - } - } - // validate the body of the primary ctor var caseName = TestContext.CurrentContext.Test.Properties.Get("caseName"); var expected = Helpers.GetExpectedFromFile($"{caseName},{_hasKeyAuth},{_hasOAuth2},{ctorIndex}", method, filePath); @@ -1033,6 +1016,18 @@ private static bool IsSettingsConstructor(ConstructorProvider c) => c.Signature?.Modifiers == MethodSignatureModifiers.Public && c.Signature.Parameters.Any(p => p.Name == "settings"); + /// + /// Identifies the public primary pass-through constructor (calls the internal implementation constructor). + /// It is the public constructor that has both an endpoint parameter AND an options parameter. + /// Secondary constructors never have both endpoint and options (they have a subset). + /// + private static bool IsPrimaryPassThroughConstructor(ConstructorProvider c) => + c.Signature?.Initializer != null && + c.Signature?.Modifiers == MethodSignatureModifiers.Public && + !IsSettingsConstructor(c) && + c.Signature.Parameters.Any(p => p.Name == KnownParameters.Endpoint.Name) && + c.Signature.Parameters.Any(p => p.Name == "options"); + [TestCaseSource(nameof(EndpointParamInitializationValueTestCases))] public void EndpointInitializationValue(InputParameter endpointParameter, ValueExpression? expectedValue) { @@ -1042,7 +1037,7 @@ public void EndpointInitializationValue(InputParameter endpointParameter, ValueE Assert.IsNotNull(clientProvider); // find the endpoint parameter from the primary constructor var primaryConstructor = clientProvider.Constructors.FirstOrDefault( - c => c.Signature?.Initializer == null && c.Signature?.Modifiers == MethodSignatureModifiers.Public); + c => c.Signature?.Initializer == null && c.Signature?.Modifiers == MethodSignatureModifiers.Internal); var endpoint = primaryConstructor?.Signature?.Parameters?.FirstOrDefault(p => p.Name == KnownParameters.Endpoint.Name); Assert.IsNotNull(endpoint); @@ -1304,7 +1299,7 @@ public void TestApiVersionOfClient() /* verify the apiVersion assignment in constructor body */ var primaryConstructor = clientProvider.Constructors.FirstOrDefault( - c => c.Signature?.Initializer == null && c.Signature?.Modifiers == MethodSignatureModifiers.Public); + c => c.Signature?.Initializer == null && c.Signature?.Modifiers == MethodSignatureModifiers.Internal); Assert.IsNotNull(primaryConstructor); var bodyStatements = primaryConstructor?.BodyStatements as MethodBodyStatements; Assert.IsNotNull(bodyStatements); @@ -1341,7 +1336,7 @@ public void TestApiVersionPathParameterOfClient(InputClient inputClient) /* verify the apiVersion assignment in constructor body */ var primaryConstructor = clientProvider.Constructors.FirstOrDefault( - c => c.Signature?.Initializer == null && c.Signature?.Modifiers == MethodSignatureModifiers.Public); + c => c.Signature?.Initializer == null && c.Signature?.Modifiers == MethodSignatureModifiers.Internal); Assert.IsNotNull(primaryConstructor); var bodyStatements = primaryConstructor?.BodyStatements as MethodBodyStatements; Assert.IsNotNull(bodyStatements); @@ -1515,7 +1510,7 @@ public void EndpointFieldAssignedFromUriParameter() isEndpoint: true)]); var clientProvider = new ClientProvider(client); var constructor = clientProvider.Constructors.FirstOrDefault( - c => c.Signature.Initializer == null && c.Signature?.Modifiers == MethodSignatureModifiers.Public); + c => c.Signature.Initializer == null && c.Signature?.Modifiers == MethodSignatureModifiers.Internal); StringAssert.Contains("_endpoint = endpoint;", constructor?.BodyStatements?.ToDisplayString()); } @@ -1536,7 +1531,7 @@ public void EndpointFieldAssignedFromStringParameter(string serverTemplate, stri isEndpoint: true)]); var clientProvider = new ClientProvider(client); var constructor = clientProvider.Constructors.FirstOrDefault( - c => c.Signature.Initializer == null && c.Signature?.Modifiers == MethodSignatureModifiers.Public); + c => c.Signature.Initializer == null && c.Signature?.Modifiers == MethodSignatureModifiers.Internal); StringAssert.Contains($"_endpoint = new global::System.Uri($\"{serverTemplate}\");", constructor?.BodyStatements?.ToDisplayString()); } @@ -3610,7 +3605,7 @@ public void ConvertUriTemplate_CaseInsensitiveEndpointLookup(string serverTempla isEndpoint: true)]); var clientProvider = new ClientProvider(client); var constructor = clientProvider.Constructors.FirstOrDefault( - c => c.Signature.Initializer == null && c.Signature?.Modifiers == MethodSignatureModifiers.Public); + c => c.Signature.Initializer == null && c.Signature?.Modifiers == MethodSignatureModifiers.Internal); Assert.IsNotNull(constructor); // Should not throw and should contain the Uri assignment @@ -3644,7 +3639,7 @@ public void ConvertUriTemplate_CaseInsensitivePathParameterLookup() ]); var clientProvider = new ClientProvider(client); var constructor = clientProvider.Constructors.FirstOrDefault( - c => c.Signature.Initializer == null && c.Signature?.Modifiers == MethodSignatureModifiers.Public); + c => c.Signature.Initializer == null && c.Signature?.Modifiers == MethodSignatureModifiers.Internal); Assert.IsNotNull(constructor); // Should not throw - case-insensitive lookup should find parameters @@ -3685,7 +3680,7 @@ public void ConvertUriTemplate_WithMultiplePlaceholders() ]); var clientProvider = new ClientProvider(client); var constructor = clientProvider.Constructors.FirstOrDefault( - c => c.Signature.Initializer == null && c.Signature?.Modifiers == MethodSignatureModifiers.Public); + c => c.Signature.Initializer == null && c.Signature?.Modifiers == MethodSignatureModifiers.Internal); Assert.IsNotNull(constructor); var bodyText = constructor!.BodyStatements!.ToDisplayString(); From e88dd8152e1f0eca6974a6df204cf95a42d31d70 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 11 Mar 2026 00:11:53 +0000 Subject: [PATCH 09/38] fix: update TestData files for internal AuthenticationPolicy constructor pattern Co-authored-by: JoshLove-msft <54595583+JoshLove-msft@users.noreply.github.com> --- ...ltiServiceClient_GeneratesExpectedClient.cs | 9 +++++---- ...ithThreeServices_GeneratesExpectedClient.cs | 9 +++++---- ...ceCombinedClient_GeneratesExpectedClient.cs | 8 +++++--- ...ithThreeServices_GeneratesExpectedClient.cs | 8 +++++--- ...ryConstructor(WithDefault,False,False,0).cs | 2 -- ...aryConstructor(WithDefault,False,True,0).cs | 6 +----- ...aryConstructor(WithDefault,True,False,0).cs | 6 +----- ...maryConstructor(WithDefault,True,True,0).cs | 6 +----- ...maryConstructor(WithDefault,True,True,1).cs | 6 +----- ...yConstructor(WithRequired,False,False,0).cs | 2 -- ...ryConstructor(WithRequired,False,True,0).cs | 6 +----- ...ryConstructor(WithRequired,True,False,0).cs | 6 +----- ...aryConstructor(WithRequired,True,True,0).cs | 6 +----- ...aryConstructor(WithRequired,True,True,1).cs | 6 +----- .../ValidateConstructorsWhenUnsupportedAuth.cs | 6 +++++- .../ClientProviderTests/XmlDocsAreWritten.cs | 18 ++++++++++++------ ...iceClient_GeneratesExpectedClientOptions.cs | 8 ++++++++ ...eServices_GeneratesExpectedClientOptions.cs | 12 ++++++++++++ ...nedClient_GeneratesExpectedClientOptions.cs | 8 ++++++++ ...eServices_GeneratesExpectedClientOptions.cs | 12 ++++++++++++ packages/http-client-csharp/global.json | 7 +------ 21 files changed, 86 insertions(+), 71 deletions(-) diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientProviders/TestData/ClientProviderTests/MultiServiceClient_GeneratesExpectedClient.cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientProviders/TestData/ClientProviderTests/MultiServiceClient_GeneratesExpectedClient.cs index b650c53a695..fb7350c4adb 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientProviders/TestData/ClientProviderTests/MultiServiceClient_GeneratesExpectedClient.cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientProviders/TestData/ClientProviderTests/MultiServiceClient_GeneratesExpectedClient.cs @@ -27,11 +27,8 @@ protected TestClient() { } - public TestClient(global::System.Uri endpoint, string subscriptionId, global::Sample.TestClientOptions options) + internal TestClient(global::System.ClientModel.Primitives.AuthenticationPolicy authenticationPolicy, global::System.Uri endpoint, string subscriptionId, global::Sample.TestClientOptions options) { - global::Sample.Argument.AssertNotNull(endpoint, nameof(endpoint)); - global::Sample.Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - options ??= new global::Sample.TestClientOptions(); _endpoint = endpoint; @@ -41,6 +38,10 @@ public TestClient(global::System.Uri endpoint, string subscriptionId, global::Sa _serviceBApiVersion = options.ServiceBApiVersion; } + public TestClient(global::System.Uri endpoint, string subscriptionId, global::Sample.TestClientOptions options) : this(null, endpoint, subscriptionId0, options) + { + } + public global::System.ClientModel.Primitives.ClientPipeline Pipeline { get; } public virtual global::Sample.ServiceA.ServiceA GetServiceAClient() diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientProviders/TestData/ClientProviderTests/MultiServiceClient_WithThreeServices_GeneratesExpectedClient.cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientProviders/TestData/ClientProviderTests/MultiServiceClient_WithThreeServices_GeneratesExpectedClient.cs index ae8e7b8d8ae..3ea30fbed04 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientProviders/TestData/ClientProviderTests/MultiServiceClient_WithThreeServices_GeneratesExpectedClient.cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientProviders/TestData/ClientProviderTests/MultiServiceClient_WithThreeServices_GeneratesExpectedClient.cs @@ -30,11 +30,8 @@ protected TestClient() { } - public TestClient(global::System.Uri endpoint, string subscriptionId, global::Sample.TestClientOptions options) + internal TestClient(global::System.ClientModel.Primitives.AuthenticationPolicy authenticationPolicy, global::System.Uri endpoint, string subscriptionId, global::Sample.TestClientOptions options) { - global::Sample.Argument.AssertNotNull(endpoint, nameof(endpoint)); - global::Sample.Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - options ??= new global::Sample.TestClientOptions(); _endpoint = endpoint; @@ -45,6 +42,10 @@ public TestClient(global::System.Uri endpoint, string subscriptionId, global::Sa _serviceStorageApiVersion = options.ServiceStorageApiVersion; } + public TestClient(global::System.Uri endpoint, string subscriptionId, global::Sample.TestClientOptions options) : this(null, endpoint, subscriptionId0, options) + { + } + public global::System.ClientModel.Primitives.ClientPipeline Pipeline { get; } public virtual global::Sample.KeyVault.KeyVault GetKeyVaultClient() diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientProviders/TestData/ClientProviderTests/MultiServiceCombinedClient_GeneratesExpectedClient.cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientProviders/TestData/ClientProviderTests/MultiServiceCombinedClient_GeneratesExpectedClient.cs index 7ca9e6f204f..41edc840d81 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientProviders/TestData/ClientProviderTests/MultiServiceCombinedClient_GeneratesExpectedClient.cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientProviders/TestData/ClientProviderTests/MultiServiceCombinedClient_GeneratesExpectedClient.cs @@ -24,10 +24,8 @@ protected TestClient() { } - public TestClient(global::System.Uri endpoint, global::Sample.TestClientOptions options) + internal TestClient(global::System.ClientModel.Primitives.AuthenticationPolicy authenticationPolicy, global::System.Uri endpoint, global::Sample.TestClientOptions options) { - global::Sample.Argument.AssertNotNull(endpoint, nameof(endpoint)); - options ??= new global::Sample.TestClientOptions(); _endpoint = endpoint; @@ -36,6 +34,10 @@ public TestClient(global::System.Uri endpoint, global::Sample.TestClientOptions _serviceBApiVersion = options.ServiceBApiVersion; } + public TestClient(global::System.Uri endpoint, global::Sample.TestClientOptions options) : this(null, endpoint, options) + { + } + public global::System.ClientModel.Primitives.ClientPipeline Pipeline { get; } public virtual global::System.ClientModel.ClientResult ServiceAOperation(global::System.ClientModel.Primitives.RequestOptions options) diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientProviders/TestData/ClientProviderTests/MultiServiceCombinedClient_WithThreeServices_GeneratesExpectedClient.cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientProviders/TestData/ClientProviderTests/MultiServiceCombinedClient_WithThreeServices_GeneratesExpectedClient.cs index dcb06d16e99..fcd64b4ae27 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientProviders/TestData/ClientProviderTests/MultiServiceCombinedClient_WithThreeServices_GeneratesExpectedClient.cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientProviders/TestData/ClientProviderTests/MultiServiceCombinedClient_WithThreeServices_GeneratesExpectedClient.cs @@ -25,10 +25,8 @@ protected TestClient() { } - public TestClient(global::System.Uri endpoint, global::Sample.TestClientOptions options) + internal TestClient(global::System.ClientModel.Primitives.AuthenticationPolicy authenticationPolicy, global::System.Uri endpoint, global::Sample.TestClientOptions options) { - global::Sample.Argument.AssertNotNull(endpoint, nameof(endpoint)); - options ??= new global::Sample.TestClientOptions(); _endpoint = endpoint; @@ -38,6 +36,10 @@ public TestClient(global::System.Uri endpoint, global::Sample.TestClientOptions _serviceStorageApiVersion = options.ServiceStorageApiVersion; } + public TestClient(global::System.Uri endpoint, global::Sample.TestClientOptions options) : this(null, endpoint, options) + { + } + public global::System.ClientModel.Primitives.ClientPipeline Pipeline { get; } public virtual global::System.ClientModel.ClientResult KeyVaultOperation(global::System.ClientModel.Primitives.RequestOptions options) diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientProviders/TestData/ClientProviderTests/TestBuildConstructors_PrimaryConstructor(WithDefault,False,False,0).cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientProviders/TestData/ClientProviderTests/TestBuildConstructors_PrimaryConstructor(WithDefault,False,False,0).cs index bc5bbc28eac..855b9b946aa 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientProviders/TestData/ClientProviderTests/TestBuildConstructors_PrimaryConstructor(WithDefault,False,False,0).cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientProviders/TestData/ClientProviderTests/TestBuildConstructors_PrimaryConstructor(WithDefault,False,False,0).cs @@ -1,5 +1,3 @@ -global::Sample.Argument.AssertNotNull(endpoint, nameof(endpoint)); - options ??= new global::Sample.TestClientOptions(); _endpoint = endpoint; diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientProviders/TestData/ClientProviderTests/TestBuildConstructors_PrimaryConstructor(WithDefault,False,True,0).cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientProviders/TestData/ClientProviderTests/TestBuildConstructors_PrimaryConstructor(WithDefault,False,True,0).cs index 4bfcac8a646..cff4c2048c3 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientProviders/TestData/ClientProviderTests/TestBuildConstructors_PrimaryConstructor(WithDefault,False,True,0).cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientProviders/TestData/ClientProviderTests/TestBuildConstructors_PrimaryConstructor(WithDefault,False,True,0).cs @@ -1,8 +1,4 @@ -global::Sample.Argument.AssertNotNull(endpoint, nameof(endpoint)); -global::Sample.Argument.AssertNotNull(tokenProvider, nameof(tokenProvider)); - options ??= new global::Sample.TestClientOptions(); _endpoint = endpoint; -_tokenProvider = tokenProvider; -Pipeline = global::System.ClientModel.Primitives.ClientPipeline.Create(options, Array.Empty(), new global::System.ClientModel.Primitives.PipelinePolicy[] { new global::System.ClientModel.Primitives.UserAgentPolicy(typeof(global::Sample.TestClient).Assembly), new global::System.ClientModel.Primitives.BearerTokenPolicy(_tokenProvider, _flows) }, Array.Empty()); +Pipeline = global::System.ClientModel.Primitives.ClientPipeline.Create(options, Array.Empty(), new global::System.ClientModel.Primitives.PipelinePolicy[] { new global::System.ClientModel.Primitives.UserAgentPolicy(typeof(global::Sample.TestClient).Assembly), authenticationPolicy }, Array.Empty()); diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientProviders/TestData/ClientProviderTests/TestBuildConstructors_PrimaryConstructor(WithDefault,True,False,0).cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientProviders/TestData/ClientProviderTests/TestBuildConstructors_PrimaryConstructor(WithDefault,True,False,0).cs index da28a866fe6..cff4c2048c3 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientProviders/TestData/ClientProviderTests/TestBuildConstructors_PrimaryConstructor(WithDefault,True,False,0).cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientProviders/TestData/ClientProviderTests/TestBuildConstructors_PrimaryConstructor(WithDefault,True,False,0).cs @@ -1,8 +1,4 @@ -global::Sample.Argument.AssertNotNull(endpoint, nameof(endpoint)); -global::Sample.Argument.AssertNotNull(credential, nameof(credential)); - options ??= new global::Sample.TestClientOptions(); _endpoint = endpoint; -_keyCredential = credential; -Pipeline = global::System.ClientModel.Primitives.ClientPipeline.Create(options, Array.Empty(), new global::System.ClientModel.Primitives.PipelinePolicy[] { new global::System.ClientModel.Primitives.UserAgentPolicy(typeof(global::Sample.TestClient).Assembly), global::System.ClientModel.Primitives.ApiKeyAuthenticationPolicy.CreateHeaderApiKeyPolicy(_keyCredential, AuthorizationHeader) }, Array.Empty()); +Pipeline = global::System.ClientModel.Primitives.ClientPipeline.Create(options, Array.Empty(), new global::System.ClientModel.Primitives.PipelinePolicy[] { new global::System.ClientModel.Primitives.UserAgentPolicy(typeof(global::Sample.TestClient).Assembly), authenticationPolicy }, Array.Empty()); diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientProviders/TestData/ClientProviderTests/TestBuildConstructors_PrimaryConstructor(WithDefault,True,True,0).cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientProviders/TestData/ClientProviderTests/TestBuildConstructors_PrimaryConstructor(WithDefault,True,True,0).cs index da28a866fe6..cff4c2048c3 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientProviders/TestData/ClientProviderTests/TestBuildConstructors_PrimaryConstructor(WithDefault,True,True,0).cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientProviders/TestData/ClientProviderTests/TestBuildConstructors_PrimaryConstructor(WithDefault,True,True,0).cs @@ -1,8 +1,4 @@ -global::Sample.Argument.AssertNotNull(endpoint, nameof(endpoint)); -global::Sample.Argument.AssertNotNull(credential, nameof(credential)); - options ??= new global::Sample.TestClientOptions(); _endpoint = endpoint; -_keyCredential = credential; -Pipeline = global::System.ClientModel.Primitives.ClientPipeline.Create(options, Array.Empty(), new global::System.ClientModel.Primitives.PipelinePolicy[] { new global::System.ClientModel.Primitives.UserAgentPolicy(typeof(global::Sample.TestClient).Assembly), global::System.ClientModel.Primitives.ApiKeyAuthenticationPolicy.CreateHeaderApiKeyPolicy(_keyCredential, AuthorizationHeader) }, Array.Empty()); +Pipeline = global::System.ClientModel.Primitives.ClientPipeline.Create(options, Array.Empty(), new global::System.ClientModel.Primitives.PipelinePolicy[] { new global::System.ClientModel.Primitives.UserAgentPolicy(typeof(global::Sample.TestClient).Assembly), authenticationPolicy }, Array.Empty()); diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientProviders/TestData/ClientProviderTests/TestBuildConstructors_PrimaryConstructor(WithDefault,True,True,1).cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientProviders/TestData/ClientProviderTests/TestBuildConstructors_PrimaryConstructor(WithDefault,True,True,1).cs index 4bfcac8a646..cff4c2048c3 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientProviders/TestData/ClientProviderTests/TestBuildConstructors_PrimaryConstructor(WithDefault,True,True,1).cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientProviders/TestData/ClientProviderTests/TestBuildConstructors_PrimaryConstructor(WithDefault,True,True,1).cs @@ -1,8 +1,4 @@ -global::Sample.Argument.AssertNotNull(endpoint, nameof(endpoint)); -global::Sample.Argument.AssertNotNull(tokenProvider, nameof(tokenProvider)); - options ??= new global::Sample.TestClientOptions(); _endpoint = endpoint; -_tokenProvider = tokenProvider; -Pipeline = global::System.ClientModel.Primitives.ClientPipeline.Create(options, Array.Empty(), new global::System.ClientModel.Primitives.PipelinePolicy[] { new global::System.ClientModel.Primitives.UserAgentPolicy(typeof(global::Sample.TestClient).Assembly), new global::System.ClientModel.Primitives.BearerTokenPolicy(_tokenProvider, _flows) }, Array.Empty()); +Pipeline = global::System.ClientModel.Primitives.ClientPipeline.Create(options, Array.Empty(), new global::System.ClientModel.Primitives.PipelinePolicy[] { new global::System.ClientModel.Primitives.UserAgentPolicy(typeof(global::Sample.TestClient).Assembly), authenticationPolicy }, Array.Empty()); diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientProviders/TestData/ClientProviderTests/TestBuildConstructors_PrimaryConstructor(WithRequired,False,False,0).cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientProviders/TestData/ClientProviderTests/TestBuildConstructors_PrimaryConstructor(WithRequired,False,False,0).cs index bc5bbc28eac..855b9b946aa 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientProviders/TestData/ClientProviderTests/TestBuildConstructors_PrimaryConstructor(WithRequired,False,False,0).cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientProviders/TestData/ClientProviderTests/TestBuildConstructors_PrimaryConstructor(WithRequired,False,False,0).cs @@ -1,5 +1,3 @@ -global::Sample.Argument.AssertNotNull(endpoint, nameof(endpoint)); - options ??= new global::Sample.TestClientOptions(); _endpoint = endpoint; diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientProviders/TestData/ClientProviderTests/TestBuildConstructors_PrimaryConstructor(WithRequired,False,True,0).cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientProviders/TestData/ClientProviderTests/TestBuildConstructors_PrimaryConstructor(WithRequired,False,True,0).cs index 4bfcac8a646..cff4c2048c3 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientProviders/TestData/ClientProviderTests/TestBuildConstructors_PrimaryConstructor(WithRequired,False,True,0).cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientProviders/TestData/ClientProviderTests/TestBuildConstructors_PrimaryConstructor(WithRequired,False,True,0).cs @@ -1,8 +1,4 @@ -global::Sample.Argument.AssertNotNull(endpoint, nameof(endpoint)); -global::Sample.Argument.AssertNotNull(tokenProvider, nameof(tokenProvider)); - options ??= new global::Sample.TestClientOptions(); _endpoint = endpoint; -_tokenProvider = tokenProvider; -Pipeline = global::System.ClientModel.Primitives.ClientPipeline.Create(options, Array.Empty(), new global::System.ClientModel.Primitives.PipelinePolicy[] { new global::System.ClientModel.Primitives.UserAgentPolicy(typeof(global::Sample.TestClient).Assembly), new global::System.ClientModel.Primitives.BearerTokenPolicy(_tokenProvider, _flows) }, Array.Empty()); +Pipeline = global::System.ClientModel.Primitives.ClientPipeline.Create(options, Array.Empty(), new global::System.ClientModel.Primitives.PipelinePolicy[] { new global::System.ClientModel.Primitives.UserAgentPolicy(typeof(global::Sample.TestClient).Assembly), authenticationPolicy }, Array.Empty()); diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientProviders/TestData/ClientProviderTests/TestBuildConstructors_PrimaryConstructor(WithRequired,True,False,0).cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientProviders/TestData/ClientProviderTests/TestBuildConstructors_PrimaryConstructor(WithRequired,True,False,0).cs index da28a866fe6..cff4c2048c3 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientProviders/TestData/ClientProviderTests/TestBuildConstructors_PrimaryConstructor(WithRequired,True,False,0).cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientProviders/TestData/ClientProviderTests/TestBuildConstructors_PrimaryConstructor(WithRequired,True,False,0).cs @@ -1,8 +1,4 @@ -global::Sample.Argument.AssertNotNull(endpoint, nameof(endpoint)); -global::Sample.Argument.AssertNotNull(credential, nameof(credential)); - options ??= new global::Sample.TestClientOptions(); _endpoint = endpoint; -_keyCredential = credential; -Pipeline = global::System.ClientModel.Primitives.ClientPipeline.Create(options, Array.Empty(), new global::System.ClientModel.Primitives.PipelinePolicy[] { new global::System.ClientModel.Primitives.UserAgentPolicy(typeof(global::Sample.TestClient).Assembly), global::System.ClientModel.Primitives.ApiKeyAuthenticationPolicy.CreateHeaderApiKeyPolicy(_keyCredential, AuthorizationHeader) }, Array.Empty()); +Pipeline = global::System.ClientModel.Primitives.ClientPipeline.Create(options, Array.Empty(), new global::System.ClientModel.Primitives.PipelinePolicy[] { new global::System.ClientModel.Primitives.UserAgentPolicy(typeof(global::Sample.TestClient).Assembly), authenticationPolicy }, Array.Empty()); diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientProviders/TestData/ClientProviderTests/TestBuildConstructors_PrimaryConstructor(WithRequired,True,True,0).cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientProviders/TestData/ClientProviderTests/TestBuildConstructors_PrimaryConstructor(WithRequired,True,True,0).cs index da28a866fe6..cff4c2048c3 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientProviders/TestData/ClientProviderTests/TestBuildConstructors_PrimaryConstructor(WithRequired,True,True,0).cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientProviders/TestData/ClientProviderTests/TestBuildConstructors_PrimaryConstructor(WithRequired,True,True,0).cs @@ -1,8 +1,4 @@ -global::Sample.Argument.AssertNotNull(endpoint, nameof(endpoint)); -global::Sample.Argument.AssertNotNull(credential, nameof(credential)); - options ??= new global::Sample.TestClientOptions(); _endpoint = endpoint; -_keyCredential = credential; -Pipeline = global::System.ClientModel.Primitives.ClientPipeline.Create(options, Array.Empty(), new global::System.ClientModel.Primitives.PipelinePolicy[] { new global::System.ClientModel.Primitives.UserAgentPolicy(typeof(global::Sample.TestClient).Assembly), global::System.ClientModel.Primitives.ApiKeyAuthenticationPolicy.CreateHeaderApiKeyPolicy(_keyCredential, AuthorizationHeader) }, Array.Empty()); +Pipeline = global::System.ClientModel.Primitives.ClientPipeline.Create(options, Array.Empty(), new global::System.ClientModel.Primitives.PipelinePolicy[] { new global::System.ClientModel.Primitives.UserAgentPolicy(typeof(global::Sample.TestClient).Assembly), authenticationPolicy }, Array.Empty()); diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientProviders/TestData/ClientProviderTests/TestBuildConstructors_PrimaryConstructor(WithRequired,True,True,1).cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientProviders/TestData/ClientProviderTests/TestBuildConstructors_PrimaryConstructor(WithRequired,True,True,1).cs index 4bfcac8a646..cff4c2048c3 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientProviders/TestData/ClientProviderTests/TestBuildConstructors_PrimaryConstructor(WithRequired,True,True,1).cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientProviders/TestData/ClientProviderTests/TestBuildConstructors_PrimaryConstructor(WithRequired,True,True,1).cs @@ -1,8 +1,4 @@ -global::Sample.Argument.AssertNotNull(endpoint, nameof(endpoint)); -global::Sample.Argument.AssertNotNull(tokenProvider, nameof(tokenProvider)); - options ??= new global::Sample.TestClientOptions(); _endpoint = endpoint; -_tokenProvider = tokenProvider; -Pipeline = global::System.ClientModel.Primitives.ClientPipeline.Create(options, Array.Empty(), new global::System.ClientModel.Primitives.PipelinePolicy[] { new global::System.ClientModel.Primitives.UserAgentPolicy(typeof(global::Sample.TestClient).Assembly), new global::System.ClientModel.Primitives.BearerTokenPolicy(_tokenProvider, _flows) }, Array.Empty()); +Pipeline = global::System.ClientModel.Primitives.ClientPipeline.Create(options, Array.Empty(), new global::System.ClientModel.Primitives.PipelinePolicy[] { new global::System.ClientModel.Primitives.UserAgentPolicy(typeof(global::Sample.TestClient).Assembly), authenticationPolicy }, Array.Empty()); diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientProviders/TestData/ClientProviderTests/ValidateConstructorsWhenUnsupportedAuth.cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientProviders/TestData/ClientProviderTests/ValidateConstructorsWhenUnsupportedAuth.cs index 67b3361362f..8bfb8877981 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientProviders/TestData/ClientProviderTests/ValidateConstructorsWhenUnsupportedAuth.cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientProviders/TestData/ClientProviderTests/ValidateConstructorsWhenUnsupportedAuth.cs @@ -13,12 +13,16 @@ public partial class TestClient { } - internal TestClient(global::System.Uri endpoint, global::Sample.TestClientOptions options) + internal TestClient(global::System.ClientModel.Primitives.AuthenticationPolicy authenticationPolicy, global::System.Uri endpoint, global::Sample.TestClientOptions options) { options ??= new global::Sample.TestClientOptions(); _endpoint = endpoint; Pipeline = global::System.ClientModel.Primitives.ClientPipeline.Create(options, Array.Empty(), new global::System.ClientModel.Primitives.PipelinePolicy[] { new global::System.ClientModel.Primitives.UserAgentPolicy(typeof(global::Sample.TestClient).Assembly) }, Array.Empty()); } + + internal TestClient(global::System.Uri endpoint, global::Sample.TestClientOptions options) : this(null, endpoint, options) + { + } } } diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientProviders/TestData/ClientProviderTests/XmlDocsAreWritten.cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientProviders/TestData/ClientProviderTests/XmlDocsAreWritten.cs index 31e104ce003..7896bda5ae8 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientProviders/TestData/ClientProviderTests/XmlDocsAreWritten.cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientProviders/TestData/ClientProviderTests/XmlDocsAreWritten.cs @@ -31,16 +31,12 @@ protected TestClient() } /// Initializes a new instance of TestClient. + /// The authentication policy to use for pipeline creation. /// Service endpoint. /// queryParam description. /// The options for configuring the client. - /// or is null. - /// is an empty string, and was expected to be non-empty. - public TestClient(global::System.Uri endpoint, string queryParam, global::Sample.TestClientOptions options) + internal TestClient(global::System.ClientModel.Primitives.AuthenticationPolicy authenticationPolicy, global::System.Uri endpoint, string queryParam, global::Sample.TestClientOptions options) { - global::Sample.Argument.AssertNotNull(endpoint, nameof(endpoint)); - global::Sample.Argument.AssertNotNullOrEmpty(queryParam, nameof(queryParam)); - options ??= new global::Sample.TestClientOptions(); _endpoint = endpoint; @@ -48,6 +44,16 @@ public TestClient(global::System.Uri endpoint, string queryParam, global::Sample Pipeline = global::System.ClientModel.Primitives.ClientPipeline.Create(options, Array.Empty(), new global::System.ClientModel.Primitives.PipelinePolicy[] { new global::System.ClientModel.Primitives.UserAgentPolicy(typeof(global::Sample.TestClient).Assembly) }, Array.Empty()); } + /// Initializes a new instance of TestClient. + /// Service endpoint. + /// queryParam description. + /// The options for configuring the client. + /// or is null. + /// is an empty string, and was expected to be non-empty. + public TestClient(global::System.Uri endpoint, string queryParam, global::Sample.TestClientOptions options) : this(null, endpoint, queryParam0, options) + { + } + /// The HTTP pipeline for sending and receiving REST requests and responses. public global::System.ClientModel.Primitives.ClientPipeline Pipeline { get; } diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/TestData/ClientOptionsProviderTests/MultiServiceClient_GeneratesExpectedClientOptions.cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/TestData/ClientOptionsProviderTests/MultiServiceClient_GeneratesExpectedClientOptions.cs index 793a7a38ff5..1eb960fa71f 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/TestData/ClientOptionsProviderTests/MultiServiceClient_GeneratesExpectedClientOptions.cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/TestData/ClientOptionsProviderTests/MultiServiceClient_GeneratesExpectedClientOptions.cs @@ -39,6 +39,14 @@ internal TestClientOptions(global::Microsoft.Extensions.Configuration.IConfigura { return; } + if ((section["ServiceAApiVersion"] is string serviceAApiVersion)) + { + this.ServiceAApiVersion = serviceAApiVersion; + } + if ((section["ServiceBApiVersion"] is string serviceBApiVersion)) + { + this.ServiceBApiVersion = serviceBApiVersion; + } } internal string ServiceAApiVersion { get; } diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/TestData/ClientOptionsProviderTests/MultiServiceClient_WithThreeServices_GeneratesExpectedClientOptions.cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/TestData/ClientOptionsProviderTests/MultiServiceClient_WithThreeServices_GeneratesExpectedClientOptions.cs index ea82828c46b..bf32f96cbf8 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/TestData/ClientOptionsProviderTests/MultiServiceClient_WithThreeServices_GeneratesExpectedClientOptions.cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/TestData/ClientOptionsProviderTests/MultiServiceClient_WithThreeServices_GeneratesExpectedClientOptions.cs @@ -48,6 +48,18 @@ internal TestClientOptions(global::Microsoft.Extensions.Configuration.IConfigura { return; } + if ((section["ServiceKeyVaultApiVersion"] is string serviceKeyVaultApiVersion)) + { + this.ServiceKeyVaultApiVersion = serviceKeyVaultApiVersion; + } + if ((section["ServiceStorageApiVersion"] is string serviceStorageApiVersion)) + { + this.ServiceStorageApiVersion = serviceStorageApiVersion; + } + if ((section["ServiceComputeApiVersion"] is string serviceComputeApiVersion)) + { + this.ServiceComputeApiVersion = serviceComputeApiVersion; + } } internal string ServiceComputeApiVersion { get; } diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/TestData/ClientOptionsProviderTests/MultiServiceCombinedClient_GeneratesExpectedClientOptions.cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/TestData/ClientOptionsProviderTests/MultiServiceCombinedClient_GeneratesExpectedClientOptions.cs index 793a7a38ff5..1eb960fa71f 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/TestData/ClientOptionsProviderTests/MultiServiceCombinedClient_GeneratesExpectedClientOptions.cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/TestData/ClientOptionsProviderTests/MultiServiceCombinedClient_GeneratesExpectedClientOptions.cs @@ -39,6 +39,14 @@ internal TestClientOptions(global::Microsoft.Extensions.Configuration.IConfigura { return; } + if ((section["ServiceAApiVersion"] is string serviceAApiVersion)) + { + this.ServiceAApiVersion = serviceAApiVersion; + } + if ((section["ServiceBApiVersion"] is string serviceBApiVersion)) + { + this.ServiceBApiVersion = serviceBApiVersion; + } } internal string ServiceAApiVersion { get; } diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/TestData/ClientOptionsProviderTests/MultiServiceCombinedClient_WithThreeServices_GeneratesExpectedClientOptions.cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/TestData/ClientOptionsProviderTests/MultiServiceCombinedClient_WithThreeServices_GeneratesExpectedClientOptions.cs index ea82828c46b..bf32f96cbf8 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/TestData/ClientOptionsProviderTests/MultiServiceCombinedClient_WithThreeServices_GeneratesExpectedClientOptions.cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/TestData/ClientOptionsProviderTests/MultiServiceCombinedClient_WithThreeServices_GeneratesExpectedClientOptions.cs @@ -48,6 +48,18 @@ internal TestClientOptions(global::Microsoft.Extensions.Configuration.IConfigura { return; } + if ((section["ServiceKeyVaultApiVersion"] is string serviceKeyVaultApiVersion)) + { + this.ServiceKeyVaultApiVersion = serviceKeyVaultApiVersion; + } + if ((section["ServiceStorageApiVersion"] is string serviceStorageApiVersion)) + { + this.ServiceStorageApiVersion = serviceStorageApiVersion; + } + if ((section["ServiceComputeApiVersion"] is string serviceComputeApiVersion)) + { + this.ServiceComputeApiVersion = serviceComputeApiVersion; + } } internal string ServiceComputeApiVersion { get; } diff --git a/packages/http-client-csharp/global.json b/packages/http-client-csharp/global.json index 311edc2181a..d3d8f44dafe 100644 --- a/packages/http-client-csharp/global.json +++ b/packages/http-client-csharp/global.json @@ -1,6 +1 @@ -{ - "sdk": { - "version": "10.0.103", - "rollForward": "feature" - } -} +{"sdk":{"version":"10.0.102","rollForward":"feature"}} From 6eecbcd97ca08c8c4afece1ab02cdec32befcf7f Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 11 Mar 2026 00:29:34 +0000 Subject: [PATCH 10/38] fix: refactor to single internal AuthenticationPolicy constructor; fix duplicate ctor for multi-auth clients Co-authored-by: JoshLove-msft <54595583+JoshLove-msft@users.noreply.github.com> --- .../src/Providers/ClientProvider.cs | 46 +++++++++++-------- .../ClientProviders/ClientProviderTests.cs | 7 ++- .../api-key/src/Generated/ApiKeyClient.cs | 4 +- .../http/custom/src/Generated/CustomClient.cs | 4 +- .../oauth2/src/Generated/OAuth2Client.cs | 4 +- .../union/src/Generated/UnionClient.cs | 6 +-- 6 files changed, 40 insertions(+), 31 deletions(-) diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Providers/ClientProvider.cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Providers/ClientProvider.cs index 9e7f7f4c4d6..e57b8290ca7 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Providers/ClientProvider.cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Providers/ClientProvider.cs @@ -553,22 +553,46 @@ protected override ConstructorProvider[] BuildConstructors() var primaryConstructors = new List(); var secondaryConstructors = new List(); + bool hasAnyAuth = _apiKeyAuthFields != null || _oauth2Fields != null; + + // The internal implementation constructor takes AuthenticationPolicy? as first parameter. + // It is shared across all auth types - add it once. + if (hasAnyAuth || _apiKeyAuthFields == null && _oauth2Fields == null) + { + // Always add the single internal implementation constructor + var authPolicyParam = new ParameterProvider( + "authenticationPolicy", + $"The authentication policy to use for pipeline creation.", + new CSharpType(typeof(AuthenticationPolicy), isNullable: true)); + + var requiredNonAuthParams = GetRequiredParameters(null); + ParameterProvider[] internalConstructorParameters = [authPolicyParam, _endpointParameter, .. requiredNonAuthParams, ClientOptionsParameter]; + + // Use the first available auth fields to determine pipeline auth type + AuthFields? firstAuthFields = _apiKeyAuthFields as AuthFields ?? _oauth2Fields; + var internalConstructor = new ConstructorProvider( + new ConstructorSignature(Type, _publicCtorDescription, MethodSignatureModifiers.Internal, internalConstructorParameters), + BuildPrimaryConstructorBody(internalConstructorParameters, firstAuthFields, authPolicyParam, ClientOptions, ClientOptionsParameter), + this); + primaryConstructors.Add(internalConstructor); + } + // if there is key auth if (_apiKeyAuthFields != null) { - AppendConstructors(_apiKeyAuthFields, primaryConstructors, secondaryConstructors); + AppendPublicConstructors(_apiKeyAuthFields, primaryConstructors, secondaryConstructors); } // if there is oauth2 auth if (_oauth2Fields != null) { - AppendConstructors(_oauth2Fields, primaryConstructors, secondaryConstructors); + AppendPublicConstructors(_oauth2Fields, primaryConstructors, secondaryConstructors); } bool onlyContainsUnsupportedAuth = _inputAuth != null && _apiKeyAuthFields == null && _oauth2Fields == null; // if there is no auth if (_apiKeyAuthFields == null && _oauth2Fields == null) { - AppendConstructors(null, primaryConstructors, secondaryConstructors, onlyContainsUnsupportedAuth); + AppendPublicConstructors(null, primaryConstructors, secondaryConstructors, onlyContainsUnsupportedAuth); } var shouldIncludeMockingConstructor = !onlyContainsUnsupportedAuth && secondaryConstructors.All(c => c.Signature.Parameters.Count > 0); @@ -579,28 +603,14 @@ protected override ConstructorProvider[] BuildConstructors() ? [ConstructorProviderHelper.BuildMockingConstructor(this), .. secondaryConstructors, .. primaryConstructors, .. settingsConstructors] : [.. secondaryConstructors, .. primaryConstructors, .. settingsConstructors]; - void AppendConstructors( + void AppendPublicConstructors( AuthFields? authFields, List primaryConstructors, List secondaryConstructors, bool onlyContainsUnsupportedAuth = false) { - // The internal implementation constructor takes AuthenticationPolicy? as first parameter. - var authPolicyParam = new ParameterProvider( - "authenticationPolicy", - $"The authentication policy to use for pipeline creation.", - new CSharpType(typeof(AuthenticationPolicy), isNullable: true)); - // Non-auth required parameters (all required non-endpoint params except auth credential) var requiredNonAuthParams = GetRequiredParameters(null); - ParameterProvider[] internalConstructorParameters = [authPolicyParam, _endpointParameter, .. requiredNonAuthParams, ClientOptionsParameter]; - - // Internal constructor is the sole implementation constructor - var internalConstructor = new ConstructorProvider( - new ConstructorSignature(Type, _publicCtorDescription, MethodSignatureModifiers.Internal, internalConstructorParameters), - BuildPrimaryConstructorBody(internalConstructorParameters, authFields, authPolicyParam, ClientOptions, ClientOptionsParameter), - this); - primaryConstructors.Add(internalConstructor); // Public constructor with credential parameter — delegates to the internal constructor. var requiredParameters = GetRequiredParameters(authFields?.AuthField); diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientProviders/ClientProviderTests.cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientProviders/ClientProviderTests.cs index 73f28a26192..188f804eb36 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientProviders/ClientProviderTests.cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientProviders/ClientProviderTests.cs @@ -373,10 +373,9 @@ public void TestBuildConstructors_PrimaryConstructor(List inputP var implementationConstructors = constructors.Where( c => c.Signature?.Initializer == null && c.Signature?.Modifiers == MethodSignatureModifiers.Internal).ToArray(); - // for no auth or one auth case, this should be 1 - // for both auth case, this should be 2 - // for only unsupported auth case, this should be 1 (still has internal implementation ctor) - int expectedImplCtorCount = _hasKeyAuth && _hasOAuth2 ? 2 : 1; + // There is always exactly 1 internal implementation constructor, regardless of auth type count. + // All public credential constructors are pass-throughs to this single implementation constructor. + int expectedImplCtorCount = 1; Assert.AreEqual(expectedImplCtorCount, implementationConstructors.Length); for (int i = 0; i < implementationConstructors.Length; i++) diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/authentication/api-key/src/Generated/ApiKeyClient.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/authentication/api-key/src/Generated/ApiKeyClient.cs index 84aaa989763..c6d85eca75a 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/authentication/api-key/src/Generated/ApiKeyClient.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/authentication/api-key/src/Generated/ApiKeyClient.cs @@ -19,10 +19,10 @@ public partial class ApiKeyClient public ApiKeyClient(ApiKeyCredential credential, ApiKeyClientOptions options) : this(new Uri("http://localhost:3000"), credential, options) => throw null; - public ApiKeyClient(Uri endpoint, ApiKeyCredential credential, ApiKeyClientOptions options) => throw null; + public ApiKeyClient(Uri endpoint, ApiKeyCredential credential, ApiKeyClientOptions options) : this(ApiKeyAuthenticationPolicy.CreateHeaderApiKeyPolicy(credential, AuthorizationHeader), endpoint, options) => throw null; [Experimental("SCME0002")] - public ApiKeyClient(ApiKeyClientSettings settings) : this(settings?.Endpoint, settings?.Credential?.Key != null ? new ApiKeyCredential(settings?.Credential?.Key) : null, settings?.Options) => throw null; + public ApiKeyClient(ApiKeyClientSettings settings) : this(AuthenticationPolicy.Create(settings), settings?.Endpoint, settings?.Options) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/authentication/http/custom/src/Generated/CustomClient.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/authentication/http/custom/src/Generated/CustomClient.cs index 63a41cdd265..31954750cbb 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/authentication/http/custom/src/Generated/CustomClient.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/authentication/http/custom/src/Generated/CustomClient.cs @@ -19,10 +19,10 @@ public partial class CustomClient public CustomClient(ApiKeyCredential credential, CustomClientOptions options) : this(new Uri("http://localhost:3000"), credential, options) => throw null; - public CustomClient(Uri endpoint, ApiKeyCredential credential, CustomClientOptions options) => throw null; + public CustomClient(Uri endpoint, ApiKeyCredential credential, CustomClientOptions options) : this(ApiKeyAuthenticationPolicy.CreateHeaderApiKeyPolicy(credential, AuthorizationHeader, AuthorizationApiKeyPrefix), endpoint, options) => throw null; [Experimental("SCME0002")] - public CustomClient(CustomClientSettings settings) : this(settings?.Endpoint, settings?.Credential?.Key != null ? new ApiKeyCredential(settings?.Credential?.Key) : null, settings?.Options) => throw null; + public CustomClient(CustomClientSettings settings) : this(AuthenticationPolicy.Create(settings), settings?.Endpoint, settings?.Options) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/authentication/oauth2/src/Generated/OAuth2Client.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/authentication/oauth2/src/Generated/OAuth2Client.cs index 5ba9629bdd7..2ae5a0d3cea 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/authentication/oauth2/src/Generated/OAuth2Client.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/authentication/oauth2/src/Generated/OAuth2Client.cs @@ -19,10 +19,10 @@ public partial class OAuth2Client public OAuth2Client(AuthenticationTokenProvider tokenProvider, OAuth2ClientOptions options) : this(new Uri("http://localhost:3000"), tokenProvider, options) => throw null; - public OAuth2Client(Uri endpoint, AuthenticationTokenProvider tokenProvider, OAuth2ClientOptions options) => throw null; + public OAuth2Client(Uri endpoint, AuthenticationTokenProvider tokenProvider, OAuth2ClientOptions options) : this(new BearerTokenPolicy(tokenProvider, _flows), endpoint, options) => throw null; [Experimental("SCME0002")] - public OAuth2Client(OAuth2ClientSettings settings) : this(settings?.Endpoint, settings?.CredentialProvider as AuthenticationTokenProvider, settings?.Options) => throw null; + public OAuth2Client(OAuth2ClientSettings settings) : this(AuthenticationPolicy.Create(settings), settings?.Endpoint, settings?.Options) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/authentication/union/src/Generated/UnionClient.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/authentication/union/src/Generated/UnionClient.cs index e7c01b62077..034bfc87822 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/authentication/union/src/Generated/UnionClient.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/authentication/union/src/Generated/UnionClient.cs @@ -23,12 +23,12 @@ public partial class UnionClient public UnionClient(AuthenticationTokenProvider tokenProvider, UnionClientOptions options) : this(new Uri("http://localhost:3000"), tokenProvider, options) => throw null; - public UnionClient(Uri endpoint, ApiKeyCredential credential, UnionClientOptions options) => throw null; + public UnionClient(Uri endpoint, ApiKeyCredential credential, UnionClientOptions options) : this(ApiKeyAuthenticationPolicy.CreateHeaderApiKeyPolicy(credential, AuthorizationHeader), endpoint, options) => throw null; - public UnionClient(Uri endpoint, AuthenticationTokenProvider tokenProvider, UnionClientOptions options) => throw null; + public UnionClient(Uri endpoint, AuthenticationTokenProvider tokenProvider, UnionClientOptions options) : this(new BearerTokenPolicy(tokenProvider, _flows), endpoint, options) => throw null; [Experimental("SCME0002")] - public UnionClient(UnionClientSettings settings) : this(settings?.Endpoint, settings?.CredentialProvider as AuthenticationTokenProvider, settings?.Options) => throw null; + public UnionClient(UnionClientSettings settings) : this(AuthenticationPolicy.Create(settings), settings?.Endpoint, settings?.Options) => throw null; public ClientPipeline Pipeline => throw null; From 8273e9d8592988c9dbea3895a5b70d2e4b1520d4 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 11 Mar 2026 00:54:47 +0000 Subject: [PATCH 11/38] fix(http-client-csharp): fix StubLibraryVisitor to include internal constructor and const/static fields for ClientProvider; make _flows static for this() ctor compatibility Co-authored-by: JoshLove-msft <54595583+JoshLove-msft@users.noreply.github.com> --- .../src/StubLibraryVisitor.cs | 17 ++++++++++++++++- .../src/Providers/ClientProvider.cs | 2 +- .../ClientProviders/ClientProviderTests.cs | 6 +++--- .../api-key/src/Generated/ApiKeyClient.cs | 4 ++++ .../http/custom/src/Generated/CustomClient.cs | 5 +++++ .../oauth2/src/Generated/OAuth2Client.cs | 13 +++++++++++++ .../union/src/Generated/UnionClient.cs | 14 ++++++++++++++ .../model/empty/src/Generated/EmptyClient.cs | 6 ++++-- .../src/Generated/EnumDiscriminatorClient.cs | 6 ++++-- .../src/Generated/NestedDiscriminatorClient.cs | 6 ++++-- .../src/Generated/NotDiscriminatedClient.cs | 6 ++++-- .../recursive/src/Generated/RecursiveClient.cs | 6 ++++-- .../src/Generated/SingleDiscriminatorClient.cs | 6 ++++-- .../model/usage/src/Generated/UsageClient.cs | 6 ++++-- .../src/Generated/VisibilityClient.cs | 6 ++++-- 15 files changed, 88 insertions(+), 21 deletions(-) diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel.StubLibrary/src/StubLibraryVisitor.cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel.StubLibrary/src/StubLibraryVisitor.cs index c3ea6a82987..a24a1b21c42 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel.StubLibrary/src/StubLibraryVisitor.cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel.StubLibrary/src/StubLibraryVisitor.cs @@ -46,6 +46,7 @@ internal class StubLibraryVisitor : ScmLibraryVisitor if (!IsCallingBaseCtor(constructor) && !IsEffectivelyPublic(constructor.Signature.Modifiers) && !IsParameterlessInternalCtorOnMrwSerializationType(constructor) && + !IsInternalClientConstructor(constructor) && (constructor.EnclosingType is not ModelProvider model || model.DerivedModels.Count == 0)) return null; @@ -57,6 +58,14 @@ internal class StubLibraryVisitor : ScmLibraryVisitor return constructor; } + private static bool IsInternalClientConstructor(ConstructorProvider constructor) + { + if (!constructor.Signature.Modifiers.HasFlag(MethodSignatureModifiers.Internal)) + return false; + + return constructor.EnclosingType is ClientProvider; + } + private static bool IsParameterlessInternalCtorOnMrwSerializationType(ConstructorProvider constructor) { if (constructor.Signature.Parameters.Count != 0) @@ -78,7 +87,13 @@ private static bool IsCallingBaseCtor(ConstructorProvider constructor) protected override FieldProvider? VisitField(FieldProvider field) { // For ClientOptions, keep the non-public field as this currently represents the latest service version for a client. - return (field.Modifiers.HasFlag(FieldModifiers.Public) || field.EnclosingType.BaseType?.Equals(typeof(ClientPipelineOptions)) == true) + // For ClientProvider, keep const and static fields as they are referenced by stub constructor initializers + // (e.g. AuthorizationHeader const used in this() API key ctor, _flows static used in this() OAuth2 ctor). + return (field.Modifiers.HasFlag(FieldModifiers.Public) + || field.EnclosingType.BaseType?.Equals(typeof(ClientPipelineOptions)) == true + || (field.EnclosingType is ClientProvider + && (field.Modifiers.HasFlag(FieldModifiers.Const) + || field.Modifiers.HasFlag(FieldModifiers.Static)))) ? field : null; } diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Providers/ClientProvider.cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Providers/ClientProvider.cs index e57b8290ca7..1c3ba3ed76c 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Providers/ClientProvider.cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Providers/ClientProvider.cs @@ -1400,7 +1400,7 @@ [new MemberExpression(typeof(GetTokenOptions), nameof(GetTokenOptions.ScopesProp } return new FieldProvider( - FieldModifiers.Private | FieldModifiers.ReadOnly, + FieldModifiers.Private | FieldModifiers.Static | FieldModifiers.ReadOnly, typeof(Dictionary[]), TokenCredentialFlowsFieldName, this, diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientProviders/ClientProviderTests.cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientProviders/ClientProviderTests.cs index 188f804eb36..81767deb6c0 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientProviders/ClientProviderTests.cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientProviders/ClientProviderTests.cs @@ -173,7 +173,7 @@ public void TestBuildAuthFields_WithAuth(List inputParameters) // oauth2 auth should have the _flows field; _tokenProvider is no longer stored AssertHasFields(clientProvider, new List { - new(FieldModifiers.Private | FieldModifiers.ReadOnly, new CSharpType(typeof(Dictionary[])), "_flows"), + new(FieldModifiers.Private | FieldModifiers.Static | FieldModifiers.ReadOnly, new CSharpType(typeof(Dictionary[])), "_flows"), }); // _tokenProvider field is no longer on the client (auth handled via AuthenticationPolicy parameter) Assert.IsFalse(clientProvider.Fields.Any(f => f.Name == "_tokenProvider")); @@ -212,7 +212,7 @@ public void TestBuildOAuth2FlowsField(IEnumerable inputFlows) // oauth2 auth should have the _flows field; _tokenProvider is no longer stored on the client AssertHasFields(clientProvider, new List { - new(FieldModifiers.Private | FieldModifiers.ReadOnly, new CSharpType(typeof(Dictionary[])), "_flows"), + new(FieldModifiers.Private | FieldModifiers.Static | FieldModifiers.ReadOnly, new CSharpType(typeof(Dictionary[])), "_flows"), }); Assert.IsFalse(clientProvider.Fields.Any(f => f.Name == "_tokenProvider"), "_tokenProvider should not be present - auth handled via AuthenticationPolicy parameter"); @@ -313,7 +313,7 @@ public void TestBuildAuthFields_WithSubClients_WithAuth(InputClient client) // oauth2 auth should have _flows field; _tokenProvider is no longer stored AssertHasFields(clientProvider, new List { - new(FieldModifiers.Private | FieldModifiers.ReadOnly, new CSharpType(typeof(Dictionary[])), "_flows"), + new(FieldModifiers.Private | FieldModifiers.Static | FieldModifiers.ReadOnly, new CSharpType(typeof(Dictionary[])), "_flows"), }); Assert.IsFalse(clientProvider.Fields.Any(f => f.Name == "_tokenProvider")); } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/authentication/api-key/src/Generated/ApiKeyClient.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/authentication/api-key/src/Generated/ApiKeyClient.cs index c6d85eca75a..bb90d193964 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/authentication/api-key/src/Generated/ApiKeyClient.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/authentication/api-key/src/Generated/ApiKeyClient.cs @@ -13,12 +13,16 @@ namespace Authentication.ApiKey { public partial class ApiKeyClient { + private const string AuthorizationHeader = "x-ms-api-key"; + protected ApiKeyClient() => throw null; public ApiKeyClient(ApiKeyCredential credential) : this(new Uri("http://localhost:3000"), credential, new ApiKeyClientOptions()) => throw null; public ApiKeyClient(ApiKeyCredential credential, ApiKeyClientOptions options) : this(new Uri("http://localhost:3000"), credential, options) => throw null; + internal ApiKeyClient(AuthenticationPolicy authenticationPolicy, Uri endpoint, ApiKeyClientOptions options) => throw null; + public ApiKeyClient(Uri endpoint, ApiKeyCredential credential, ApiKeyClientOptions options) : this(ApiKeyAuthenticationPolicy.CreateHeaderApiKeyPolicy(credential, AuthorizationHeader), endpoint, options) => throw null; [Experimental("SCME0002")] diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/authentication/http/custom/src/Generated/CustomClient.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/authentication/http/custom/src/Generated/CustomClient.cs index 31954750cbb..25ff19d43b1 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/authentication/http/custom/src/Generated/CustomClient.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/authentication/http/custom/src/Generated/CustomClient.cs @@ -13,12 +13,17 @@ namespace Authentication.Http.Custom { public partial class CustomClient { + private const string AuthorizationHeader = "Authorization"; + private const string AuthorizationApiKeyPrefix = "SharedAccessKey"; + protected CustomClient() => throw null; public CustomClient(ApiKeyCredential credential) : this(new Uri("http://localhost:3000"), credential, new CustomClientOptions()) => throw null; public CustomClient(ApiKeyCredential credential, CustomClientOptions options) : this(new Uri("http://localhost:3000"), credential, options) => throw null; + internal CustomClient(AuthenticationPolicy authenticationPolicy, Uri endpoint, CustomClientOptions options) => throw null; + public CustomClient(Uri endpoint, ApiKeyCredential credential, CustomClientOptions options) : this(ApiKeyAuthenticationPolicy.CreateHeaderApiKeyPolicy(credential, AuthorizationHeader, AuthorizationApiKeyPrefix), endpoint, options) => throw null; [Experimental("SCME0002")] diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/authentication/oauth2/src/Generated/OAuth2Client.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/authentication/oauth2/src/Generated/OAuth2Client.cs index 2ae5a0d3cea..0b34d500610 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/authentication/oauth2/src/Generated/OAuth2Client.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/authentication/oauth2/src/Generated/OAuth2Client.cs @@ -5,6 +5,7 @@ using System; using System.ClientModel; using System.ClientModel.Primitives; +using System.Collections.Generic; using System.Diagnostics.CodeAnalysis; using System.Threading; using System.Threading.Tasks; @@ -13,12 +14,24 @@ namespace Authentication.OAuth2 { public partial class OAuth2Client { + /// The OAuth2 flows supported by the service. + private static readonly Dictionary[] _flows = new Dictionary[] + { + new Dictionary + { + { GetTokenOptions.ScopesPropertyName, new string[] { "https://security.microsoft.com/.default" } }, + { GetTokenOptions.AuthorizationUrlPropertyName, "https://login.microsoftonline.com/common/oauth2/authorize" } + } + }; + protected OAuth2Client() => throw null; public OAuth2Client(AuthenticationTokenProvider tokenProvider) : this(new Uri("http://localhost:3000"), tokenProvider, new OAuth2ClientOptions()) => throw null; public OAuth2Client(AuthenticationTokenProvider tokenProvider, OAuth2ClientOptions options) : this(new Uri("http://localhost:3000"), tokenProvider, options) => throw null; + internal OAuth2Client(AuthenticationPolicy authenticationPolicy, Uri endpoint, OAuth2ClientOptions options) => throw null; + public OAuth2Client(Uri endpoint, AuthenticationTokenProvider tokenProvider, OAuth2ClientOptions options) : this(new BearerTokenPolicy(tokenProvider, _flows), endpoint, options) => throw null; [Experimental("SCME0002")] diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/authentication/union/src/Generated/UnionClient.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/authentication/union/src/Generated/UnionClient.cs index 034bfc87822..cf14844ba08 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/authentication/union/src/Generated/UnionClient.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/authentication/union/src/Generated/UnionClient.cs @@ -5,6 +5,7 @@ using System; using System.ClientModel; using System.ClientModel.Primitives; +using System.Collections.Generic; using System.Diagnostics.CodeAnalysis; using System.Threading; using System.Threading.Tasks; @@ -13,6 +14,17 @@ namespace Authentication.Union { public partial class UnionClient { + private const string AuthorizationHeader = "x-ms-api-key"; + /// The OAuth2 flows supported by the service. + private static readonly Dictionary[] _flows = new Dictionary[] + { + new Dictionary + { + { GetTokenOptions.ScopesPropertyName, new string[] { "https://security.microsoft.com/.default" } }, + { GetTokenOptions.AuthorizationUrlPropertyName, "https://login.microsoftonline.com/common/oauth2/authorize" } + } + }; + protected UnionClient() => throw null; public UnionClient(ApiKeyCredential credential) : this(new Uri("http://localhost:3000"), credential, new UnionClientOptions()) => throw null; @@ -23,6 +35,8 @@ public partial class UnionClient public UnionClient(AuthenticationTokenProvider tokenProvider, UnionClientOptions options) : this(new Uri("http://localhost:3000"), tokenProvider, options) => throw null; + internal UnionClient(AuthenticationPolicy authenticationPolicy, Uri endpoint, UnionClientOptions options) => throw null; + public UnionClient(Uri endpoint, ApiKeyCredential credential, UnionClientOptions options) : this(ApiKeyAuthenticationPolicy.CreateHeaderApiKeyPolicy(credential, AuthorizationHeader), endpoint, options) => throw null; public UnionClient(Uri endpoint, AuthenticationTokenProvider tokenProvider, UnionClientOptions options) : this(new BearerTokenPolicy(tokenProvider, _flows), endpoint, options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/empty/src/Generated/EmptyClient.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/empty/src/Generated/EmptyClient.cs index adc65d8c815..00f7325cbd9 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/empty/src/Generated/EmptyClient.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/empty/src/Generated/EmptyClient.cs @@ -15,10 +15,12 @@ public partial class EmptyClient { public EmptyClient() : this(new Uri("http://localhost:3000"), new EmptyClientOptions()) => throw null; - public EmptyClient(Uri endpoint, EmptyClientOptions options) => throw null; + internal EmptyClient(AuthenticationPolicy authenticationPolicy, Uri endpoint, EmptyClientOptions options) => throw null; + + public EmptyClient(Uri endpoint, EmptyClientOptions options) : this(null, endpoint, options) => throw null; [Experimental("SCME0002")] - public EmptyClient(EmptyClientSettings settings) : this(settings?.Endpoint, settings?.Options) => throw null; + public EmptyClient(EmptyClientSettings settings) : this(AuthenticationPolicy.Create(settings), settings?.Endpoint, settings?.Options) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/inheritance/enum-discriminator/src/Generated/EnumDiscriminatorClient.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/inheritance/enum-discriminator/src/Generated/EnumDiscriminatorClient.cs index 2a42fc59d9d..ca37716df88 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/inheritance/enum-discriminator/src/Generated/EnumDiscriminatorClient.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/inheritance/enum-discriminator/src/Generated/EnumDiscriminatorClient.cs @@ -15,10 +15,12 @@ public partial class EnumDiscriminatorClient { public EnumDiscriminatorClient() : this(new Uri("http://localhost:3000"), new EnumDiscriminatorClientOptions()) => throw null; - public EnumDiscriminatorClient(Uri endpoint, EnumDiscriminatorClientOptions options) => throw null; + internal EnumDiscriminatorClient(AuthenticationPolicy authenticationPolicy, Uri endpoint, EnumDiscriminatorClientOptions options) => throw null; + + public EnumDiscriminatorClient(Uri endpoint, EnumDiscriminatorClientOptions options) : this(null, endpoint, options) => throw null; [Experimental("SCME0002")] - public EnumDiscriminatorClient(EnumDiscriminatorClientSettings settings) : this(settings?.Endpoint, settings?.Options) => throw null; + public EnumDiscriminatorClient(EnumDiscriminatorClientSettings settings) : this(AuthenticationPolicy.Create(settings), settings?.Endpoint, settings?.Options) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/inheritance/nested-discriminator/src/Generated/NestedDiscriminatorClient.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/inheritance/nested-discriminator/src/Generated/NestedDiscriminatorClient.cs index 31927ffdbf0..7e5536731ab 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/inheritance/nested-discriminator/src/Generated/NestedDiscriminatorClient.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/inheritance/nested-discriminator/src/Generated/NestedDiscriminatorClient.cs @@ -15,10 +15,12 @@ public partial class NestedDiscriminatorClient { public NestedDiscriminatorClient() : this(new Uri("http://localhost:3000"), new NestedDiscriminatorClientOptions()) => throw null; - public NestedDiscriminatorClient(Uri endpoint, NestedDiscriminatorClientOptions options) => throw null; + internal NestedDiscriminatorClient(AuthenticationPolicy authenticationPolicy, Uri endpoint, NestedDiscriminatorClientOptions options) => throw null; + + public NestedDiscriminatorClient(Uri endpoint, NestedDiscriminatorClientOptions options) : this(null, endpoint, options) => throw null; [Experimental("SCME0002")] - public NestedDiscriminatorClient(NestedDiscriminatorClientSettings settings) : this(settings?.Endpoint, settings?.Options) => throw null; + public NestedDiscriminatorClient(NestedDiscriminatorClientSettings settings) : this(AuthenticationPolicy.Create(settings), settings?.Endpoint, settings?.Options) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/inheritance/not-discriminated/src/Generated/NotDiscriminatedClient.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/inheritance/not-discriminated/src/Generated/NotDiscriminatedClient.cs index b9945e189b4..4a7e240071e 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/inheritance/not-discriminated/src/Generated/NotDiscriminatedClient.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/inheritance/not-discriminated/src/Generated/NotDiscriminatedClient.cs @@ -15,10 +15,12 @@ public partial class NotDiscriminatedClient { public NotDiscriminatedClient() : this(new Uri("http://localhost:3000"), new NotDiscriminatedClientOptions()) => throw null; - public NotDiscriminatedClient(Uri endpoint, NotDiscriminatedClientOptions options) => throw null; + internal NotDiscriminatedClient(AuthenticationPolicy authenticationPolicy, Uri endpoint, NotDiscriminatedClientOptions options) => throw null; + + public NotDiscriminatedClient(Uri endpoint, NotDiscriminatedClientOptions options) : this(null, endpoint, options) => throw null; [Experimental("SCME0002")] - public NotDiscriminatedClient(NotDiscriminatedClientSettings settings) : this(settings?.Endpoint, settings?.Options) => throw null; + public NotDiscriminatedClient(NotDiscriminatedClientSettings settings) : this(AuthenticationPolicy.Create(settings), settings?.Endpoint, settings?.Options) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/inheritance/recursive/src/Generated/RecursiveClient.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/inheritance/recursive/src/Generated/RecursiveClient.cs index afba4893da8..1f429a7f058 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/inheritance/recursive/src/Generated/RecursiveClient.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/inheritance/recursive/src/Generated/RecursiveClient.cs @@ -15,10 +15,12 @@ public partial class RecursiveClient { public RecursiveClient() : this(new Uri("http://localhost:3000"), new RecursiveClientOptions()) => throw null; - public RecursiveClient(Uri endpoint, RecursiveClientOptions options) => throw null; + internal RecursiveClient(AuthenticationPolicy authenticationPolicy, Uri endpoint, RecursiveClientOptions options) => throw null; + + public RecursiveClient(Uri endpoint, RecursiveClientOptions options) : this(null, endpoint, options) => throw null; [Experimental("SCME0002")] - public RecursiveClient(RecursiveClientSettings settings) : this(settings?.Endpoint, settings?.Options) => throw null; + public RecursiveClient(RecursiveClientSettings settings) : this(AuthenticationPolicy.Create(settings), settings?.Endpoint, settings?.Options) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/inheritance/single-discriminator/src/Generated/SingleDiscriminatorClient.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/inheritance/single-discriminator/src/Generated/SingleDiscriminatorClient.cs index a9884144620..d6a1a0eb170 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/inheritance/single-discriminator/src/Generated/SingleDiscriminatorClient.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/inheritance/single-discriminator/src/Generated/SingleDiscriminatorClient.cs @@ -15,10 +15,12 @@ public partial class SingleDiscriminatorClient { public SingleDiscriminatorClient() : this(new Uri("http://localhost:3000"), new SingleDiscriminatorClientOptions()) => throw null; - public SingleDiscriminatorClient(Uri endpoint, SingleDiscriminatorClientOptions options) => throw null; + internal SingleDiscriminatorClient(AuthenticationPolicy authenticationPolicy, Uri endpoint, SingleDiscriminatorClientOptions options) => throw null; + + public SingleDiscriminatorClient(Uri endpoint, SingleDiscriminatorClientOptions options) : this(null, endpoint, options) => throw null; [Experimental("SCME0002")] - public SingleDiscriminatorClient(SingleDiscriminatorClientSettings settings) : this(settings?.Endpoint, settings?.Options) => throw null; + public SingleDiscriminatorClient(SingleDiscriminatorClientSettings settings) : this(AuthenticationPolicy.Create(settings), settings?.Endpoint, settings?.Options) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/usage/src/Generated/UsageClient.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/usage/src/Generated/UsageClient.cs index 26eccdcc4f3..b1571ae1df5 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/usage/src/Generated/UsageClient.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/usage/src/Generated/UsageClient.cs @@ -15,10 +15,12 @@ public partial class UsageClient { public UsageClient() : this(new Uri("http://localhost:3000"), new UsageClientOptions()) => throw null; - public UsageClient(Uri endpoint, UsageClientOptions options) => throw null; + internal UsageClient(AuthenticationPolicy authenticationPolicy, Uri endpoint, UsageClientOptions options) => throw null; + + public UsageClient(Uri endpoint, UsageClientOptions options) : this(null, endpoint, options) => throw null; [Experimental("SCME0002")] - public UsageClient(UsageClientSettings settings) : this(settings?.Endpoint, settings?.Options) => throw null; + public UsageClient(UsageClientSettings settings) : this(AuthenticationPolicy.Create(settings), settings?.Endpoint, settings?.Options) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/visibility/src/Generated/VisibilityClient.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/visibility/src/Generated/VisibilityClient.cs index 4bda7d3fdcd..dfb167036d6 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/visibility/src/Generated/VisibilityClient.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/visibility/src/Generated/VisibilityClient.cs @@ -15,10 +15,12 @@ public partial class VisibilityClient { public VisibilityClient() : this(new Uri("http://localhost:3000"), new VisibilityClientOptions()) => throw null; - public VisibilityClient(Uri endpoint, VisibilityClientOptions options) => throw null; + internal VisibilityClient(AuthenticationPolicy authenticationPolicy, Uri endpoint, VisibilityClientOptions options) => throw null; + + public VisibilityClient(Uri endpoint, VisibilityClientOptions options) : this(null, endpoint, options) => throw null; [Experimental("SCME0002")] - public VisibilityClient(VisibilityClientSettings settings) : this(settings?.Endpoint, settings?.Options) => throw null; + public VisibilityClient(VisibilityClientSettings settings) : this(AuthenticationPolicy.Create(settings), settings?.Endpoint, settings?.Options) => throw null; public ClientPipeline Pipeline => throw null; From 14a53b5eafd84a8d1c39b268b8ebc53648fc3824 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 11 Mar 2026 04:11:26 +0000 Subject: [PATCH 12/38] fix(http-client-csharp): fix client0/subscriptionId0 bug in this() initializer by reusing same parameter instances from constructor signature Co-authored-by: JoshLove-msft <54595583+JoshLove-msft@users.noreply.github.com> --- .../src/Providers/ClientProvider.cs | 15 ++++++++++----- .../MultiServiceClient_GeneratesExpectedClient.cs | 2 +- ...t_WithThreeServices_GeneratesExpectedClient.cs | 2 +- .../ClientProviderTests/XmlDocsAreWritten.cs | 2 +- .../src/Generated/FirstClient.cs | 6 ++++-- .../src/Generated/Group3.cs | 4 ++++ .../src/Generated/Group4.cs | 4 ++++ .../src/Generated/Group5.cs | 4 ++++ .../src/Generated/SubNamespaceSecondClient.cs | 6 ++++-- .../client/structure/default/src/Generated/Bar.cs | 3 +++ .../client/structure/default/src/Generated/Baz.cs | 4 ++++ .../structure/default/src/Generated/BazFoo.cs | 4 ++++ .../client/structure/default/src/Generated/Foo.cs | 3 +++ .../client/structure/default/src/Generated/Qux.cs | 4 ++++ .../structure/default/src/Generated/QuxBar.cs | 4 ++++ .../default/src/Generated/ServiceClient.cs | 6 ++++-- .../multi-client/src/Generated/ClientAClient.cs | 6 ++++-- .../multi-client/src/Generated/ClientBClient.cs | 6 ++++-- .../renamed-operation/src/Generated/Group.cs | 4 ++++ .../src/Generated/RenamedOperationClient.cs | 6 ++++-- .../two-operation-group/src/Generated/Group1.cs | 4 ++++ .../two-operation-group/src/Generated/Group2.cs | 4 ++++ .../src/Generated/TwoOperationGroupClient.cs | 6 ++++-- .../src/Generated/DocumentationClient.cs | 6 ++++-- .../http/documentation/src/Generated/Lists.cs | 3 +++ .../documentation/src/Generated/TextFormatting.cs | 3 +++ .../encode/array/src/Generated/ArrayClient.cs | 6 ++++-- .../http/encode/array/src/Generated/Property.cs | 3 +++ .../encode/bytes/src/Generated/BytesClient.cs | 6 ++++-- .../http/encode/bytes/src/Generated/Header.cs | 2 ++ .../http/encode/bytes/src/Generated/Property.cs | 3 +++ .../http/encode/bytes/src/Generated/Query.cs | 2 ++ .../encode/bytes/src/Generated/RequestBody.cs | 2 ++ .../encode/bytes/src/Generated/ResponseBody.cs | 2 ++ .../datetime/src/Generated/DatetimeClient.cs | 6 ++++-- .../http/encode/datetime/src/Generated/Header.cs | 2 ++ .../encode/datetime/src/Generated/Property.cs | 3 +++ .../http/encode/datetime/src/Generated/Query.cs | 2 ++ .../datetime/src/Generated/ResponseHeader.cs | 3 +++ .../duration/src/Generated/DurationClient.cs | 6 ++++-- .../http/encode/duration/src/Generated/Header.cs | 2 ++ .../encode/duration/src/Generated/Property.cs | 3 +++ .../http/encode/duration/src/Generated/Query.cs | 2 ++ .../encode/numeric/src/Generated/NumericClient.cs | 6 ++++-- .../http/encode/numeric/src/Generated/Property.cs | 3 +++ .../parameters/basic/src/Generated/BasicClient.cs | 6 ++++-- .../basic/src/Generated/ExplicitBody.cs | 3 +++ .../basic/src/Generated/ImplicitBody.cs | 3 +++ .../src/Generated/BodyOptionalityClient.cs | 6 ++++-- .../src/Generated/OptionalExplicit.cs | 3 +++ .../src/Generated/CollectionFormatClient.cs | 6 ++++-- .../collection-format/src/Generated/Header.cs | 3 +++ .../collection-format/src/Generated/Query.cs | 3 +++ .../parameters/path/src/Generated/PathClient.cs | 6 ++++-- .../parameters/query/src/Generated/Constant.cs | 3 +++ .../parameters/query/src/Generated/QueryClient.cs | 6 ++++-- .../http/parameters/spread/src/Generated/Alias.cs | 3 +++ .../http/parameters/spread/src/Generated/Model.cs | 3 +++ .../spread/src/Generated/SpreadClient.cs | 6 ++++-- .../src/Generated/ContentNegotiationClient.cs | 6 ++++-- .../src/Generated/DifferentBody.cs | 2 ++ .../content-negotiation/src/Generated/SameBody.cs | 2 ++ .../src/Generated/JsonMergePatchClient.cs | 6 ++++-- .../media-type/src/Generated/MediaTypeClient.cs | 6 ++++-- .../media-type/src/Generated/StringBody.cs | 3 +++ .../payload/multipart/src/Generated/FormData.cs | 3 +++ .../multipart/src/Generated/FormDataFile.cs | 3 +++ .../multipart/src/Generated/FormDataHttpParts.cs | 3 +++ .../src/Generated/FormDataHttpPartsContentType.cs | 3 +++ .../src/Generated/FormDataHttpPartsNonString.cs | 3 +++ .../multipart/src/Generated/MultiPartClient.cs | 6 ++++-- .../payload/pageable/src/Generated/PageSize.cs | 3 +++ .../pageable/src/Generated/PageableClient.cs | 6 ++++-- .../src/Generated/ServerDrivenPagination.cs | 3 +++ .../ServerDrivenPaginationContinuationToken.cs | 3 +++ .../pageable/src/Generated/XmlPagination.cs | 3 +++ .../src/Generated/ModelWithArrayOfModelValue.cs | 3 +++ .../xml/src/Generated/ModelWithAttributesValue.cs | 3 +++ .../xml/src/Generated/ModelWithDictionaryValue.cs | 3 +++ .../xml/src/Generated/ModelWithEmptyArrayValue.cs | 3 +++ .../src/Generated/ModelWithEncodedNamesValue.cs | 3 +++ .../src/Generated/ModelWithOptionalFieldValue.cs | 3 +++ .../src/Generated/ModelWithRenamedArraysValue.cs | 3 +++ .../src/Generated/ModelWithRenamedFieldsValue.cs | 3 +++ .../src/Generated/ModelWithSimpleArraysValue.cs | 3 +++ .../xml/src/Generated/ModelWithTextValue.cs | 3 +++ .../src/Generated/ModelWithUnwrappedArrayValue.cs | 3 +++ .../payload/xml/src/Generated/SimpleModelValue.cs | 3 +++ .../http/payload/xml/src/Generated/XmlClient.cs | 6 ++++-- .../payload/xml/src/Generated/XmlErrorValue.cs | 3 +++ .../Generated/ResiliencyServiceDrivenClient.cs | 6 ++++-- .../Generated/ResiliencyServiceDrivenClient.cs | 6 ++++-- .../src/Generated/StatusCodeRangeClient.cs | 6 ++++-- .../http/routes/src/Generated/InInterface.cs | 3 +++ .../http/routes/src/Generated/PathParameters.cs | 3 +++ .../src/Generated/PathParametersLabelExpansion.cs | 3 +++ .../PathParametersLabelExpansionExplode.cs | 3 +++ .../PathParametersLabelExpansionStandard.cs | 3 +++ .../Generated/PathParametersMatrixExpansion.cs | 3 +++ .../PathParametersMatrixExpansionExplode.cs | 3 +++ .../PathParametersMatrixExpansionStandard.cs | 3 +++ .../src/Generated/PathParametersPathExpansion.cs | 3 +++ .../PathParametersPathExpansionExplode.cs | 3 +++ .../PathParametersPathExpansionStandard.cs | 3 +++ .../Generated/PathParametersReservedExpansion.cs | 3 +++ .../Generated/PathParametersSimpleExpansion.cs | 3 +++ .../PathParametersSimpleExpansionExplode.cs | 3 +++ .../PathParametersSimpleExpansionStandard.cs | 3 +++ .../http/routes/src/Generated/QueryParameters.cs | 3 +++ .../Generated/QueryParametersQueryContinuation.cs | 3 +++ .../QueryParametersQueryContinuationExplode.cs | 3 +++ .../QueryParametersQueryContinuationStandard.cs | 3 +++ .../Generated/QueryParametersQueryExpansion.cs | 3 +++ .../QueryParametersQueryExpansionExplode.cs | 3 +++ .../QueryParametersQueryExpansionStandard.cs | 3 +++ .../http/routes/src/Generated/RoutesClient.cs | 6 ++++-- .../encoded-name/json/src/Generated/JsonClient.cs | 6 ++++-- .../encoded-name/json/src/Generated/Property.cs | 3 +++ .../not-defined/src/Generated/NotDefinedClient.cs | 6 ++++-- .../path/multiple/src/Generated/MultipleClient.cs | 6 ++++-- .../path/single/src/Generated/SingleClient.cs | 6 ++++-- .../src/Generated/NotVersionedClient.cs | 6 ++++-- .../versioned/src/Generated/VersionedClient.cs | 6 ++++-- .../src/Generated/ConditionalRequestClient.cs | 6 ++++-- .../src/Generated/RepeatabilityClient.cs | 6 ++++-- .../src/Generated/ModelProperties.cs | 3 +++ .../http/special-words/src/Generated/Models.cs | 3 +++ .../special-words/src/Generated/Operations.cs | 3 +++ .../special-words/src/Generated/Parameters.cs | 3 +++ .../src/Generated/SpecialWordsClient.cs | 6 ++++-- .../http/type/array/src/Generated/ArrayClient.cs | 6 ++++-- .../http/type/array/src/Generated/BooleanValue.cs | 3 +++ .../type/array/src/Generated/DatetimeValue.cs | 2 ++ .../type/array/src/Generated/DurationValue.cs | 2 ++ .../http/type/array/src/Generated/Float32Value.cs | 3 +++ .../http/type/array/src/Generated/Int32Value.cs | 3 +++ .../http/type/array/src/Generated/Int64Value.cs | 3 +++ .../http/type/array/src/Generated/ModelValue.cs | 3 +++ .../array/src/Generated/NullableBooleanValue.cs | 3 +++ .../array/src/Generated/NullableFloatValue.cs | 3 +++ .../array/src/Generated/NullableInt32Value.cs | 3 +++ .../array/src/Generated/NullableModelValue.cs | 3 +++ .../array/src/Generated/NullableStringValue.cs | 3 +++ .../http/type/array/src/Generated/StringValue.cs | 3 +++ .../http/type/array/src/Generated/UnknownValue.cs | 2 ++ .../type/dictionary/src/Generated/BooleanValue.cs | 3 +++ .../dictionary/src/Generated/DatetimeValue.cs | 2 ++ .../dictionary/src/Generated/DictionaryClient.cs | 6 ++++-- .../dictionary/src/Generated/DurationValue.cs | 2 ++ .../type/dictionary/src/Generated/Float32Value.cs | 3 +++ .../type/dictionary/src/Generated/Int32Value.cs | 3 +++ .../type/dictionary/src/Generated/Int64Value.cs | 3 +++ .../type/dictionary/src/Generated/ModelValue.cs | 3 +++ .../src/Generated/NullableFloatValue.cs | 3 +++ .../src/Generated/RecursiveModelValue.cs | 3 +++ .../type/dictionary/src/Generated/StringValue.cs | 3 +++ .../type/dictionary/src/Generated/UnknownValue.cs | 2 ++ .../extensible/src/Generated/ExtensibleClient.cs | 6 ++++-- .../type/enum/extensible/src/Generated/String.cs | 3 +++ .../type/enum/fixed/src/Generated/FixedClient.cs | 6 ++++-- .../http/type/enum/fixed/src/Generated/String.cs | 3 +++ .../src/Generated/AdditionalPropertiesClient.cs | 6 ++++-- .../src/Generated/ExtendsDifferentSpreadFloat.cs | 3 +++ .../src/Generated/ExtendsDifferentSpreadModel.cs | 3 +++ .../Generated/ExtendsDifferentSpreadModelArray.cs | 3 +++ .../src/Generated/ExtendsDifferentSpreadString.cs | 3 +++ .../src/Generated/ExtendsFloat.cs | 3 +++ .../src/Generated/ExtendsModel.cs | 3 +++ .../src/Generated/ExtendsModelArray.cs | 3 +++ .../src/Generated/ExtendsString.cs | 3 +++ .../src/Generated/ExtendsUnknown.cs | 3 +++ .../src/Generated/ExtendsUnknownDerived.cs | 3 +++ .../src/Generated/ExtendsUnknownDiscriminated.cs | 3 +++ .../src/Generated/IsFloat.cs | 3 +++ .../src/Generated/IsModel.cs | 3 +++ .../src/Generated/IsModelArray.cs | 3 +++ .../src/Generated/IsString.cs | 3 +++ .../src/Generated/IsUnknown.cs | 3 +++ .../src/Generated/IsUnknownDerived.cs | 3 +++ .../src/Generated/IsUnknownDiscriminated.cs | 3 +++ .../src/Generated/MultipleSpread.cs | 3 +++ .../src/Generated/SpreadDifferentFloat.cs | 3 +++ .../src/Generated/SpreadDifferentModel.cs | 3 +++ .../src/Generated/SpreadDifferentModelArray.cs | 3 +++ .../src/Generated/SpreadDifferentString.cs | 3 +++ .../src/Generated/SpreadFloat.cs | 3 +++ .../src/Generated/SpreadModel.cs | 3 +++ .../src/Generated/SpreadModelArray.cs | 3 +++ .../SpreadRecordNonDiscriminatedUnion.cs | 3 +++ .../SpreadRecordNonDiscriminatedUnion2.cs | 3 +++ .../SpreadRecordNonDiscriminatedUnion3.cs | 3 +++ .../src/Generated/SpreadRecordUnion.cs | 3 +++ .../src/Generated/SpreadString.cs | 3 +++ .../type/property/nullable/src/Generated/Bytes.cs | 3 +++ .../nullable/src/Generated/CollectionsByte.cs | 3 +++ .../nullable/src/Generated/CollectionsModel.cs | 3 +++ .../nullable/src/Generated/CollectionsString.cs | 3 +++ .../property/nullable/src/Generated/Datetime.cs | 3 +++ .../property/nullable/src/Generated/Duration.cs | 3 +++ .../nullable/src/Generated/NullableClient.cs | 6 ++++-- .../property/nullable/src/Generated/String.cs | 3 +++ .../optionality/src/Generated/BooleanLiteral.cs | 3 +++ .../property/optionality/src/Generated/Bytes.cs | 3 +++ .../optionality/src/Generated/CollectionsByte.cs | 3 +++ .../optionality/src/Generated/CollectionsModel.cs | 3 +++ .../optionality/src/Generated/Datetime.cs | 3 +++ .../optionality/src/Generated/Duration.cs | 3 +++ .../optionality/src/Generated/FloatLiteral.cs | 3 +++ .../optionality/src/Generated/IntLiteral.cs | 3 +++ .../optionality/src/Generated/OptionalClient.cs | 6 ++++-- .../optionality/src/Generated/PlainDate.cs | 3 +++ .../optionality/src/Generated/PlainTime.cs | 3 +++ .../src/Generated/RequiredAndOptional.cs | 3 +++ .../property/optionality/src/Generated/String.cs | 3 +++ .../optionality/src/Generated/StringLiteral.cs | 3 +++ .../src/Generated/UnionFloatLiteral.cs | 3 +++ .../optionality/src/Generated/UnionIntLiteral.cs | 3 +++ .../src/Generated/UnionStringLiteral.cs | 3 +++ .../property/value-types/src/Generated/Boolean.cs | 3 +++ .../value-types/src/Generated/BooleanLiteral.cs | 3 +++ .../property/value-types/src/Generated/Bytes.cs | 3 +++ .../value-types/src/Generated/CollectionsInt.cs | 3 +++ .../value-types/src/Generated/CollectionsModel.cs | 3 +++ .../src/Generated/CollectionsString.cs | 3 +++ .../value-types/src/Generated/Datetime.cs | 3 +++ .../property/value-types/src/Generated/Decimal.cs | 3 +++ .../value-types/src/Generated/Decimal128.cs | 3 +++ .../value-types/src/Generated/DictionaryString.cs | 3 +++ .../value-types/src/Generated/Duration.cs | 3 +++ .../property/value-types/src/Generated/Enum.cs | 3 +++ .../value-types/src/Generated/ExtensibleEnum.cs | 3 +++ .../property/value-types/src/Generated/Float.cs | 3 +++ .../value-types/src/Generated/FloatLiteral.cs | 3 +++ .../property/value-types/src/Generated/Int.cs | 3 +++ .../value-types/src/Generated/IntLiteral.cs | 3 +++ .../property/value-types/src/Generated/Model.cs | 3 +++ .../property/value-types/src/Generated/Never.cs | 3 +++ .../property/value-types/src/Generated/String.cs | 3 +++ .../value-types/src/Generated/StringLiteral.cs | 3 +++ .../value-types/src/Generated/UnionEnumValue.cs | 3 +++ .../src/Generated/UnionFloatLiteral.cs | 3 +++ .../value-types/src/Generated/UnionIntLiteral.cs | 3 +++ .../src/Generated/UnionStringLiteral.cs | 3 +++ .../value-types/src/Generated/UnknownArray.cs | 3 +++ .../value-types/src/Generated/UnknownDict.cs | 3 +++ .../value-types/src/Generated/UnknownInt.cs | 3 +++ .../value-types/src/Generated/UnknownString.cs | 3 +++ .../value-types/src/Generated/ValueTypesClient.cs | 6 ++++-- .../http/type/scalar/src/Generated/Boolean.cs | 3 +++ .../type/scalar/src/Generated/Decimal128Type.cs | 3 +++ .../type/scalar/src/Generated/Decimal128Verify.cs | 3 +++ .../http/type/scalar/src/Generated/DecimalType.cs | 3 +++ .../type/scalar/src/Generated/DecimalVerify.cs | 3 +++ .../type/scalar/src/Generated/ScalarClient.cs | 6 ++++-- .../http/type/scalar/src/Generated/String.cs | 3 +++ .../http/type/scalar/src/Generated/Unknown.cs | 2 ++ .../http/type/union/src/Generated/EnumsOnly.cs | 3 +++ .../http/type/union/src/Generated/FloatsOnly.cs | 3 +++ .../http/type/union/src/Generated/IntsOnly.cs | 3 +++ .../type/union/src/Generated/MixedLiterals.cs | 3 +++ .../http/type/union/src/Generated/MixedTypes.cs | 3 +++ .../http/type/union/src/Generated/ModelsOnly.cs | 2 ++ .../type/union/src/Generated/StringAndArray.cs | 3 +++ .../type/union/src/Generated/StringExtensible.cs | 3 +++ .../union/src/Generated/StringExtensibleNamed.cs | 3 +++ .../http/type/union/src/Generated/StringsOnly.cs | 3 +++ .../http/type/union/src/Generated/UnionClient.cs | 6 ++++-- .../added/v1/src/Generated/AddedClient.cs | 6 ++++-- .../added/v2/src/Generated/AddedClient.cs | 6 ++++-- .../added/v2/src/Generated/InterfaceV2.cs | 3 +++ .../v1/src/Generated/MadeOptionalClient.cs | 6 ++++-- .../v2/src/Generated/MadeOptionalClient.cs | 6 ++++-- .../removed/v1/src/Generated/InterfaceV1.cs | 3 +++ .../removed/v1/src/Generated/RemovedClient.cs | 6 ++++-- .../removed/v2/src/Generated/RemovedClient.cs | 6 ++++-- .../v2Preview/src/Generated/InterfaceV1.cs | 3 +++ .../v2Preview/src/Generated/RemovedClient.cs | 6 ++++-- .../renamedFrom/v1/src/Generated/OldInterface.cs | 3 +++ .../v1/src/Generated/RenamedFromClient.cs | 6 ++++-- .../renamedFrom/v2/src/Generated/NewInterface.cs | 3 +++ .../v2/src/Generated/RenamedFromClient.cs | 6 ++++-- .../src/Generated/ReturnTypeChangedFromClient.cs | 6 ++++-- .../src/Generated/ReturnTypeChangedFromClient.cs | 6 ++++-- .../v1/src/Generated/TypeChangedFromClient.cs | 6 ++++-- .../v2/src/Generated/TypeChangedFromClient.cs | 6 ++++-- 285 files changed, 909 insertions(+), 130 deletions(-) diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Providers/ClientProvider.cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Providers/ClientProvider.cs index 1c3ba3ed76c..bce3f3b9579 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Providers/ClientProvider.cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Providers/ClientProvider.cs @@ -609,9 +609,6 @@ void AppendPublicConstructors( List secondaryConstructors, bool onlyContainsUnsupportedAuth = false) { - // Non-auth required parameters (all required non-endpoint params except auth credential) - var requiredNonAuthParams = GetRequiredParameters(null); - // Public constructor with credential parameter — delegates to the internal constructor. var requiredParameters = GetRequiredParameters(authFields?.AuthField); ParameterProvider[] primaryConstructorParameters = [_endpointParameter, .. requiredParameters, ClientOptionsParameter]; @@ -620,8 +617,16 @@ void AppendPublicConstructors( // Build the auth policy expression for the this() initializer ValueExpression authPolicyArg = BuildAuthPolicyArgument(authFields, requiredParameters); var initializerArgs = new List { authPolicyArg, _endpointParameter }; - foreach (var p in requiredNonAuthParams) - initializerArgs.Add(p); + // Add non-auth required parameters from the SAME parameter list (requiredParameters) + // to ensure the initializer references the same objects as the constructor signature. + string? authParamName = authFields != null + ? (authFields.AuthField.Name != TokenProviderFieldName ? "credential" : authFields.AuthField.AsParameter.Name) + : null; + foreach (var p in requiredParameters) + { + if (authParamName == null || p.Name != authParamName) + initializerArgs.Add(p); + } initializerArgs.Add(ClientOptionsParameter!); var primaryConstructor = new ConstructorProvider( diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientProviders/TestData/ClientProviderTests/MultiServiceClient_GeneratesExpectedClient.cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientProviders/TestData/ClientProviderTests/MultiServiceClient_GeneratesExpectedClient.cs index fb7350c4adb..d432f75ec62 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientProviders/TestData/ClientProviderTests/MultiServiceClient_GeneratesExpectedClient.cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientProviders/TestData/ClientProviderTests/MultiServiceClient_GeneratesExpectedClient.cs @@ -38,7 +38,7 @@ internal TestClient(global::System.ClientModel.Primitives.AuthenticationPolicy a _serviceBApiVersion = options.ServiceBApiVersion; } - public TestClient(global::System.Uri endpoint, string subscriptionId, global::Sample.TestClientOptions options) : this(null, endpoint, subscriptionId0, options) + public TestClient(global::System.Uri endpoint, string subscriptionId, global::Sample.TestClientOptions options) : this(null, endpoint, subscriptionId, options) { } diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientProviders/TestData/ClientProviderTests/MultiServiceClient_WithThreeServices_GeneratesExpectedClient.cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientProviders/TestData/ClientProviderTests/MultiServiceClient_WithThreeServices_GeneratesExpectedClient.cs index 3ea30fbed04..05acee396e7 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientProviders/TestData/ClientProviderTests/MultiServiceClient_WithThreeServices_GeneratesExpectedClient.cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientProviders/TestData/ClientProviderTests/MultiServiceClient_WithThreeServices_GeneratesExpectedClient.cs @@ -42,7 +42,7 @@ internal TestClient(global::System.ClientModel.Primitives.AuthenticationPolicy a _serviceStorageApiVersion = options.ServiceStorageApiVersion; } - public TestClient(global::System.Uri endpoint, string subscriptionId, global::Sample.TestClientOptions options) : this(null, endpoint, subscriptionId0, options) + public TestClient(global::System.Uri endpoint, string subscriptionId, global::Sample.TestClientOptions options) : this(null, endpoint, subscriptionId, options) { } diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientProviders/TestData/ClientProviderTests/XmlDocsAreWritten.cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientProviders/TestData/ClientProviderTests/XmlDocsAreWritten.cs index 7896bda5ae8..3b17afddd36 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientProviders/TestData/ClientProviderTests/XmlDocsAreWritten.cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientProviders/TestData/ClientProviderTests/XmlDocsAreWritten.cs @@ -50,7 +50,7 @@ internal TestClient(global::System.ClientModel.Primitives.AuthenticationPolicy a /// The options for configuring the client. /// or is null. /// is an empty string, and was expected to be non-empty. - public TestClient(global::System.Uri endpoint, string queryParam, global::Sample.TestClientOptions options) : this(null, endpoint, queryParam0, options) + public TestClient(global::System.Uri endpoint, string queryParam, global::Sample.TestClientOptions options) : this(null, endpoint, queryParam, options) { } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/client-operation-group/src/Generated/FirstClient.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/client-operation-group/src/Generated/FirstClient.cs index 2d72fa8f02f..0ae16d068ff 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/client-operation-group/src/Generated/FirstClient.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/client-operation-group/src/Generated/FirstClient.cs @@ -18,10 +18,12 @@ public partial class FirstClient public FirstClient(Uri endpoint, ClientType client) : this(endpoint, client, new FirstClientOptions()) => throw null; - public FirstClient(Uri endpoint, ClientType client, FirstClientOptions options) => throw null; + internal FirstClient(AuthenticationPolicy authenticationPolicy, Uri endpoint, ClientType client, FirstClientOptions options) => throw null; + + public FirstClient(Uri endpoint, ClientType client, FirstClientOptions options) : this(null, endpoint, client, options) => throw null; [Experimental("SCME0002")] - public FirstClient(FirstClientSettings settings) : this(settings?.Endpoint, settings?.Client ?? default, settings?.Options) => throw null; + public FirstClient(FirstClientSettings settings) : this(AuthenticationPolicy.Create(settings), settings?.Endpoint, settings?.Client ?? default, settings?.Options) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/client-operation-group/src/Generated/Group3.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/client-operation-group/src/Generated/Group3.cs index 36f592b901d..424b1f729bd 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/client-operation-group/src/Generated/Group3.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/client-operation-group/src/Generated/Group3.cs @@ -2,10 +2,12 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; using System.Threading.Tasks; +using Client.Structure.Service; namespace Client.Structure.ClientOperationGroup { @@ -13,6 +15,8 @@ public partial class Group3 { protected Group3() => throw null; + internal Group3(ClientPipeline pipeline, Uri endpoint, ClientType client) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult Two(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/client-operation-group/src/Generated/Group4.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/client-operation-group/src/Generated/Group4.cs index 5470b3bbc52..6f372e14c53 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/client-operation-group/src/Generated/Group4.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/client-operation-group/src/Generated/Group4.cs @@ -2,10 +2,12 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; using System.Threading.Tasks; +using Client.Structure.Service; namespace Client.Structure.ClientOperationGroup { @@ -13,6 +15,8 @@ public partial class Group4 { protected Group4() => throw null; + internal Group4(ClientPipeline pipeline, Uri endpoint, ClientType client) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult Four(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/client-operation-group/src/Generated/Group5.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/client-operation-group/src/Generated/Group5.cs index eb10cff56a7..16a035048f3 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/client-operation-group/src/Generated/Group5.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/client-operation-group/src/Generated/Group5.cs @@ -2,10 +2,12 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; using System.Threading.Tasks; +using Client.Structure.Service; namespace Client.Structure.AnotherClientOperationGroup { @@ -13,6 +15,8 @@ public partial class Group5 { protected Group5() => throw null; + internal Group5(ClientPipeline pipeline, Uri endpoint, ClientType client) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult Six(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/client-operation-group/src/Generated/SubNamespaceSecondClient.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/client-operation-group/src/Generated/SubNamespaceSecondClient.cs index 999e911015f..693eca9df30 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/client-operation-group/src/Generated/SubNamespaceSecondClient.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/client-operation-group/src/Generated/SubNamespaceSecondClient.cs @@ -18,10 +18,12 @@ public partial class SubNamespaceSecondClient public SubNamespaceSecondClient(Uri endpoint, ClientType client) : this(endpoint, client, new SubNamespaceSecondClientOptions()) => throw null; - public SubNamespaceSecondClient(Uri endpoint, ClientType client, SubNamespaceSecondClientOptions options) => throw null; + internal SubNamespaceSecondClient(AuthenticationPolicy authenticationPolicy, Uri endpoint, ClientType client, SubNamespaceSecondClientOptions options) => throw null; + + public SubNamespaceSecondClient(Uri endpoint, ClientType client, SubNamespaceSecondClientOptions options) : this(null, endpoint, client, options) => throw null; [Experimental("SCME0002")] - public SubNamespaceSecondClient(SubNamespaceSecondClientSettings settings) : this(settings?.Endpoint, settings?.Client ?? default, settings?.Options) => throw null; + public SubNamespaceSecondClient(SubNamespaceSecondClientSettings settings) : this(AuthenticationPolicy.Create(settings), settings?.Endpoint, settings?.Client ?? default, settings?.Options) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/default/src/Generated/Bar.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/default/src/Generated/Bar.cs index b477c997e2f..ecb520de880 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/default/src/Generated/Bar.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/default/src/Generated/Bar.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -13,6 +14,8 @@ public partial class Bar { protected Bar() => throw null; + internal Bar(ClientPipeline pipeline, Uri endpoint, ClientType client) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult Five(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/default/src/Generated/Baz.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/default/src/Generated/Baz.cs index c13fd297ec5..9846828d6a2 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/default/src/Generated/Baz.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/default/src/Generated/Baz.cs @@ -2,7 +2,9 @@ #nullable disable +using System; using System.ClientModel.Primitives; +using Client.Structure.Service; namespace Client.Structure.Service._Baz { @@ -10,6 +12,8 @@ public partial class Baz { protected Baz() => throw null; + internal Baz(ClientPipeline pipeline, Uri endpoint, ClientType client) => throw null; + public ClientPipeline Pipeline => throw null; public virtual BazFoo GetBazFooClient() => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/default/src/Generated/BazFoo.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/default/src/Generated/BazFoo.cs index 6ed62d51d4e..4b8d81d5939 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/default/src/Generated/BazFoo.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/default/src/Generated/BazFoo.cs @@ -2,10 +2,12 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; using System.Threading.Tasks; +using Client.Structure.Service; namespace Client.Structure.Service._Baz { @@ -13,6 +15,8 @@ public partial class BazFoo { protected BazFoo() => throw null; + internal BazFoo(ClientPipeline pipeline, Uri endpoint, ClientType client) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult Seven(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/default/src/Generated/Foo.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/default/src/Generated/Foo.cs index 4989e29298c..40c3caa537f 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/default/src/Generated/Foo.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/default/src/Generated/Foo.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -13,6 +14,8 @@ public partial class Foo { protected Foo() => throw null; + internal Foo(ClientPipeline pipeline, Uri endpoint, ClientType client) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult Three(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/default/src/Generated/Qux.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/default/src/Generated/Qux.cs index e94b919e17f..886bf284df7 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/default/src/Generated/Qux.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/default/src/Generated/Qux.cs @@ -2,10 +2,12 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; using System.Threading.Tasks; +using Client.Structure.Service; namespace Client.Structure.Service._Qux { @@ -13,6 +15,8 @@ public partial class Qux { protected Qux() => throw null; + internal Qux(ClientPipeline pipeline, Uri endpoint, ClientType client) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult Eight(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/default/src/Generated/QuxBar.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/default/src/Generated/QuxBar.cs index 1cf32f91487..5b7bc794ae7 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/default/src/Generated/QuxBar.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/default/src/Generated/QuxBar.cs @@ -2,10 +2,12 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; using System.Threading.Tasks; +using Client.Structure.Service; namespace Client.Structure.Service._Qux { @@ -13,6 +15,8 @@ public partial class QuxBar { protected QuxBar() => throw null; + internal QuxBar(ClientPipeline pipeline, Uri endpoint, ClientType client) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult Nine(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/default/src/Generated/ServiceClient.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/default/src/Generated/ServiceClient.cs index 36534cbc6b0..7dd25ed35c3 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/default/src/Generated/ServiceClient.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/default/src/Generated/ServiceClient.cs @@ -19,10 +19,12 @@ public partial class ServiceClient public ServiceClient(Uri endpoint, ClientType client) : this(endpoint, client, new ServiceClientOptions()) => throw null; - public ServiceClient(Uri endpoint, ClientType client, ServiceClientOptions options) => throw null; + internal ServiceClient(AuthenticationPolicy authenticationPolicy, Uri endpoint, ClientType client, ServiceClientOptions options) => throw null; + + public ServiceClient(Uri endpoint, ClientType client, ServiceClientOptions options) : this(null, endpoint, client, options) => throw null; [Experimental("SCME0002")] - public ServiceClient(ServiceClientSettings settings) : this(settings?.Endpoint, settings?.Client ?? default, settings?.Options) => throw null; + public ServiceClient(ServiceClientSettings settings) : this(AuthenticationPolicy.Create(settings), settings?.Endpoint, settings?.Client ?? default, settings?.Options) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/multi-client/src/Generated/ClientAClient.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/multi-client/src/Generated/ClientAClient.cs index ee68e7681a6..8c586cc178c 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/multi-client/src/Generated/ClientAClient.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/multi-client/src/Generated/ClientAClient.cs @@ -18,10 +18,12 @@ public partial class ClientAClient public ClientAClient(Uri endpoint, ClientType client) : this(endpoint, client, new ClientAClientOptions()) => throw null; - public ClientAClient(Uri endpoint, ClientType client, ClientAClientOptions options) => throw null; + internal ClientAClient(AuthenticationPolicy authenticationPolicy, Uri endpoint, ClientType client, ClientAClientOptions options) => throw null; + + public ClientAClient(Uri endpoint, ClientType client, ClientAClientOptions options) : this(null, endpoint, client, options) => throw null; [Experimental("SCME0002")] - public ClientAClient(ClientAClientSettings settings) : this(settings?.Endpoint, settings?.Client ?? default, settings?.Options) => throw null; + public ClientAClient(ClientAClientSettings settings) : this(AuthenticationPolicy.Create(settings), settings?.Endpoint, settings?.Client ?? default, settings?.Options) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/multi-client/src/Generated/ClientBClient.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/multi-client/src/Generated/ClientBClient.cs index 72c3b2441ef..603a41b38b0 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/multi-client/src/Generated/ClientBClient.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/multi-client/src/Generated/ClientBClient.cs @@ -18,10 +18,12 @@ public partial class ClientBClient public ClientBClient(Uri endpoint, ClientType client) : this(endpoint, client, new ClientBClientOptions()) => throw null; - public ClientBClient(Uri endpoint, ClientType client, ClientBClientOptions options) => throw null; + internal ClientBClient(AuthenticationPolicy authenticationPolicy, Uri endpoint, ClientType client, ClientBClientOptions options) => throw null; + + public ClientBClient(Uri endpoint, ClientType client, ClientBClientOptions options) : this(null, endpoint, client, options) => throw null; [Experimental("SCME0002")] - public ClientBClient(ClientBClientSettings settings) : this(settings?.Endpoint, settings?.Client ?? default, settings?.Options) => throw null; + public ClientBClient(ClientBClientSettings settings) : this(AuthenticationPolicy.Create(settings), settings?.Endpoint, settings?.Client ?? default, settings?.Options) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/renamed-operation/src/Generated/Group.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/renamed-operation/src/Generated/Group.cs index 43d04d3edb0..f9ce619bfe6 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/renamed-operation/src/Generated/Group.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/renamed-operation/src/Generated/Group.cs @@ -2,10 +2,12 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; using System.Threading.Tasks; +using Client.Structure.Service; namespace Client.Structure.RenamedOperation { @@ -13,6 +15,8 @@ public partial class Group { protected Group() => throw null; + internal Group(ClientPipeline pipeline, Uri endpoint, ClientType client) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult RenamedTwo(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/renamed-operation/src/Generated/RenamedOperationClient.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/renamed-operation/src/Generated/RenamedOperationClient.cs index 93d800011fd..a3aa6ae6103 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/renamed-operation/src/Generated/RenamedOperationClient.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/renamed-operation/src/Generated/RenamedOperationClient.cs @@ -18,10 +18,12 @@ public partial class RenamedOperationClient public RenamedOperationClient(Uri endpoint, ClientType client) : this(endpoint, client, new RenamedOperationClientOptions()) => throw null; - public RenamedOperationClient(Uri endpoint, ClientType client, RenamedOperationClientOptions options) => throw null; + internal RenamedOperationClient(AuthenticationPolicy authenticationPolicy, Uri endpoint, ClientType client, RenamedOperationClientOptions options) => throw null; + + public RenamedOperationClient(Uri endpoint, ClientType client, RenamedOperationClientOptions options) : this(null, endpoint, client, options) => throw null; [Experimental("SCME0002")] - public RenamedOperationClient(RenamedOperationClientSettings settings) : this(settings?.Endpoint, settings?.Client ?? default, settings?.Options) => throw null; + public RenamedOperationClient(RenamedOperationClientSettings settings) : this(AuthenticationPolicy.Create(settings), settings?.Endpoint, settings?.Client ?? default, settings?.Options) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/two-operation-group/src/Generated/Group1.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/two-operation-group/src/Generated/Group1.cs index 4657d169616..292fd14c3c6 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/two-operation-group/src/Generated/Group1.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/two-operation-group/src/Generated/Group1.cs @@ -2,10 +2,12 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; using System.Threading.Tasks; +using Client.Structure.Service; namespace Client.Structure.TwoOperationGroup { @@ -13,6 +15,8 @@ public partial class Group1 { protected Group1() => throw null; + internal Group1(ClientPipeline pipeline, Uri endpoint, ClientType client) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult One(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/two-operation-group/src/Generated/Group2.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/two-operation-group/src/Generated/Group2.cs index 783310627ed..9b04ac2eba9 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/two-operation-group/src/Generated/Group2.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/two-operation-group/src/Generated/Group2.cs @@ -2,10 +2,12 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; using System.Threading.Tasks; +using Client.Structure.Service; namespace Client.Structure.TwoOperationGroup { @@ -13,6 +15,8 @@ public partial class Group2 { protected Group2() => throw null; + internal Group2(ClientPipeline pipeline, Uri endpoint, ClientType client) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult Two(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/two-operation-group/src/Generated/TwoOperationGroupClient.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/two-operation-group/src/Generated/TwoOperationGroupClient.cs index 724f534da1e..a5ae0dae401 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/two-operation-group/src/Generated/TwoOperationGroupClient.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/two-operation-group/src/Generated/TwoOperationGroupClient.cs @@ -15,10 +15,12 @@ public partial class TwoOperationGroupClient public TwoOperationGroupClient(Uri endpoint, ClientType client) : this(endpoint, client, new TwoOperationGroupClientOptions()) => throw null; - public TwoOperationGroupClient(Uri endpoint, ClientType client, TwoOperationGroupClientOptions options) => throw null; + internal TwoOperationGroupClient(AuthenticationPolicy authenticationPolicy, Uri endpoint, ClientType client, TwoOperationGroupClientOptions options) => throw null; + + public TwoOperationGroupClient(Uri endpoint, ClientType client, TwoOperationGroupClientOptions options) : this(null, endpoint, client, options) => throw null; [Experimental("SCME0002")] - public TwoOperationGroupClient(TwoOperationGroupClientSettings settings) : this(settings?.Endpoint, settings?.Client ?? default, settings?.Options) => throw null; + public TwoOperationGroupClient(TwoOperationGroupClientSettings settings) : this(AuthenticationPolicy.Create(settings), settings?.Endpoint, settings?.Client ?? default, settings?.Options) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/documentation/src/Generated/DocumentationClient.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/documentation/src/Generated/DocumentationClient.cs index 1b4f533629a..a666718a60c 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/documentation/src/Generated/DocumentationClient.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/documentation/src/Generated/DocumentationClient.cs @@ -14,10 +14,12 @@ public partial class DocumentationClient { public DocumentationClient() : this(new Uri("http://localhost:3000"), new DocumentationClientOptions()) => throw null; - public DocumentationClient(Uri endpoint, DocumentationClientOptions options) => throw null; + internal DocumentationClient(AuthenticationPolicy authenticationPolicy, Uri endpoint, DocumentationClientOptions options) => throw null; + + public DocumentationClient(Uri endpoint, DocumentationClientOptions options) : this(null, endpoint, options) => throw null; [Experimental("SCME0002")] - public DocumentationClient(DocumentationClientSettings settings) : this(settings?.Endpoint, settings?.Options) => throw null; + public DocumentationClient(DocumentationClientSettings settings) : this(AuthenticationPolicy.Create(settings), settings?.Endpoint, settings?.Options) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/documentation/src/Generated/Lists.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/documentation/src/Generated/Lists.cs index 34bf1c4e427..448bdd8c7c6 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/documentation/src/Generated/Lists.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/documentation/src/Generated/Lists.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -13,6 +14,8 @@ public partial class Lists { protected Lists() => throw null; + internal Lists(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult BulletPointsOp(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/documentation/src/Generated/TextFormatting.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/documentation/src/Generated/TextFormatting.cs index 6fb8a1e8646..d2190f98461 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/documentation/src/Generated/TextFormatting.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/documentation/src/Generated/TextFormatting.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -13,6 +14,8 @@ public partial class TextFormatting { protected TextFormatting() => throw null; + internal TextFormatting(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult BoldText(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/array/src/Generated/ArrayClient.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/array/src/Generated/ArrayClient.cs index 9398d01f302..be13cf124dd 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/array/src/Generated/ArrayClient.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/array/src/Generated/ArrayClient.cs @@ -13,10 +13,12 @@ public partial class ArrayClient { public ArrayClient() : this(new Uri("http://localhost:3000"), new ArrayClientOptions()) => throw null; - public ArrayClient(Uri endpoint, ArrayClientOptions options) => throw null; + internal ArrayClient(AuthenticationPolicy authenticationPolicy, Uri endpoint, ArrayClientOptions options) => throw null; + + public ArrayClient(Uri endpoint, ArrayClientOptions options) : this(null, endpoint, options) => throw null; [Experimental("SCME0002")] - public ArrayClient(ArrayClientSettings settings) : this(settings?.Endpoint, settings?.Options) => throw null; + public ArrayClient(ArrayClientSettings settings) : this(AuthenticationPolicy.Create(settings), settings?.Endpoint, settings?.Options) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/array/src/Generated/Property.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/array/src/Generated/Property.cs index 11ac1e8bde6..cca72b3496d 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/array/src/Generated/Property.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/array/src/Generated/Property.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -14,6 +15,8 @@ public partial class Property { protected Property() => throw null; + internal Property(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult CommaDelimited(BinaryContent content, RequestOptions options = null) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/bytes/src/Generated/BytesClient.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/bytes/src/Generated/BytesClient.cs index aa4260d61d9..66889ea19e6 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/bytes/src/Generated/BytesClient.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/bytes/src/Generated/BytesClient.cs @@ -17,10 +17,12 @@ public partial class BytesClient { public BytesClient() : this(new Uri("http://localhost:3000"), new BytesClientOptions()) => throw null; - public BytesClient(Uri endpoint, BytesClientOptions options) => throw null; + internal BytesClient(AuthenticationPolicy authenticationPolicy, Uri endpoint, BytesClientOptions options) => throw null; + + public BytesClient(Uri endpoint, BytesClientOptions options) : this(null, endpoint, options) => throw null; [Experimental("SCME0002")] - public BytesClient(BytesClientSettings settings) : this(settings?.Endpoint, settings?.Options) => throw null; + public BytesClient(BytesClientSettings settings) : this(AuthenticationPolicy.Create(settings), settings?.Endpoint, settings?.Options) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/bytes/src/Generated/Header.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/bytes/src/Generated/Header.cs index 04f54e9db06..fd23134b48c 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/bytes/src/Generated/Header.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/bytes/src/Generated/Header.cs @@ -15,6 +15,8 @@ public partial class Header { protected Header() => throw null; + internal Header(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult Default(BinaryData value, RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/bytes/src/Generated/Property.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/bytes/src/Generated/Property.cs index cd447f162f2..98856cd5b6c 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/bytes/src/Generated/Property.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/bytes/src/Generated/Property.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -14,6 +15,8 @@ public partial class Property { protected Property() => throw null; + internal Property(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult Default(BinaryContent content, RequestOptions options = null) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/bytes/src/Generated/Query.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/bytes/src/Generated/Query.cs index e833cb0b334..a4bdf915ccf 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/bytes/src/Generated/Query.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/bytes/src/Generated/Query.cs @@ -15,6 +15,8 @@ public partial class Query { protected Query() => throw null; + internal Query(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult Default(BinaryData value, RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/bytes/src/Generated/RequestBody.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/bytes/src/Generated/RequestBody.cs index 8f2b981bd11..11350490a12 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/bytes/src/Generated/RequestBody.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/bytes/src/Generated/RequestBody.cs @@ -14,6 +14,8 @@ public partial class RequestBody { protected RequestBody() => throw null; + internal RequestBody(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult Default(BinaryContent content, RequestOptions options = null) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/bytes/src/Generated/ResponseBody.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/bytes/src/Generated/ResponseBody.cs index d61d52ae44f..2ccbb28aadf 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/bytes/src/Generated/ResponseBody.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/bytes/src/Generated/ResponseBody.cs @@ -14,6 +14,8 @@ public partial class ResponseBody { protected ResponseBody() => throw null; + internal ResponseBody(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult Default(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/datetime/src/Generated/DatetimeClient.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/datetime/src/Generated/DatetimeClient.cs index 3620302eb68..52989bc8104 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/datetime/src/Generated/DatetimeClient.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/datetime/src/Generated/DatetimeClient.cs @@ -16,10 +16,12 @@ public partial class DatetimeClient { public DatetimeClient() : this(new Uri("http://localhost:3000"), new DatetimeClientOptions()) => throw null; - public DatetimeClient(Uri endpoint, DatetimeClientOptions options) => throw null; + internal DatetimeClient(AuthenticationPolicy authenticationPolicy, Uri endpoint, DatetimeClientOptions options) => throw null; + + public DatetimeClient(Uri endpoint, DatetimeClientOptions options) : this(null, endpoint, options) => throw null; [Experimental("SCME0002")] - public DatetimeClient(DatetimeClientSettings settings) : this(settings?.Endpoint, settings?.Options) => throw null; + public DatetimeClient(DatetimeClientSettings settings) : this(AuthenticationPolicy.Create(settings), settings?.Endpoint, settings?.Options) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/datetime/src/Generated/Header.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/datetime/src/Generated/Header.cs index 5fb8d90bc90..73e83a93a8d 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/datetime/src/Generated/Header.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/datetime/src/Generated/Header.cs @@ -15,6 +15,8 @@ public partial class Header { protected Header() => throw null; + internal Header(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult Default(DateTimeOffset value, RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/datetime/src/Generated/Property.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/datetime/src/Generated/Property.cs index 2a05e4eb487..178a86cf0b2 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/datetime/src/Generated/Property.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/datetime/src/Generated/Property.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -14,6 +15,8 @@ public partial class Property { protected Property() => throw null; + internal Property(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult Default(BinaryContent content, RequestOptions options = null) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/datetime/src/Generated/Query.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/datetime/src/Generated/Query.cs index 797db67529f..2e39c63316f 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/datetime/src/Generated/Query.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/datetime/src/Generated/Query.cs @@ -15,6 +15,8 @@ public partial class Query { protected Query() => throw null; + internal Query(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult Default(DateTimeOffset value, RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/datetime/src/Generated/ResponseHeader.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/datetime/src/Generated/ResponseHeader.cs index 01d39032c85..0f6c15d6f9e 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/datetime/src/Generated/ResponseHeader.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/datetime/src/Generated/ResponseHeader.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -13,6 +14,8 @@ public partial class ResponseHeader { protected ResponseHeader() => throw null; + internal ResponseHeader(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult Default(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/duration/src/Generated/DurationClient.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/duration/src/Generated/DurationClient.cs index 2d3a7bc7cec..efdd9208ab4 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/duration/src/Generated/DurationClient.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/duration/src/Generated/DurationClient.cs @@ -15,10 +15,12 @@ public partial class DurationClient { public DurationClient() : this(new Uri("http://localhost:3000"), new DurationClientOptions()) => throw null; - public DurationClient(Uri endpoint, DurationClientOptions options) => throw null; + internal DurationClient(AuthenticationPolicy authenticationPolicy, Uri endpoint, DurationClientOptions options) => throw null; + + public DurationClient(Uri endpoint, DurationClientOptions options) : this(null, endpoint, options) => throw null; [Experimental("SCME0002")] - public DurationClient(DurationClientSettings settings) : this(settings?.Endpoint, settings?.Options) => throw null; + public DurationClient(DurationClientSettings settings) : this(AuthenticationPolicy.Create(settings), settings?.Endpoint, settings?.Options) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/duration/src/Generated/Header.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/duration/src/Generated/Header.cs index f8b13ad6053..60aaa9d639d 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/duration/src/Generated/Header.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/duration/src/Generated/Header.cs @@ -15,6 +15,8 @@ public partial class Header { protected Header() => throw null; + internal Header(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult Default(TimeSpan duration, RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/duration/src/Generated/Property.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/duration/src/Generated/Property.cs index 68a98785695..5932c8916b1 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/duration/src/Generated/Property.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/duration/src/Generated/Property.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -13,6 +14,8 @@ public partial class Property { protected Property() => throw null; + internal Property(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult Default(BinaryContent content, RequestOptions options = null) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/duration/src/Generated/Query.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/duration/src/Generated/Query.cs index ab8d0db30f9..3389d4bc03c 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/duration/src/Generated/Query.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/duration/src/Generated/Query.cs @@ -15,6 +15,8 @@ public partial class Query { protected Query() => throw null; + internal Query(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult Default(TimeSpan input, RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/numeric/src/Generated/NumericClient.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/numeric/src/Generated/NumericClient.cs index f7b5a16fb1f..62c37a7e84d 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/numeric/src/Generated/NumericClient.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/numeric/src/Generated/NumericClient.cs @@ -13,10 +13,12 @@ public partial class NumericClient { public NumericClient() : this(new Uri("http://localhost:3000"), new NumericClientOptions()) => throw null; - public NumericClient(Uri endpoint, NumericClientOptions options) => throw null; + internal NumericClient(AuthenticationPolicy authenticationPolicy, Uri endpoint, NumericClientOptions options) => throw null; + + public NumericClient(Uri endpoint, NumericClientOptions options) : this(null, endpoint, options) => throw null; [Experimental("SCME0002")] - public NumericClient(NumericClientSettings settings) : this(settings?.Endpoint, settings?.Options) => throw null; + public NumericClient(NumericClientSettings settings) : this(AuthenticationPolicy.Create(settings), settings?.Endpoint, settings?.Options) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/numeric/src/Generated/Property.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/numeric/src/Generated/Property.cs index 49349a4add9..a24512ae6df 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/numeric/src/Generated/Property.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/numeric/src/Generated/Property.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -13,6 +14,8 @@ public partial class Property { protected Property() => throw null; + internal Property(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult SafeintAsString(BinaryContent content, RequestOptions options = null) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/basic/src/Generated/BasicClient.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/basic/src/Generated/BasicClient.cs index bf0f4d22e3e..14502febffd 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/basic/src/Generated/BasicClient.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/basic/src/Generated/BasicClient.cs @@ -14,10 +14,12 @@ public partial class BasicClient { public BasicClient() : this(new Uri("http://localhost:3000"), new BasicClientOptions()) => throw null; - public BasicClient(Uri endpoint, BasicClientOptions options) => throw null; + internal BasicClient(AuthenticationPolicy authenticationPolicy, Uri endpoint, BasicClientOptions options) => throw null; + + public BasicClient(Uri endpoint, BasicClientOptions options) : this(null, endpoint, options) => throw null; [Experimental("SCME0002")] - public BasicClient(BasicClientSettings settings) : this(settings?.Endpoint, settings?.Options) => throw null; + public BasicClient(BasicClientSettings settings) : this(AuthenticationPolicy.Create(settings), settings?.Endpoint, settings?.Options) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/basic/src/Generated/ExplicitBody.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/basic/src/Generated/ExplicitBody.cs index 383030dc1bf..d9157b03926 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/basic/src/Generated/ExplicitBody.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/basic/src/Generated/ExplicitBody.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -13,6 +14,8 @@ public partial class ExplicitBody { protected ExplicitBody() => throw null; + internal ExplicitBody(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult Simple(BinaryContent content, RequestOptions options = null) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/basic/src/Generated/ImplicitBody.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/basic/src/Generated/ImplicitBody.cs index 478ec3b4e2e..8d46cf80d63 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/basic/src/Generated/ImplicitBody.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/basic/src/Generated/ImplicitBody.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -13,6 +14,8 @@ public partial class ImplicitBody { protected ImplicitBody() => throw null; + internal ImplicitBody(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult Simple(BinaryContent content, RequestOptions options = null) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/body-optionality/src/Generated/BodyOptionalityClient.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/body-optionality/src/Generated/BodyOptionalityClient.cs index 8ada2ace385..457b49eac2f 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/body-optionality/src/Generated/BodyOptionalityClient.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/body-optionality/src/Generated/BodyOptionalityClient.cs @@ -16,10 +16,12 @@ public partial class BodyOptionalityClient { public BodyOptionalityClient() : this(new Uri("http://localhost:3000"), new BodyOptionalityClientOptions()) => throw null; - public BodyOptionalityClient(Uri endpoint, BodyOptionalityClientOptions options) => throw null; + internal BodyOptionalityClient(AuthenticationPolicy authenticationPolicy, Uri endpoint, BodyOptionalityClientOptions options) => throw null; + + public BodyOptionalityClient(Uri endpoint, BodyOptionalityClientOptions options) : this(null, endpoint, options) => throw null; [Experimental("SCME0002")] - public BodyOptionalityClient(BodyOptionalityClientSettings settings) : this(settings?.Endpoint, settings?.Options) => throw null; + public BodyOptionalityClient(BodyOptionalityClientSettings settings) : this(AuthenticationPolicy.Create(settings), settings?.Endpoint, settings?.Options) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/body-optionality/src/Generated/OptionalExplicit.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/body-optionality/src/Generated/OptionalExplicit.cs index ffa4809571b..5d4de240634 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/body-optionality/src/Generated/OptionalExplicit.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/body-optionality/src/Generated/OptionalExplicit.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -14,6 +15,8 @@ public partial class OptionalExplicit { protected OptionalExplicit() => throw null; + internal OptionalExplicit(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult Set(BinaryContent content, RequestOptions options = null) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/collection-format/src/Generated/CollectionFormatClient.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/collection-format/src/Generated/CollectionFormatClient.cs index b01cbda1fa4..cfac396e5f9 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/collection-format/src/Generated/CollectionFormatClient.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/collection-format/src/Generated/CollectionFormatClient.cs @@ -14,10 +14,12 @@ public partial class CollectionFormatClient { public CollectionFormatClient() : this(new Uri("http://localhost:3000"), new CollectionFormatClientOptions()) => throw null; - public CollectionFormatClient(Uri endpoint, CollectionFormatClientOptions options) => throw null; + internal CollectionFormatClient(AuthenticationPolicy authenticationPolicy, Uri endpoint, CollectionFormatClientOptions options) => throw null; + + public CollectionFormatClient(Uri endpoint, CollectionFormatClientOptions options) : this(null, endpoint, options) => throw null; [Experimental("SCME0002")] - public CollectionFormatClient(CollectionFormatClientSettings settings) : this(settings?.Endpoint, settings?.Options) => throw null; + public CollectionFormatClient(CollectionFormatClientSettings settings) : this(AuthenticationPolicy.Create(settings), settings?.Endpoint, settings?.Options) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/collection-format/src/Generated/Header.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/collection-format/src/Generated/Header.cs index 6188a2785ea..e29a1876bcd 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/collection-format/src/Generated/Header.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/collection-format/src/Generated/Header.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Collections.Generic; @@ -14,6 +15,8 @@ public partial class Header { protected Header() => throw null; + internal Header(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult Csv(IEnumerable colors, RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/collection-format/src/Generated/Query.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/collection-format/src/Generated/Query.cs index c54d95436b6..f0d37525882 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/collection-format/src/Generated/Query.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/collection-format/src/Generated/Query.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Collections.Generic; @@ -14,6 +15,8 @@ public partial class Query { protected Query() => throw null; + internal Query(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult Multi(IEnumerable colors, RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/path/src/Generated/PathClient.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/path/src/Generated/PathClient.cs index bb9f8d21079..d0563f49bda 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/path/src/Generated/PathClient.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/path/src/Generated/PathClient.cs @@ -15,10 +15,12 @@ public partial class PathClient { public PathClient() : this(new Uri("http://localhost:3000"), new PathClientOptions()) => throw null; - public PathClient(Uri endpoint, PathClientOptions options) => throw null; + internal PathClient(AuthenticationPolicy authenticationPolicy, Uri endpoint, PathClientOptions options) => throw null; + + public PathClient(Uri endpoint, PathClientOptions options) : this(null, endpoint, options) => throw null; [Experimental("SCME0002")] - public PathClient(PathClientSettings settings) : this(settings?.Endpoint, settings?.Options) => throw null; + public PathClient(PathClientSettings settings) : this(AuthenticationPolicy.Create(settings), settings?.Endpoint, settings?.Options) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/query/src/Generated/Constant.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/query/src/Generated/Constant.cs index b1be965f2d8..3545cccf023 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/query/src/Generated/Constant.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/query/src/Generated/Constant.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -13,6 +14,8 @@ public partial class Constant { protected Constant() => throw null; + internal Constant(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult Post(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/query/src/Generated/QueryClient.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/query/src/Generated/QueryClient.cs index 688a29355de..6a4be8cbeed 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/query/src/Generated/QueryClient.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/query/src/Generated/QueryClient.cs @@ -12,10 +12,12 @@ public partial class QueryClient { public QueryClient() : this(new Uri("http://localhost:3000"), new QueryClientOptions()) => throw null; - public QueryClient(Uri endpoint, QueryClientOptions options) => throw null; + internal QueryClient(AuthenticationPolicy authenticationPolicy, Uri endpoint, QueryClientOptions options) => throw null; + + public QueryClient(Uri endpoint, QueryClientOptions options) : this(null, endpoint, options) => throw null; [Experimental("SCME0002")] - public QueryClient(QueryClientSettings settings) : this(settings?.Endpoint, settings?.Options) => throw null; + public QueryClient(QueryClientSettings settings) : this(AuthenticationPolicy.Create(settings), settings?.Endpoint, settings?.Options) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/spread/src/Generated/Alias.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/spread/src/Generated/Alias.cs index ec8be6a9570..201900b0bc1 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/spread/src/Generated/Alias.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/spread/src/Generated/Alias.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Collections.Generic; @@ -14,6 +15,8 @@ public partial class Alias { protected Alias() => throw null; + internal Alias(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult SpreadAsRequestBody(BinaryContent content, RequestOptions options = null) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/spread/src/Generated/Model.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/spread/src/Generated/Model.cs index 31ca1bfeab4..792e9511624 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/spread/src/Generated/Model.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/spread/src/Generated/Model.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -13,6 +14,8 @@ public partial class Model { protected Model() => throw null; + internal Model(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult SpreadAsRequestBody(BinaryContent content, RequestOptions options = null) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/spread/src/Generated/SpreadClient.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/spread/src/Generated/SpreadClient.cs index 8242e4db12f..5367a1359ab 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/spread/src/Generated/SpreadClient.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/spread/src/Generated/SpreadClient.cs @@ -14,10 +14,12 @@ public partial class SpreadClient { public SpreadClient() : this(new Uri("http://localhost:3000"), new SpreadClientOptions()) => throw null; - public SpreadClient(Uri endpoint, SpreadClientOptions options) => throw null; + internal SpreadClient(AuthenticationPolicy authenticationPolicy, Uri endpoint, SpreadClientOptions options) => throw null; + + public SpreadClient(Uri endpoint, SpreadClientOptions options) : this(null, endpoint, options) => throw null; [Experimental("SCME0002")] - public SpreadClient(SpreadClientSettings settings) : this(settings?.Endpoint, settings?.Options) => throw null; + public SpreadClient(SpreadClientSettings settings) : this(AuthenticationPolicy.Create(settings), settings?.Endpoint, settings?.Options) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/content-negotiation/src/Generated/ContentNegotiationClient.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/content-negotiation/src/Generated/ContentNegotiationClient.cs index 37853116524..919000580c5 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/content-negotiation/src/Generated/ContentNegotiationClient.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/content-negotiation/src/Generated/ContentNegotiationClient.cs @@ -14,10 +14,12 @@ public partial class ContentNegotiationClient { public ContentNegotiationClient() : this(new Uri("http://localhost:3000"), new ContentNegotiationClientOptions()) => throw null; - public ContentNegotiationClient(Uri endpoint, ContentNegotiationClientOptions options) => throw null; + internal ContentNegotiationClient(AuthenticationPolicy authenticationPolicy, Uri endpoint, ContentNegotiationClientOptions options) => throw null; + + public ContentNegotiationClient(Uri endpoint, ContentNegotiationClientOptions options) : this(null, endpoint, options) => throw null; [Experimental("SCME0002")] - public ContentNegotiationClient(ContentNegotiationClientSettings settings) : this(settings?.Endpoint, settings?.Options) => throw null; + public ContentNegotiationClient(ContentNegotiationClientSettings settings) : this(AuthenticationPolicy.Create(settings), settings?.Endpoint, settings?.Options) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/content-negotiation/src/Generated/DifferentBody.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/content-negotiation/src/Generated/DifferentBody.cs index 76ada7bada7..765ef0cc721 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/content-negotiation/src/Generated/DifferentBody.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/content-negotiation/src/Generated/DifferentBody.cs @@ -14,6 +14,8 @@ public partial class DifferentBody { protected DifferentBody() => throw null; + internal DifferentBody(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult GetAvatarAsPng(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/content-negotiation/src/Generated/SameBody.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/content-negotiation/src/Generated/SameBody.cs index fd6ad96379d..57af2a77ab4 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/content-negotiation/src/Generated/SameBody.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/content-negotiation/src/Generated/SameBody.cs @@ -14,6 +14,8 @@ public partial class SameBody { protected SameBody() => throw null; + internal SameBody(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult GetAvatarAsPng(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/json-merge-patch/src/Generated/JsonMergePatchClient.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/json-merge-patch/src/Generated/JsonMergePatchClient.cs index 03df0074364..878bd2ed9bd 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/json-merge-patch/src/Generated/JsonMergePatchClient.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/json-merge-patch/src/Generated/JsonMergePatchClient.cs @@ -15,10 +15,12 @@ public partial class JsonMergePatchClient { public JsonMergePatchClient() : this(new Uri("http://localhost:3000"), new JsonMergePatchClientOptions()) => throw null; - public JsonMergePatchClient(Uri endpoint, JsonMergePatchClientOptions options) => throw null; + internal JsonMergePatchClient(AuthenticationPolicy authenticationPolicy, Uri endpoint, JsonMergePatchClientOptions options) => throw null; + + public JsonMergePatchClient(Uri endpoint, JsonMergePatchClientOptions options) : this(null, endpoint, options) => throw null; [Experimental("SCME0002")] - public JsonMergePatchClient(JsonMergePatchClientSettings settings) : this(settings?.Endpoint, settings?.Options) => throw null; + public JsonMergePatchClient(JsonMergePatchClientSettings settings) : this(AuthenticationPolicy.Create(settings), settings?.Endpoint, settings?.Options) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/media-type/src/Generated/MediaTypeClient.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/media-type/src/Generated/MediaTypeClient.cs index a2721fdee72..dbfd6a68c4c 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/media-type/src/Generated/MediaTypeClient.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/media-type/src/Generated/MediaTypeClient.cs @@ -13,10 +13,12 @@ public partial class MediaTypeClient { public MediaTypeClient() : this(new Uri("http://localhost:3000"), new MediaTypeClientOptions()) => throw null; - public MediaTypeClient(Uri endpoint, MediaTypeClientOptions options) => throw null; + internal MediaTypeClient(AuthenticationPolicy authenticationPolicy, Uri endpoint, MediaTypeClientOptions options) => throw null; + + public MediaTypeClient(Uri endpoint, MediaTypeClientOptions options) : this(null, endpoint, options) => throw null; [Experimental("SCME0002")] - public MediaTypeClient(MediaTypeClientSettings settings) : this(settings?.Endpoint, settings?.Options) => throw null; + public MediaTypeClient(MediaTypeClientSettings settings) : this(AuthenticationPolicy.Create(settings), settings?.Endpoint, settings?.Options) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/media-type/src/Generated/StringBody.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/media-type/src/Generated/StringBody.cs index f31c4875707..3efbadabb94 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/media-type/src/Generated/StringBody.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/media-type/src/Generated/StringBody.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -13,6 +14,8 @@ public partial class StringBody { protected StringBody() => throw null; + internal StringBody(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult SendAsText(BinaryContent content, RequestOptions options = null) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/multipart/src/Generated/FormData.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/multipart/src/Generated/FormData.cs index c6e02e93832..7af85b26e37 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/multipart/src/Generated/FormData.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/multipart/src/Generated/FormData.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading.Tasks; @@ -14,6 +15,8 @@ public partial class FormData { protected FormData() => throw null; + internal FormData(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult Basic(BinaryContent content, string contentType, RequestOptions options = null) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/multipart/src/Generated/FormDataFile.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/multipart/src/Generated/FormDataFile.cs index 055f8f20cb7..af3b92422ad 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/multipart/src/Generated/FormDataFile.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/multipart/src/Generated/FormDataFile.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading.Tasks; @@ -12,6 +13,8 @@ public partial class FormDataFile { protected FormDataFile() => throw null; + internal FormDataFile(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult UploadFileSpecificContentType(BinaryContent content, string contentType, RequestOptions options = null) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/multipart/src/Generated/FormDataHttpParts.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/multipart/src/Generated/FormDataHttpParts.cs index 033e295e92d..53b236c7af8 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/multipart/src/Generated/FormDataHttpParts.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/multipart/src/Generated/FormDataHttpParts.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading.Tasks; @@ -14,6 +15,8 @@ public partial class FormDataHttpParts { protected FormDataHttpParts() => throw null; + internal FormDataHttpParts(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult JsonArrayAndFileArray(BinaryContent content, string contentType, RequestOptions options = null) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/multipart/src/Generated/FormDataHttpPartsContentType.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/multipart/src/Generated/FormDataHttpPartsContentType.cs index 32cb80df3d0..971ee6ad114 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/multipart/src/Generated/FormDataHttpPartsContentType.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/multipart/src/Generated/FormDataHttpPartsContentType.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading.Tasks; @@ -12,6 +13,8 @@ public partial class FormDataHttpPartsContentType { protected FormDataHttpPartsContentType() => throw null; + internal FormDataHttpPartsContentType(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult ImageJpegContentType(BinaryContent content, string contentType, RequestOptions options = null) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/multipart/src/Generated/FormDataHttpPartsNonString.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/multipart/src/Generated/FormDataHttpPartsNonString.cs index 47557d7876b..cfb735ba1c8 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/multipart/src/Generated/FormDataHttpPartsNonString.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/multipart/src/Generated/FormDataHttpPartsNonString.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading.Tasks; @@ -12,6 +13,8 @@ public partial class FormDataHttpPartsNonString { protected FormDataHttpPartsNonString() => throw null; + internal FormDataHttpPartsNonString(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult Float(BinaryContent content, string contentType, RequestOptions options = null) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/multipart/src/Generated/MultiPartClient.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/multipart/src/Generated/MultiPartClient.cs index 4d3ab9ccea0..882e5cd3826 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/multipart/src/Generated/MultiPartClient.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/multipart/src/Generated/MultiPartClient.cs @@ -13,10 +13,12 @@ public partial class MultiPartClient { public MultiPartClient() : this(new Uri("http://localhost:3000"), new MultiPartClientOptions()) => throw null; - public MultiPartClient(Uri endpoint, MultiPartClientOptions options) => throw null; + internal MultiPartClient(AuthenticationPolicy authenticationPolicy, Uri endpoint, MultiPartClientOptions options) => throw null; + + public MultiPartClient(Uri endpoint, MultiPartClientOptions options) : this(null, endpoint, options) => throw null; [Experimental("SCME0002")] - public MultiPartClient(MultiPartClientSettings settings) : this(settings?.Endpoint, settings?.Options) => throw null; + public MultiPartClient(MultiPartClientSettings settings) : this(AuthenticationPolicy.Create(settings), settings?.Endpoint, settings?.Options) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/pageable/src/Generated/PageSize.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/pageable/src/Generated/PageSize.cs index aa4b7b3ce6a..1ba387d0819 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/pageable/src/Generated/PageSize.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/pageable/src/Generated/PageSize.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -13,6 +14,8 @@ public partial class PageSize { protected PageSize() => throw null; + internal PageSize(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual CollectionResult GetWithoutContinuation(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/pageable/src/Generated/PageableClient.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/pageable/src/Generated/PageableClient.cs index d2371c25205..3b78a1ed79c 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/pageable/src/Generated/PageableClient.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/pageable/src/Generated/PageableClient.cs @@ -15,10 +15,12 @@ public partial class PageableClient { public PageableClient() : this(new Uri("http://localhost:3000"), new PageableClientOptions()) => throw null; - public PageableClient(Uri endpoint, PageableClientOptions options) => throw null; + internal PageableClient(AuthenticationPolicy authenticationPolicy, Uri endpoint, PageableClientOptions options) => throw null; + + public PageableClient(Uri endpoint, PageableClientOptions options) : this(null, endpoint, options) => throw null; [Experimental("SCME0002")] - public PageableClient(PageableClientSettings settings) : this(settings?.Endpoint, settings?.Options) => throw null; + public PageableClient(PageableClientSettings settings) : this(AuthenticationPolicy.Create(settings), settings?.Endpoint, settings?.Options) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/pageable/src/Generated/ServerDrivenPagination.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/pageable/src/Generated/ServerDrivenPagination.cs index b611ba4910d..b027b296309 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/pageable/src/Generated/ServerDrivenPagination.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/pageable/src/Generated/ServerDrivenPagination.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -14,6 +15,8 @@ public partial class ServerDrivenPagination { protected ServerDrivenPagination() => throw null; + internal ServerDrivenPagination(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual CollectionResult Link(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/pageable/src/Generated/ServerDrivenPaginationContinuationToken.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/pageable/src/Generated/ServerDrivenPaginationContinuationToken.cs index 5c48d40f9b3..928eaab911f 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/pageable/src/Generated/ServerDrivenPaginationContinuationToken.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/pageable/src/Generated/ServerDrivenPaginationContinuationToken.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -13,6 +14,8 @@ public partial class ServerDrivenPaginationContinuationToken { protected ServerDrivenPaginationContinuationToken() => throw null; + internal ServerDrivenPaginationContinuationToken(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual CollectionResult RequestQueryResponseBody(string token, string foo, string bar, RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/pageable/src/Generated/XmlPagination.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/pageable/src/Generated/XmlPagination.cs index f5423d536cc..edbc61168f7 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/pageable/src/Generated/XmlPagination.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/pageable/src/Generated/XmlPagination.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -13,6 +14,8 @@ public partial class XmlPagination { protected XmlPagination() => throw null; + internal XmlPagination(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual CollectionResult GetWithContinuation(string marker, RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/xml/src/Generated/ModelWithArrayOfModelValue.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/xml/src/Generated/ModelWithArrayOfModelValue.cs index e3bb0da6da6..f1cfe2710d1 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/xml/src/Generated/ModelWithArrayOfModelValue.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/xml/src/Generated/ModelWithArrayOfModelValue.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -13,6 +14,8 @@ public partial class ModelWithArrayOfModelValue { protected ModelWithArrayOfModelValue() => throw null; + internal ModelWithArrayOfModelValue(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult Get(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/xml/src/Generated/ModelWithAttributesValue.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/xml/src/Generated/ModelWithAttributesValue.cs index b9e82ff75b4..283cfb4c443 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/xml/src/Generated/ModelWithAttributesValue.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/xml/src/Generated/ModelWithAttributesValue.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -13,6 +14,8 @@ public partial class ModelWithAttributesValue { protected ModelWithAttributesValue() => throw null; + internal ModelWithAttributesValue(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult Get(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/xml/src/Generated/ModelWithDictionaryValue.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/xml/src/Generated/ModelWithDictionaryValue.cs index 454fd7f51b9..0c0df435c8a 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/xml/src/Generated/ModelWithDictionaryValue.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/xml/src/Generated/ModelWithDictionaryValue.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -13,6 +14,8 @@ public partial class ModelWithDictionaryValue { protected ModelWithDictionaryValue() => throw null; + internal ModelWithDictionaryValue(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult Get(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/xml/src/Generated/ModelWithEmptyArrayValue.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/xml/src/Generated/ModelWithEmptyArrayValue.cs index f97e5bb89d6..bad31fbc8cc 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/xml/src/Generated/ModelWithEmptyArrayValue.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/xml/src/Generated/ModelWithEmptyArrayValue.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -13,6 +14,8 @@ public partial class ModelWithEmptyArrayValue { protected ModelWithEmptyArrayValue() => throw null; + internal ModelWithEmptyArrayValue(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult Get(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/xml/src/Generated/ModelWithEncodedNamesValue.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/xml/src/Generated/ModelWithEncodedNamesValue.cs index 1dbf3924200..6b6a02b751f 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/xml/src/Generated/ModelWithEncodedNamesValue.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/xml/src/Generated/ModelWithEncodedNamesValue.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -13,6 +14,8 @@ public partial class ModelWithEncodedNamesValue { protected ModelWithEncodedNamesValue() => throw null; + internal ModelWithEncodedNamesValue(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult Get(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/xml/src/Generated/ModelWithOptionalFieldValue.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/xml/src/Generated/ModelWithOptionalFieldValue.cs index 3dc923de469..e2bbd2a0fe9 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/xml/src/Generated/ModelWithOptionalFieldValue.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/xml/src/Generated/ModelWithOptionalFieldValue.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -13,6 +14,8 @@ public partial class ModelWithOptionalFieldValue { protected ModelWithOptionalFieldValue() => throw null; + internal ModelWithOptionalFieldValue(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult Get(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/xml/src/Generated/ModelWithRenamedArraysValue.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/xml/src/Generated/ModelWithRenamedArraysValue.cs index c27e948d0ef..f387ba00d47 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/xml/src/Generated/ModelWithRenamedArraysValue.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/xml/src/Generated/ModelWithRenamedArraysValue.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -13,6 +14,8 @@ public partial class ModelWithRenamedArraysValue { protected ModelWithRenamedArraysValue() => throw null; + internal ModelWithRenamedArraysValue(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult Get(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/xml/src/Generated/ModelWithRenamedFieldsValue.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/xml/src/Generated/ModelWithRenamedFieldsValue.cs index 976fe8192f3..291ca0113d2 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/xml/src/Generated/ModelWithRenamedFieldsValue.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/xml/src/Generated/ModelWithRenamedFieldsValue.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -13,6 +14,8 @@ public partial class ModelWithRenamedFieldsValue { protected ModelWithRenamedFieldsValue() => throw null; + internal ModelWithRenamedFieldsValue(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult Get(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/xml/src/Generated/ModelWithSimpleArraysValue.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/xml/src/Generated/ModelWithSimpleArraysValue.cs index 221293cbc43..ef168252ce1 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/xml/src/Generated/ModelWithSimpleArraysValue.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/xml/src/Generated/ModelWithSimpleArraysValue.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -13,6 +14,8 @@ public partial class ModelWithSimpleArraysValue { protected ModelWithSimpleArraysValue() => throw null; + internal ModelWithSimpleArraysValue(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult Get(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/xml/src/Generated/ModelWithTextValue.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/xml/src/Generated/ModelWithTextValue.cs index c87bf14cccd..273515d228e 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/xml/src/Generated/ModelWithTextValue.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/xml/src/Generated/ModelWithTextValue.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -13,6 +14,8 @@ public partial class ModelWithTextValue { protected ModelWithTextValue() => throw null; + internal ModelWithTextValue(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult Get(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/xml/src/Generated/ModelWithUnwrappedArrayValue.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/xml/src/Generated/ModelWithUnwrappedArrayValue.cs index 74372fd6b84..319bba5194c 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/xml/src/Generated/ModelWithUnwrappedArrayValue.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/xml/src/Generated/ModelWithUnwrappedArrayValue.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -13,6 +14,8 @@ public partial class ModelWithUnwrappedArrayValue { protected ModelWithUnwrappedArrayValue() => throw null; + internal ModelWithUnwrappedArrayValue(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult Get(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/xml/src/Generated/SimpleModelValue.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/xml/src/Generated/SimpleModelValue.cs index 6a020d4c531..0ca41673678 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/xml/src/Generated/SimpleModelValue.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/xml/src/Generated/SimpleModelValue.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -13,6 +14,8 @@ public partial class SimpleModelValue { protected SimpleModelValue() => throw null; + internal SimpleModelValue(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult Get(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/xml/src/Generated/XmlClient.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/xml/src/Generated/XmlClient.cs index a0354192a44..cab5046952f 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/xml/src/Generated/XmlClient.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/xml/src/Generated/XmlClient.cs @@ -12,10 +12,12 @@ public partial class XmlClient { public XmlClient() : this(new Uri("http://localhost:3000"), new XmlClientOptions()) => throw null; - public XmlClient(Uri endpoint, XmlClientOptions options) => throw null; + internal XmlClient(AuthenticationPolicy authenticationPolicy, Uri endpoint, XmlClientOptions options) => throw null; + + public XmlClient(Uri endpoint, XmlClientOptions options) : this(null, endpoint, options) => throw null; [Experimental("SCME0002")] - public XmlClient(XmlClientSettings settings) : this(settings?.Endpoint, settings?.Options) => throw null; + public XmlClient(XmlClientSettings settings) : this(AuthenticationPolicy.Create(settings), settings?.Endpoint, settings?.Options) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/xml/src/Generated/XmlErrorValue.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/xml/src/Generated/XmlErrorValue.cs index 13069ff4ebb..cf37b300967 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/xml/src/Generated/XmlErrorValue.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/xml/src/Generated/XmlErrorValue.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -13,6 +14,8 @@ public partial class XmlErrorValue { protected XmlErrorValue() => throw null; + internal XmlErrorValue(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult Get(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/resiliency/srv-driven/v1/src/Generated/ResiliencyServiceDrivenClient.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/resiliency/srv-driven/v1/src/Generated/ResiliencyServiceDrivenClient.cs index d1576cf1e2d..0d010ec8ea0 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/resiliency/srv-driven/v1/src/Generated/ResiliencyServiceDrivenClient.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/resiliency/srv-driven/v1/src/Generated/ResiliencyServiceDrivenClient.cs @@ -17,10 +17,12 @@ public partial class ResiliencyServiceDrivenClient public ResiliencyServiceDrivenClient(Uri endpoint, string serviceDeploymentVersion) : this(endpoint, serviceDeploymentVersion, new ResiliencyServiceDrivenClientOptions()) => throw null; - public ResiliencyServiceDrivenClient(Uri endpoint, string serviceDeploymentVersion, ResiliencyServiceDrivenClientOptions options) => throw null; + internal ResiliencyServiceDrivenClient(AuthenticationPolicy authenticationPolicy, Uri endpoint, string serviceDeploymentVersion, ResiliencyServiceDrivenClientOptions options) => throw null; + + public ResiliencyServiceDrivenClient(Uri endpoint, string serviceDeploymentVersion, ResiliencyServiceDrivenClientOptions options) : this(null, endpoint, serviceDeploymentVersion, options) => throw null; [Experimental("SCME0002")] - public ResiliencyServiceDrivenClient(ResiliencyServiceDrivenClientSettings settings) : this(settings?.Endpoint, settings?.ServiceDeploymentVersion, settings?.Options) => throw null; + public ResiliencyServiceDrivenClient(ResiliencyServiceDrivenClientSettings settings) : this(AuthenticationPolicy.Create(settings), settings?.Endpoint, settings?.ServiceDeploymentVersion, settings?.Options) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/resiliency/srv-driven/v2/src/Generated/ResiliencyServiceDrivenClient.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/resiliency/srv-driven/v2/src/Generated/ResiliencyServiceDrivenClient.cs index c44274d26d8..59d7160e347 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/resiliency/srv-driven/v2/src/Generated/ResiliencyServiceDrivenClient.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/resiliency/srv-driven/v2/src/Generated/ResiliencyServiceDrivenClient.cs @@ -17,10 +17,12 @@ public partial class ResiliencyServiceDrivenClient public ResiliencyServiceDrivenClient(Uri endpoint, string serviceDeploymentVersion) : this(endpoint, serviceDeploymentVersion, new ResiliencyServiceDrivenClientOptions()) => throw null; - public ResiliencyServiceDrivenClient(Uri endpoint, string serviceDeploymentVersion, ResiliencyServiceDrivenClientOptions options) => throw null; + internal ResiliencyServiceDrivenClient(AuthenticationPolicy authenticationPolicy, Uri endpoint, string serviceDeploymentVersion, ResiliencyServiceDrivenClientOptions options) => throw null; + + public ResiliencyServiceDrivenClient(Uri endpoint, string serviceDeploymentVersion, ResiliencyServiceDrivenClientOptions options) : this(null, endpoint, serviceDeploymentVersion, options) => throw null; [Experimental("SCME0002")] - public ResiliencyServiceDrivenClient(ResiliencyServiceDrivenClientSettings settings) : this(settings?.Endpoint, settings?.ServiceDeploymentVersion, settings?.Options) => throw null; + public ResiliencyServiceDrivenClient(ResiliencyServiceDrivenClientSettings settings) : this(AuthenticationPolicy.Create(settings), settings?.Endpoint, settings?.ServiceDeploymentVersion, settings?.Options) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/response/status-code-range/src/Generated/StatusCodeRangeClient.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/response/status-code-range/src/Generated/StatusCodeRangeClient.cs index cc62426e506..1cf6258e804 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/response/status-code-range/src/Generated/StatusCodeRangeClient.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/response/status-code-range/src/Generated/StatusCodeRangeClient.cs @@ -15,10 +15,12 @@ public partial class StatusCodeRangeClient { public StatusCodeRangeClient() : this(new Uri("http://localhost:3000"), new StatusCodeRangeClientOptions()) => throw null; - public StatusCodeRangeClient(Uri endpoint, StatusCodeRangeClientOptions options) => throw null; + internal StatusCodeRangeClient(AuthenticationPolicy authenticationPolicy, Uri endpoint, StatusCodeRangeClientOptions options) => throw null; + + public StatusCodeRangeClient(Uri endpoint, StatusCodeRangeClientOptions options) : this(null, endpoint, options) => throw null; [Experimental("SCME0002")] - public StatusCodeRangeClient(StatusCodeRangeClientSettings settings) : this(settings?.Endpoint, settings?.Options) => throw null; + public StatusCodeRangeClient(StatusCodeRangeClientSettings settings) : this(AuthenticationPolicy.Create(settings), settings?.Endpoint, settings?.Options) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/InInterface.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/InInterface.cs index 2c68d8281b8..934018fdcc3 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/InInterface.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/InInterface.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -13,6 +14,8 @@ public partial class InInterface { protected InInterface() => throw null; + internal InInterface(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult Fixed(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/PathParameters.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/PathParameters.cs index 3e17767b7d8..305a607546a 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/PathParameters.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/PathParameters.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -18,6 +19,8 @@ public partial class PathParameters { protected PathParameters() => throw null; + internal PathParameters(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult TemplateOnly(string @param, RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/PathParametersLabelExpansion.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/PathParametersLabelExpansion.cs index b7d6a6cbc7c..a3daa8878cb 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/PathParametersLabelExpansion.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/PathParametersLabelExpansion.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel.Primitives; using Routes._PathParameters.LabelExpansion.Explode; using Routes._PathParameters.LabelExpansion.Standard; @@ -12,6 +13,8 @@ public partial class PathParametersLabelExpansion { protected PathParametersLabelExpansion() => throw null; + internal PathParametersLabelExpansion(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual PathParametersLabelExpansionStandard GetPathParametersLabelExpansionStandardClient() => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/PathParametersLabelExpansionExplode.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/PathParametersLabelExpansionExplode.cs index 79470e680e1..d032c33fc38 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/PathParametersLabelExpansionExplode.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/PathParametersLabelExpansionExplode.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Collections.Generic; @@ -14,6 +15,8 @@ public partial class PathParametersLabelExpansionExplode { protected PathParametersLabelExpansionExplode() => throw null; + internal PathParametersLabelExpansionExplode(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult Primitive(string @param, RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/PathParametersLabelExpansionStandard.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/PathParametersLabelExpansionStandard.cs index 0b742d05724..f18f1e516cc 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/PathParametersLabelExpansionStandard.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/PathParametersLabelExpansionStandard.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Collections.Generic; @@ -14,6 +15,8 @@ public partial class PathParametersLabelExpansionStandard { protected PathParametersLabelExpansionStandard() => throw null; + internal PathParametersLabelExpansionStandard(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult Primitive(string @param, RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/PathParametersMatrixExpansion.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/PathParametersMatrixExpansion.cs index 6bf98190256..5c60d18f7bb 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/PathParametersMatrixExpansion.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/PathParametersMatrixExpansion.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel.Primitives; using Routes._PathParameters.MatrixExpansion.Explode; using Routes._PathParameters.MatrixExpansion.Standard; @@ -12,6 +13,8 @@ public partial class PathParametersMatrixExpansion { protected PathParametersMatrixExpansion() => throw null; + internal PathParametersMatrixExpansion(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual PathParametersMatrixExpansionStandard GetPathParametersMatrixExpansionStandardClient() => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/PathParametersMatrixExpansionExplode.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/PathParametersMatrixExpansionExplode.cs index b92df406571..bf3f3e88d58 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/PathParametersMatrixExpansionExplode.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/PathParametersMatrixExpansionExplode.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Collections.Generic; @@ -14,6 +15,8 @@ public partial class PathParametersMatrixExpansionExplode { protected PathParametersMatrixExpansionExplode() => throw null; + internal PathParametersMatrixExpansionExplode(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult Primitive(string @param, RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/PathParametersMatrixExpansionStandard.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/PathParametersMatrixExpansionStandard.cs index d40c1696d15..165a76d190f 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/PathParametersMatrixExpansionStandard.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/PathParametersMatrixExpansionStandard.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Collections.Generic; @@ -14,6 +15,8 @@ public partial class PathParametersMatrixExpansionStandard { protected PathParametersMatrixExpansionStandard() => throw null; + internal PathParametersMatrixExpansionStandard(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult Primitive(string @param, RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/PathParametersPathExpansion.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/PathParametersPathExpansion.cs index ec2f665c1a2..11bd31de479 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/PathParametersPathExpansion.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/PathParametersPathExpansion.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel.Primitives; using Routes._PathParameters.PathExpansion.Explode; using Routes._PathParameters.PathExpansion.Standard; @@ -12,6 +13,8 @@ public partial class PathParametersPathExpansion { protected PathParametersPathExpansion() => throw null; + internal PathParametersPathExpansion(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual PathParametersPathExpansionStandard GetPathParametersPathExpansionStandardClient() => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/PathParametersPathExpansionExplode.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/PathParametersPathExpansionExplode.cs index b7f10f1c6d4..e2368337641 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/PathParametersPathExpansionExplode.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/PathParametersPathExpansionExplode.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Collections.Generic; @@ -14,6 +15,8 @@ public partial class PathParametersPathExpansionExplode { protected PathParametersPathExpansionExplode() => throw null; + internal PathParametersPathExpansionExplode(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult Primitive(string @param, RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/PathParametersPathExpansionStandard.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/PathParametersPathExpansionStandard.cs index d58ca6fbc4d..8c63b0829fb 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/PathParametersPathExpansionStandard.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/PathParametersPathExpansionStandard.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Collections.Generic; @@ -14,6 +15,8 @@ public partial class PathParametersPathExpansionStandard { protected PathParametersPathExpansionStandard() => throw null; + internal PathParametersPathExpansionStandard(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult Primitive(string @param, RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/PathParametersReservedExpansion.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/PathParametersReservedExpansion.cs index 3becc3ca8f2..60f78bfde07 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/PathParametersReservedExpansion.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/PathParametersReservedExpansion.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -13,6 +14,8 @@ public partial class PathParametersReservedExpansion { protected PathParametersReservedExpansion() => throw null; + internal PathParametersReservedExpansion(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult Template(string @param, RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/PathParametersSimpleExpansion.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/PathParametersSimpleExpansion.cs index cb3b2ce1c3a..87724df6d6d 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/PathParametersSimpleExpansion.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/PathParametersSimpleExpansion.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel.Primitives; using Routes._PathParameters.SimpleExpansion.Explode; using Routes._PathParameters.SimpleExpansion.Standard; @@ -12,6 +13,8 @@ public partial class PathParametersSimpleExpansion { protected PathParametersSimpleExpansion() => throw null; + internal PathParametersSimpleExpansion(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual PathParametersSimpleExpansionStandard GetPathParametersSimpleExpansionStandardClient() => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/PathParametersSimpleExpansionExplode.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/PathParametersSimpleExpansionExplode.cs index 00c4d218a1c..2abcc233d4b 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/PathParametersSimpleExpansionExplode.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/PathParametersSimpleExpansionExplode.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Collections.Generic; @@ -14,6 +15,8 @@ public partial class PathParametersSimpleExpansionExplode { protected PathParametersSimpleExpansionExplode() => throw null; + internal PathParametersSimpleExpansionExplode(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult Primitive(string @param, RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/PathParametersSimpleExpansionStandard.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/PathParametersSimpleExpansionStandard.cs index 63477a318ae..21f896bcdb3 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/PathParametersSimpleExpansionStandard.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/PathParametersSimpleExpansionStandard.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Collections.Generic; @@ -14,6 +15,8 @@ public partial class PathParametersSimpleExpansionStandard { protected PathParametersSimpleExpansionStandard() => throw null; + internal PathParametersSimpleExpansionStandard(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult Primitive(string @param, RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/QueryParameters.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/QueryParameters.cs index 4ccfde73030..50f707d2cf0 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/QueryParameters.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/QueryParameters.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -15,6 +16,8 @@ public partial class QueryParameters { protected QueryParameters() => throw null; + internal QueryParameters(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult TemplateOnly(string @param, RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/QueryParametersQueryContinuation.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/QueryParametersQueryContinuation.cs index c1e1821e791..3aa640a00e5 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/QueryParametersQueryContinuation.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/QueryParametersQueryContinuation.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel.Primitives; using Routes._QueryParameters.QueryContinuation.Explode; using Routes._QueryParameters.QueryContinuation.Standard; @@ -12,6 +13,8 @@ public partial class QueryParametersQueryContinuation { protected QueryParametersQueryContinuation() => throw null; + internal QueryParametersQueryContinuation(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual QueryParametersQueryContinuationStandard GetQueryParametersQueryContinuationStandardClient() => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/QueryParametersQueryContinuationExplode.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/QueryParametersQueryContinuationExplode.cs index b9a3cb696d4..ca911b55cb3 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/QueryParametersQueryContinuationExplode.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/QueryParametersQueryContinuationExplode.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Collections.Generic; @@ -14,6 +15,8 @@ public partial class QueryParametersQueryContinuationExplode { protected QueryParametersQueryContinuationExplode() => throw null; + internal QueryParametersQueryContinuationExplode(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult Primitive(string @param, RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/QueryParametersQueryContinuationStandard.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/QueryParametersQueryContinuationStandard.cs index 679ca546a46..828f03e49f2 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/QueryParametersQueryContinuationStandard.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/QueryParametersQueryContinuationStandard.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Collections.Generic; @@ -14,6 +15,8 @@ public partial class QueryParametersQueryContinuationStandard { protected QueryParametersQueryContinuationStandard() => throw null; + internal QueryParametersQueryContinuationStandard(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult Primitive(string @param, RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/QueryParametersQueryExpansion.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/QueryParametersQueryExpansion.cs index 7038262cc30..4d2b16565c0 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/QueryParametersQueryExpansion.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/QueryParametersQueryExpansion.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel.Primitives; using Routes._QueryParameters.QueryExpansion.Explode; using Routes._QueryParameters.QueryExpansion.Standard; @@ -12,6 +13,8 @@ public partial class QueryParametersQueryExpansion { protected QueryParametersQueryExpansion() => throw null; + internal QueryParametersQueryExpansion(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual QueryParametersQueryExpansionStandard GetQueryParametersQueryExpansionStandardClient() => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/QueryParametersQueryExpansionExplode.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/QueryParametersQueryExpansionExplode.cs index cedde7fe6aa..e8989434a9d 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/QueryParametersQueryExpansionExplode.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/QueryParametersQueryExpansionExplode.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Collections.Generic; @@ -14,6 +15,8 @@ public partial class QueryParametersQueryExpansionExplode { protected QueryParametersQueryExpansionExplode() => throw null; + internal QueryParametersQueryExpansionExplode(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult Primitive(string @param, RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/QueryParametersQueryExpansionStandard.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/QueryParametersQueryExpansionStandard.cs index dd88da3b509..9566e4d25f8 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/QueryParametersQueryExpansionStandard.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/QueryParametersQueryExpansionStandard.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Collections.Generic; @@ -14,6 +15,8 @@ public partial class QueryParametersQueryExpansionStandard { protected QueryParametersQueryExpansionStandard() => throw null; + internal QueryParametersQueryExpansionStandard(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult Primitive(string @param, RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/RoutesClient.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/RoutesClient.cs index 9e22955b9e7..8e156cfd6b7 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/RoutesClient.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/RoutesClient.cs @@ -17,10 +17,12 @@ public partial class RoutesClient { public RoutesClient() : this(new Uri("http://localhost:3000"), new RoutesClientOptions()) => throw null; - public RoutesClient(Uri endpoint, RoutesClientOptions options) => throw null; + internal RoutesClient(AuthenticationPolicy authenticationPolicy, Uri endpoint, RoutesClientOptions options) => throw null; + + public RoutesClient(Uri endpoint, RoutesClientOptions options) : this(null, endpoint, options) => throw null; [Experimental("SCME0002")] - public RoutesClient(RoutesClientSettings settings) : this(settings?.Endpoint, settings?.Options) => throw null; + public RoutesClient(RoutesClientSettings settings) : this(AuthenticationPolicy.Create(settings), settings?.Endpoint, settings?.Options) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/serialization/encoded-name/json/src/Generated/JsonClient.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/serialization/encoded-name/json/src/Generated/JsonClient.cs index f2fe872a261..5501186e310 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/serialization/encoded-name/json/src/Generated/JsonClient.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/serialization/encoded-name/json/src/Generated/JsonClient.cs @@ -13,10 +13,12 @@ public partial class JsonClient { public JsonClient() : this(new Uri("http://localhost:3000"), new JsonClientOptions()) => throw null; - public JsonClient(Uri endpoint, JsonClientOptions options) => throw null; + internal JsonClient(AuthenticationPolicy authenticationPolicy, Uri endpoint, JsonClientOptions options) => throw null; + + public JsonClient(Uri endpoint, JsonClientOptions options) : this(null, endpoint, options) => throw null; [Experimental("SCME0002")] - public JsonClient(JsonClientSettings settings) : this(settings?.Endpoint, settings?.Options) => throw null; + public JsonClient(JsonClientSettings settings) : this(AuthenticationPolicy.Create(settings), settings?.Endpoint, settings?.Options) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/serialization/encoded-name/json/src/Generated/Property.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/serialization/encoded-name/json/src/Generated/Property.cs index 2a1aea1756d..67558d68030 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/serialization/encoded-name/json/src/Generated/Property.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/serialization/encoded-name/json/src/Generated/Property.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -13,6 +14,8 @@ public partial class Property { protected Property() => throw null; + internal Property(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult Send(BinaryContent content, RequestOptions options = null) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/server/endpoint/not-defined/src/Generated/NotDefinedClient.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/server/endpoint/not-defined/src/Generated/NotDefinedClient.cs index 028fad6a4b2..a503b59d200 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/server/endpoint/not-defined/src/Generated/NotDefinedClient.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/server/endpoint/not-defined/src/Generated/NotDefinedClient.cs @@ -17,10 +17,12 @@ public partial class NotDefinedClient public NotDefinedClient(Uri endpoint) : this(endpoint, new NotDefinedClientOptions()) => throw null; - public NotDefinedClient(Uri endpoint, NotDefinedClientOptions options) => throw null; + internal NotDefinedClient(AuthenticationPolicy authenticationPolicy, Uri endpoint, NotDefinedClientOptions options) => throw null; + + public NotDefinedClient(Uri endpoint, NotDefinedClientOptions options) : this(null, endpoint, options) => throw null; [Experimental("SCME0002")] - public NotDefinedClient(NotDefinedClientSettings settings) : this(settings?.Endpoint, settings?.Options) => throw null; + public NotDefinedClient(NotDefinedClientSettings settings) : this(AuthenticationPolicy.Create(settings), settings?.Endpoint, settings?.Options) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/server/path/multiple/src/Generated/MultipleClient.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/server/path/multiple/src/Generated/MultipleClient.cs index 99b5606c8f9..10ba60fb3a1 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/server/path/multiple/src/Generated/MultipleClient.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/server/path/multiple/src/Generated/MultipleClient.cs @@ -17,10 +17,12 @@ public partial class MultipleClient public MultipleClient(Uri endpoint) : this(endpoint, new MultipleClientOptions()) => throw null; - public MultipleClient(Uri endpoint, MultipleClientOptions options) => throw null; + internal MultipleClient(AuthenticationPolicy authenticationPolicy, Uri endpoint, MultipleClientOptions options) => throw null; + + public MultipleClient(Uri endpoint, MultipleClientOptions options) : this(null, endpoint, options) => throw null; [Experimental("SCME0002")] - public MultipleClient(MultipleClientSettings settings) : this(settings?.Endpoint, settings?.Options) => throw null; + public MultipleClient(MultipleClientSettings settings) : this(AuthenticationPolicy.Create(settings), settings?.Endpoint, settings?.Options) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/server/path/single/src/Generated/SingleClient.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/server/path/single/src/Generated/SingleClient.cs index 1296a3c8ddf..3bc250e9775 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/server/path/single/src/Generated/SingleClient.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/server/path/single/src/Generated/SingleClient.cs @@ -17,10 +17,12 @@ public partial class SingleClient public SingleClient(Uri endpoint) : this(endpoint, new SingleClientOptions()) => throw null; - public SingleClient(Uri endpoint, SingleClientOptions options) => throw null; + internal SingleClient(AuthenticationPolicy authenticationPolicy, Uri endpoint, SingleClientOptions options) => throw null; + + public SingleClient(Uri endpoint, SingleClientOptions options) : this(null, endpoint, options) => throw null; [Experimental("SCME0002")] - public SingleClient(SingleClientSettings settings) : this(settings?.Endpoint, settings?.Options) => throw null; + public SingleClient(SingleClientSettings settings) : this(AuthenticationPolicy.Create(settings), settings?.Endpoint, settings?.Options) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/server/versions/not-versioned/src/Generated/NotVersionedClient.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/server/versions/not-versioned/src/Generated/NotVersionedClient.cs index 18284bace62..66b8752fa2d 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/server/versions/not-versioned/src/Generated/NotVersionedClient.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/server/versions/not-versioned/src/Generated/NotVersionedClient.cs @@ -17,10 +17,12 @@ public partial class NotVersionedClient public NotVersionedClient(Uri endpoint) : this(endpoint, new NotVersionedClientOptions()) => throw null; - public NotVersionedClient(Uri endpoint, NotVersionedClientOptions options) => throw null; + internal NotVersionedClient(AuthenticationPolicy authenticationPolicy, Uri endpoint, NotVersionedClientOptions options) => throw null; + + public NotVersionedClient(Uri endpoint, NotVersionedClientOptions options) : this(null, endpoint, options) => throw null; [Experimental("SCME0002")] - public NotVersionedClient(NotVersionedClientSettings settings) : this(settings?.Endpoint, settings?.Options) => throw null; + public NotVersionedClient(NotVersionedClientSettings settings) : this(AuthenticationPolicy.Create(settings), settings?.Endpoint, settings?.Options) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/server/versions/versioned/src/Generated/VersionedClient.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/server/versions/versioned/src/Generated/VersionedClient.cs index 5beaaaff906..fc5d889c517 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/server/versions/versioned/src/Generated/VersionedClient.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/server/versions/versioned/src/Generated/VersionedClient.cs @@ -17,10 +17,12 @@ public partial class VersionedClient public VersionedClient(Uri endpoint) : this(endpoint, new VersionedClientOptions()) => throw null; - public VersionedClient(Uri endpoint, VersionedClientOptions options) => throw null; + internal VersionedClient(AuthenticationPolicy authenticationPolicy, Uri endpoint, VersionedClientOptions options) => throw null; + + public VersionedClient(Uri endpoint, VersionedClientOptions options) : this(null, endpoint, options) => throw null; [Experimental("SCME0002")] - public VersionedClient(VersionedClientSettings settings) : this(settings?.Endpoint, settings?.Options) => throw null; + public VersionedClient(VersionedClientSettings settings) : this(AuthenticationPolicy.Create(settings), settings?.Endpoint, settings?.Options) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/special-headers/conditional-request/src/Generated/ConditionalRequestClient.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/special-headers/conditional-request/src/Generated/ConditionalRequestClient.cs index 976a2b46406..cac754cfedb 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/special-headers/conditional-request/src/Generated/ConditionalRequestClient.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/special-headers/conditional-request/src/Generated/ConditionalRequestClient.cs @@ -15,10 +15,12 @@ public partial class ConditionalRequestClient { public ConditionalRequestClient() : this(new Uri("http://localhost:3000"), new ConditionalRequestClientOptions()) => throw null; - public ConditionalRequestClient(Uri endpoint, ConditionalRequestClientOptions options) => throw null; + internal ConditionalRequestClient(AuthenticationPolicy authenticationPolicy, Uri endpoint, ConditionalRequestClientOptions options) => throw null; + + public ConditionalRequestClient(Uri endpoint, ConditionalRequestClientOptions options) : this(null, endpoint, options) => throw null; [Experimental("SCME0002")] - public ConditionalRequestClient(ConditionalRequestClientSettings settings) : this(settings?.Endpoint, settings?.Options) => throw null; + public ConditionalRequestClient(ConditionalRequestClientSettings settings) : this(AuthenticationPolicy.Create(settings), settings?.Endpoint, settings?.Options) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/special-headers/repeatability/src/Generated/RepeatabilityClient.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/special-headers/repeatability/src/Generated/RepeatabilityClient.cs index 04f50ea930e..cff3310bcef 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/special-headers/repeatability/src/Generated/RepeatabilityClient.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/special-headers/repeatability/src/Generated/RepeatabilityClient.cs @@ -15,10 +15,12 @@ public partial class RepeatabilityClient { public RepeatabilityClient() : this(new Uri("http://localhost:3000"), new RepeatabilityClientOptions()) => throw null; - public RepeatabilityClient(Uri endpoint, RepeatabilityClientOptions options) => throw null; + internal RepeatabilityClient(AuthenticationPolicy authenticationPolicy, Uri endpoint, RepeatabilityClientOptions options) => throw null; + + public RepeatabilityClient(Uri endpoint, RepeatabilityClientOptions options) : this(null, endpoint, options) => throw null; [Experimental("SCME0002")] - public RepeatabilityClient(RepeatabilityClientSettings settings) : this(settings?.Endpoint, settings?.Options) => throw null; + public RepeatabilityClient(RepeatabilityClientSettings settings) : this(AuthenticationPolicy.Create(settings), settings?.Endpoint, settings?.Options) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/special-words/src/Generated/ModelProperties.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/special-words/src/Generated/ModelProperties.cs index 76f4b999169..145be0ededd 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/special-words/src/Generated/ModelProperties.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/special-words/src/Generated/ModelProperties.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -13,6 +14,8 @@ public partial class ModelProperties { protected ModelProperties() => throw null; + internal ModelProperties(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult SameAsModel(BinaryContent content, RequestOptions options = null) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/special-words/src/Generated/Models.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/special-words/src/Generated/Models.cs index af9e99fa778..ec89fe4d3f7 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/special-words/src/Generated/Models.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/special-words/src/Generated/Models.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -13,6 +14,8 @@ public partial class Models { protected Models() => throw null; + internal Models(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult WithAnd(BinaryContent content, RequestOptions options = null) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/special-words/src/Generated/Operations.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/special-words/src/Generated/Operations.cs index bb367d9e0e7..1dfa7cdcfbe 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/special-words/src/Generated/Operations.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/special-words/src/Generated/Operations.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -13,6 +14,8 @@ public partial class Operations { protected Operations() => throw null; + internal Operations(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult And(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/special-words/src/Generated/Parameters.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/special-words/src/Generated/Parameters.cs index a489749d1a9..fb1b60d7ad1 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/special-words/src/Generated/Parameters.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/special-words/src/Generated/Parameters.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -13,6 +14,8 @@ public partial class Parameters { protected Parameters() => throw null; + internal Parameters(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult WithAnd(string @and, RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/special-words/src/Generated/SpecialWordsClient.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/special-words/src/Generated/SpecialWordsClient.cs index 7d4c924f080..92dda3fce4e 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/special-words/src/Generated/SpecialWordsClient.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/special-words/src/Generated/SpecialWordsClient.cs @@ -14,10 +14,12 @@ public partial class SpecialWordsClient { public SpecialWordsClient() : this(new Uri("http://localhost:3000"), new SpecialWordsClientOptions()) => throw null; - public SpecialWordsClient(Uri endpoint, SpecialWordsClientOptions options) => throw null; + internal SpecialWordsClient(AuthenticationPolicy authenticationPolicy, Uri endpoint, SpecialWordsClientOptions options) => throw null; + + public SpecialWordsClient(Uri endpoint, SpecialWordsClientOptions options) : this(null, endpoint, options) => throw null; [Experimental("SCME0002")] - public SpecialWordsClient(SpecialWordsClientSettings settings) : this(settings?.Endpoint, settings?.Options) => throw null; + public SpecialWordsClient(SpecialWordsClientSettings settings) : this(AuthenticationPolicy.Create(settings), settings?.Endpoint, settings?.Options) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/array/src/Generated/ArrayClient.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/array/src/Generated/ArrayClient.cs index eff03c97449..1597bfe32fb 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/array/src/Generated/ArrayClient.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/array/src/Generated/ArrayClient.cs @@ -12,10 +12,12 @@ public partial class ArrayClient { public ArrayClient() : this(new Uri("http://localhost:3000"), new ArrayClientOptions()) => throw null; - public ArrayClient(Uri endpoint, ArrayClientOptions options) => throw null; + internal ArrayClient(AuthenticationPolicy authenticationPolicy, Uri endpoint, ArrayClientOptions options) => throw null; + + public ArrayClient(Uri endpoint, ArrayClientOptions options) : this(null, endpoint, options) => throw null; [Experimental("SCME0002")] - public ArrayClient(ArrayClientSettings settings) : this(settings?.Endpoint, settings?.Options) => throw null; + public ArrayClient(ArrayClientSettings settings) : this(AuthenticationPolicy.Create(settings), settings?.Endpoint, settings?.Options) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/array/src/Generated/BooleanValue.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/array/src/Generated/BooleanValue.cs index 01b3af52309..d290fed4d03 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/array/src/Generated/BooleanValue.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/array/src/Generated/BooleanValue.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Collections.Generic; @@ -14,6 +15,8 @@ public partial class BooleanValue { protected BooleanValue() => throw null; + internal BooleanValue(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult Get(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/array/src/Generated/DatetimeValue.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/array/src/Generated/DatetimeValue.cs index 720dc85c07b..c7cd4718045 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/array/src/Generated/DatetimeValue.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/array/src/Generated/DatetimeValue.cs @@ -15,6 +15,8 @@ public partial class DatetimeValue { protected DatetimeValue() => throw null; + internal DatetimeValue(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult Get(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/array/src/Generated/DurationValue.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/array/src/Generated/DurationValue.cs index 2b2696da40c..d41e7956ded 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/array/src/Generated/DurationValue.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/array/src/Generated/DurationValue.cs @@ -15,6 +15,8 @@ public partial class DurationValue { protected DurationValue() => throw null; + internal DurationValue(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult Get(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/array/src/Generated/Float32Value.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/array/src/Generated/Float32Value.cs index 56b5ffb2f95..139091b980e 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/array/src/Generated/Float32Value.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/array/src/Generated/Float32Value.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Collections.Generic; @@ -14,6 +15,8 @@ public partial class Float32Value { protected Float32Value() => throw null; + internal Float32Value(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult Get(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/array/src/Generated/Int32Value.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/array/src/Generated/Int32Value.cs index 7babbc0f8f9..b38525f6496 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/array/src/Generated/Int32Value.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/array/src/Generated/Int32Value.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Collections.Generic; @@ -14,6 +15,8 @@ public partial class Int32Value { protected Int32Value() => throw null; + internal Int32Value(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult Get(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/array/src/Generated/Int64Value.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/array/src/Generated/Int64Value.cs index ba6f600bae1..952fb96e4cc 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/array/src/Generated/Int64Value.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/array/src/Generated/Int64Value.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Collections.Generic; @@ -14,6 +15,8 @@ public partial class Int64Value { protected Int64Value() => throw null; + internal Int64Value(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult Get(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/array/src/Generated/ModelValue.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/array/src/Generated/ModelValue.cs index d842b2c8829..333dfabdcff 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/array/src/Generated/ModelValue.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/array/src/Generated/ModelValue.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Collections.Generic; @@ -14,6 +15,8 @@ public partial class ModelValue { protected ModelValue() => throw null; + internal ModelValue(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult Get(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/array/src/Generated/NullableBooleanValue.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/array/src/Generated/NullableBooleanValue.cs index 21c9ed002fe..eb0177c832a 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/array/src/Generated/NullableBooleanValue.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/array/src/Generated/NullableBooleanValue.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Collections.Generic; @@ -14,6 +15,8 @@ public partial class NullableBooleanValue { protected NullableBooleanValue() => throw null; + internal NullableBooleanValue(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult Get(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/array/src/Generated/NullableFloatValue.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/array/src/Generated/NullableFloatValue.cs index dcfe8553721..ab401bf7739 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/array/src/Generated/NullableFloatValue.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/array/src/Generated/NullableFloatValue.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Collections.Generic; @@ -14,6 +15,8 @@ public partial class NullableFloatValue { protected NullableFloatValue() => throw null; + internal NullableFloatValue(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult Get(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/array/src/Generated/NullableInt32Value.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/array/src/Generated/NullableInt32Value.cs index 6aae5a6a603..df168f64ea3 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/array/src/Generated/NullableInt32Value.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/array/src/Generated/NullableInt32Value.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Collections.Generic; @@ -14,6 +15,8 @@ public partial class NullableInt32Value { protected NullableInt32Value() => throw null; + internal NullableInt32Value(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult Get(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/array/src/Generated/NullableModelValue.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/array/src/Generated/NullableModelValue.cs index bb14d5e8e9d..336d4186bd1 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/array/src/Generated/NullableModelValue.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/array/src/Generated/NullableModelValue.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Collections.Generic; @@ -14,6 +15,8 @@ public partial class NullableModelValue { protected NullableModelValue() => throw null; + internal NullableModelValue(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult Get(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/array/src/Generated/NullableStringValue.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/array/src/Generated/NullableStringValue.cs index 490dd4aad6e..f22d0fb8493 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/array/src/Generated/NullableStringValue.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/array/src/Generated/NullableStringValue.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Collections.Generic; @@ -14,6 +15,8 @@ public partial class NullableStringValue { protected NullableStringValue() => throw null; + internal NullableStringValue(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult Get(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/array/src/Generated/StringValue.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/array/src/Generated/StringValue.cs index 7d61138920c..e330fa6ffa4 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/array/src/Generated/StringValue.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/array/src/Generated/StringValue.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Collections.Generic; @@ -14,6 +15,8 @@ public partial class StringValue { protected StringValue() => throw null; + internal StringValue(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult Get(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/array/src/Generated/UnknownValue.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/array/src/Generated/UnknownValue.cs index 0fcbbd28461..a049ca8e8b3 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/array/src/Generated/UnknownValue.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/array/src/Generated/UnknownValue.cs @@ -15,6 +15,8 @@ public partial class UnknownValue { protected UnknownValue() => throw null; + internal UnknownValue(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult Get(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/dictionary/src/Generated/BooleanValue.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/dictionary/src/Generated/BooleanValue.cs index 8e54e093f42..f4727e78b82 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/dictionary/src/Generated/BooleanValue.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/dictionary/src/Generated/BooleanValue.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Collections.Generic; @@ -14,6 +15,8 @@ public partial class BooleanValue { protected BooleanValue() => throw null; + internal BooleanValue(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult Get(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/dictionary/src/Generated/DatetimeValue.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/dictionary/src/Generated/DatetimeValue.cs index 1063eabc942..03241999bc4 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/dictionary/src/Generated/DatetimeValue.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/dictionary/src/Generated/DatetimeValue.cs @@ -15,6 +15,8 @@ public partial class DatetimeValue { protected DatetimeValue() => throw null; + internal DatetimeValue(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult Get(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/dictionary/src/Generated/DictionaryClient.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/dictionary/src/Generated/DictionaryClient.cs index 62f36b059e2..54d7b564602 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/dictionary/src/Generated/DictionaryClient.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/dictionary/src/Generated/DictionaryClient.cs @@ -12,10 +12,12 @@ public partial class DictionaryClient { public DictionaryClient() : this(new Uri("http://localhost:3000"), new DictionaryClientOptions()) => throw null; - public DictionaryClient(Uri endpoint, DictionaryClientOptions options) => throw null; + internal DictionaryClient(AuthenticationPolicy authenticationPolicy, Uri endpoint, DictionaryClientOptions options) => throw null; + + public DictionaryClient(Uri endpoint, DictionaryClientOptions options) : this(null, endpoint, options) => throw null; [Experimental("SCME0002")] - public DictionaryClient(DictionaryClientSettings settings) : this(settings?.Endpoint, settings?.Options) => throw null; + public DictionaryClient(DictionaryClientSettings settings) : this(AuthenticationPolicy.Create(settings), settings?.Endpoint, settings?.Options) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/dictionary/src/Generated/DurationValue.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/dictionary/src/Generated/DurationValue.cs index 677f6e3c69f..025fb9260d0 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/dictionary/src/Generated/DurationValue.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/dictionary/src/Generated/DurationValue.cs @@ -15,6 +15,8 @@ public partial class DurationValue { protected DurationValue() => throw null; + internal DurationValue(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult Get(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/dictionary/src/Generated/Float32Value.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/dictionary/src/Generated/Float32Value.cs index 89e188a1dfa..bb5152ac021 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/dictionary/src/Generated/Float32Value.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/dictionary/src/Generated/Float32Value.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Collections.Generic; @@ -14,6 +15,8 @@ public partial class Float32Value { protected Float32Value() => throw null; + internal Float32Value(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult Get(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/dictionary/src/Generated/Int32Value.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/dictionary/src/Generated/Int32Value.cs index 1746503b91b..943b687f046 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/dictionary/src/Generated/Int32Value.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/dictionary/src/Generated/Int32Value.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Collections.Generic; @@ -14,6 +15,8 @@ public partial class Int32Value { protected Int32Value() => throw null; + internal Int32Value(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult Get(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/dictionary/src/Generated/Int64Value.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/dictionary/src/Generated/Int64Value.cs index a86d59c62e2..7963141ea14 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/dictionary/src/Generated/Int64Value.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/dictionary/src/Generated/Int64Value.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Collections.Generic; @@ -14,6 +15,8 @@ public partial class Int64Value { protected Int64Value() => throw null; + internal Int64Value(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult Get(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/dictionary/src/Generated/ModelValue.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/dictionary/src/Generated/ModelValue.cs index becd3b219d2..58bd7395fb9 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/dictionary/src/Generated/ModelValue.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/dictionary/src/Generated/ModelValue.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Collections.Generic; @@ -14,6 +15,8 @@ public partial class ModelValue { protected ModelValue() => throw null; + internal ModelValue(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult Get(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/dictionary/src/Generated/NullableFloatValue.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/dictionary/src/Generated/NullableFloatValue.cs index bf6a1626799..b1b16591b20 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/dictionary/src/Generated/NullableFloatValue.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/dictionary/src/Generated/NullableFloatValue.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Collections.Generic; @@ -14,6 +15,8 @@ public partial class NullableFloatValue { protected NullableFloatValue() => throw null; + internal NullableFloatValue(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult Get(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/dictionary/src/Generated/RecursiveModelValue.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/dictionary/src/Generated/RecursiveModelValue.cs index 83cced869b4..eb4eac17013 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/dictionary/src/Generated/RecursiveModelValue.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/dictionary/src/Generated/RecursiveModelValue.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Collections.Generic; @@ -14,6 +15,8 @@ public partial class RecursiveModelValue { protected RecursiveModelValue() => throw null; + internal RecursiveModelValue(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult Get(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/dictionary/src/Generated/StringValue.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/dictionary/src/Generated/StringValue.cs index 66b9650148f..7fe039c683c 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/dictionary/src/Generated/StringValue.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/dictionary/src/Generated/StringValue.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Collections.Generic; @@ -14,6 +15,8 @@ public partial class StringValue { protected StringValue() => throw null; + internal StringValue(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult Get(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/dictionary/src/Generated/UnknownValue.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/dictionary/src/Generated/UnknownValue.cs index 4106f860d0b..f91e8911853 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/dictionary/src/Generated/UnknownValue.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/dictionary/src/Generated/UnknownValue.cs @@ -15,6 +15,8 @@ public partial class UnknownValue { protected UnknownValue() => throw null; + internal UnknownValue(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult Get(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/enum/extensible/src/Generated/ExtensibleClient.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/enum/extensible/src/Generated/ExtensibleClient.cs index 1519ba1020a..25a7ff8aa60 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/enum/extensible/src/Generated/ExtensibleClient.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/enum/extensible/src/Generated/ExtensibleClient.cs @@ -12,10 +12,12 @@ public partial class ExtensibleClient { public ExtensibleClient() : this(new Uri("http://localhost:3000"), new ExtensibleClientOptions()) => throw null; - public ExtensibleClient(Uri endpoint, ExtensibleClientOptions options) => throw null; + internal ExtensibleClient(AuthenticationPolicy authenticationPolicy, Uri endpoint, ExtensibleClientOptions options) => throw null; + + public ExtensibleClient(Uri endpoint, ExtensibleClientOptions options) : this(null, endpoint, options) => throw null; [Experimental("SCME0002")] - public ExtensibleClient(ExtensibleClientSettings settings) : this(settings?.Endpoint, settings?.Options) => throw null; + public ExtensibleClient(ExtensibleClientSettings settings) : this(AuthenticationPolicy.Create(settings), settings?.Endpoint, settings?.Options) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/enum/extensible/src/Generated/String.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/enum/extensible/src/Generated/String.cs index c4aadc25dce..30632b37530 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/enum/extensible/src/Generated/String.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/enum/extensible/src/Generated/String.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -13,6 +14,8 @@ public partial class String { protected String() => throw null; + internal String(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult GetKnownValue(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/enum/fixed/src/Generated/FixedClient.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/enum/fixed/src/Generated/FixedClient.cs index d035af03d3c..b111aa81947 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/enum/fixed/src/Generated/FixedClient.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/enum/fixed/src/Generated/FixedClient.cs @@ -12,10 +12,12 @@ public partial class FixedClient { public FixedClient() : this(new Uri("http://localhost:3000"), new FixedClientOptions()) => throw null; - public FixedClient(Uri endpoint, FixedClientOptions options) => throw null; + internal FixedClient(AuthenticationPolicy authenticationPolicy, Uri endpoint, FixedClientOptions options) => throw null; + + public FixedClient(Uri endpoint, FixedClientOptions options) : this(null, endpoint, options) => throw null; [Experimental("SCME0002")] - public FixedClient(FixedClientSettings settings) : this(settings?.Endpoint, settings?.Options) => throw null; + public FixedClient(FixedClientSettings settings) : this(AuthenticationPolicy.Create(settings), settings?.Endpoint, settings?.Options) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/enum/fixed/src/Generated/String.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/enum/fixed/src/Generated/String.cs index 65c6edb1c24..056c892aa72 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/enum/fixed/src/Generated/String.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/enum/fixed/src/Generated/String.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -13,6 +14,8 @@ public partial class String { protected String() => throw null; + internal String(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult GetKnownValue(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/AdditionalPropertiesClient.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/AdditionalPropertiesClient.cs index d10d4de3960..237007e44d6 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/AdditionalPropertiesClient.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/AdditionalPropertiesClient.cs @@ -12,10 +12,12 @@ public partial class AdditionalPropertiesClient { public AdditionalPropertiesClient() : this(new Uri("http://localhost:3000"), new AdditionalPropertiesClientOptions()) => throw null; - public AdditionalPropertiesClient(Uri endpoint, AdditionalPropertiesClientOptions options) => throw null; + internal AdditionalPropertiesClient(AuthenticationPolicy authenticationPolicy, Uri endpoint, AdditionalPropertiesClientOptions options) => throw null; + + public AdditionalPropertiesClient(Uri endpoint, AdditionalPropertiesClientOptions options) : this(null, endpoint, options) => throw null; [Experimental("SCME0002")] - public AdditionalPropertiesClient(AdditionalPropertiesClientSettings settings) : this(settings?.Endpoint, settings?.Options) => throw null; + public AdditionalPropertiesClient(AdditionalPropertiesClientSettings settings) : this(AuthenticationPolicy.Create(settings), settings?.Endpoint, settings?.Options) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/ExtendsDifferentSpreadFloat.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/ExtendsDifferentSpreadFloat.cs index 3711caec903..aa298158cb9 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/ExtendsDifferentSpreadFloat.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/ExtendsDifferentSpreadFloat.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -13,6 +14,8 @@ public partial class ExtendsDifferentSpreadFloat { protected ExtendsDifferentSpreadFloat() => throw null; + internal ExtendsDifferentSpreadFloat(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult Get(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/ExtendsDifferentSpreadModel.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/ExtendsDifferentSpreadModel.cs index 16952422f03..eaf913f4276 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/ExtendsDifferentSpreadModel.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/ExtendsDifferentSpreadModel.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -13,6 +14,8 @@ public partial class ExtendsDifferentSpreadModel { protected ExtendsDifferentSpreadModel() => throw null; + internal ExtendsDifferentSpreadModel(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult Get(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/ExtendsDifferentSpreadModelArray.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/ExtendsDifferentSpreadModelArray.cs index cafdfaa177b..2aacfeb2d02 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/ExtendsDifferentSpreadModelArray.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/ExtendsDifferentSpreadModelArray.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -13,6 +14,8 @@ public partial class ExtendsDifferentSpreadModelArray { protected ExtendsDifferentSpreadModelArray() => throw null; + internal ExtendsDifferentSpreadModelArray(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult Get(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/ExtendsDifferentSpreadString.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/ExtendsDifferentSpreadString.cs index 14de43be0c4..3ee0ddc45c5 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/ExtendsDifferentSpreadString.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/ExtendsDifferentSpreadString.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -13,6 +14,8 @@ public partial class ExtendsDifferentSpreadString { protected ExtendsDifferentSpreadString() => throw null; + internal ExtendsDifferentSpreadString(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult Get(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/ExtendsFloat.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/ExtendsFloat.cs index db8c90aa883..6f55bee1976 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/ExtendsFloat.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/ExtendsFloat.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -13,6 +14,8 @@ public partial class ExtendsFloat { protected ExtendsFloat() => throw null; + internal ExtendsFloat(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult Get(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/ExtendsModel.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/ExtendsModel.cs index fc3605496dc..a3e6a49c40f 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/ExtendsModel.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/ExtendsModel.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -13,6 +14,8 @@ public partial class ExtendsModel { protected ExtendsModel() => throw null; + internal ExtendsModel(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult Get(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/ExtendsModelArray.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/ExtendsModelArray.cs index 9fac072dc49..1da8aae31d1 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/ExtendsModelArray.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/ExtendsModelArray.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -13,6 +14,8 @@ public partial class ExtendsModelArray { protected ExtendsModelArray() => throw null; + internal ExtendsModelArray(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult Get(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/ExtendsString.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/ExtendsString.cs index 25a8bce5e84..13a5fbf8c13 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/ExtendsString.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/ExtendsString.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -13,6 +14,8 @@ public partial class ExtendsString { protected ExtendsString() => throw null; + internal ExtendsString(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult Get(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/ExtendsUnknown.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/ExtendsUnknown.cs index 3beb5baea3f..6e539221d9b 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/ExtendsUnknown.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/ExtendsUnknown.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -13,6 +14,8 @@ public partial class ExtendsUnknown { protected ExtendsUnknown() => throw null; + internal ExtendsUnknown(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult Get(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/ExtendsUnknownDerived.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/ExtendsUnknownDerived.cs index 1ba9e2819a5..f1636a68905 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/ExtendsUnknownDerived.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/ExtendsUnknownDerived.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -13,6 +14,8 @@ public partial class ExtendsUnknownDerived { protected ExtendsUnknownDerived() => throw null; + internal ExtendsUnknownDerived(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult Get(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/ExtendsUnknownDiscriminated.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/ExtendsUnknownDiscriminated.cs index dddd20125ee..261d9de0a04 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/ExtendsUnknownDiscriminated.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/ExtendsUnknownDiscriminated.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -13,6 +14,8 @@ public partial class ExtendsUnknownDiscriminated { protected ExtendsUnknownDiscriminated() => throw null; + internal ExtendsUnknownDiscriminated(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult Get(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/IsFloat.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/IsFloat.cs index 74284e4cd58..8be79e2ef26 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/IsFloat.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/IsFloat.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -13,6 +14,8 @@ public partial class IsFloat { protected IsFloat() => throw null; + internal IsFloat(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult Get(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/IsModel.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/IsModel.cs index 035ee852f98..65a3fa72022 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/IsModel.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/IsModel.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -13,6 +14,8 @@ public partial class IsModel { protected IsModel() => throw null; + internal IsModel(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult Get(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/IsModelArray.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/IsModelArray.cs index cb2785116e5..a4a639ee799 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/IsModelArray.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/IsModelArray.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -13,6 +14,8 @@ public partial class IsModelArray { protected IsModelArray() => throw null; + internal IsModelArray(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult Get(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/IsString.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/IsString.cs index 6281cebe5bc..10718fca333 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/IsString.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/IsString.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -13,6 +14,8 @@ public partial class IsString { protected IsString() => throw null; + internal IsString(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult Get(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/IsUnknown.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/IsUnknown.cs index 756f70c38ba..19c46424094 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/IsUnknown.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/IsUnknown.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -13,6 +14,8 @@ public partial class IsUnknown { protected IsUnknown() => throw null; + internal IsUnknown(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult Get(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/IsUnknownDerived.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/IsUnknownDerived.cs index c60981109bc..50e217613ef 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/IsUnknownDerived.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/IsUnknownDerived.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -13,6 +14,8 @@ public partial class IsUnknownDerived { protected IsUnknownDerived() => throw null; + internal IsUnknownDerived(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult Get(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/IsUnknownDiscriminated.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/IsUnknownDiscriminated.cs index 3686c8c898c..f6470550016 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/IsUnknownDiscriminated.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/IsUnknownDiscriminated.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -13,6 +14,8 @@ public partial class IsUnknownDiscriminated { protected IsUnknownDiscriminated() => throw null; + internal IsUnknownDiscriminated(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult Get(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/MultipleSpread.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/MultipleSpread.cs index 9b081a1a362..47355266fd2 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/MultipleSpread.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/MultipleSpread.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -13,6 +14,8 @@ public partial class MultipleSpread { protected MultipleSpread() => throw null; + internal MultipleSpread(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult Get(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/SpreadDifferentFloat.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/SpreadDifferentFloat.cs index f86ae0c3e6e..33d2e052e33 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/SpreadDifferentFloat.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/SpreadDifferentFloat.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -13,6 +14,8 @@ public partial class SpreadDifferentFloat { protected SpreadDifferentFloat() => throw null; + internal SpreadDifferentFloat(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult Get(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/SpreadDifferentModel.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/SpreadDifferentModel.cs index 0ba5c6d4854..a69132c7526 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/SpreadDifferentModel.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/SpreadDifferentModel.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -13,6 +14,8 @@ public partial class SpreadDifferentModel { protected SpreadDifferentModel() => throw null; + internal SpreadDifferentModel(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult Get(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/SpreadDifferentModelArray.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/SpreadDifferentModelArray.cs index 0d1cd493e84..5c6d809aa7c 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/SpreadDifferentModelArray.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/SpreadDifferentModelArray.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -13,6 +14,8 @@ public partial class SpreadDifferentModelArray { protected SpreadDifferentModelArray() => throw null; + internal SpreadDifferentModelArray(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult Get(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/SpreadDifferentString.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/SpreadDifferentString.cs index d990d8ba2c3..4123898a1ec 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/SpreadDifferentString.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/SpreadDifferentString.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -13,6 +14,8 @@ public partial class SpreadDifferentString { protected SpreadDifferentString() => throw null; + internal SpreadDifferentString(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult Get(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/SpreadFloat.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/SpreadFloat.cs index a97ea7ff831..a529e2b406f 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/SpreadFloat.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/SpreadFloat.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -13,6 +14,8 @@ public partial class SpreadFloat { protected SpreadFloat() => throw null; + internal SpreadFloat(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult Get(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/SpreadModel.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/SpreadModel.cs index 3db2515a716..002a15917bc 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/SpreadModel.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/SpreadModel.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -13,6 +14,8 @@ public partial class SpreadModel { protected SpreadModel() => throw null; + internal SpreadModel(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult Get(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/SpreadModelArray.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/SpreadModelArray.cs index aec0c659e11..bdc347b9941 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/SpreadModelArray.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/SpreadModelArray.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -13,6 +14,8 @@ public partial class SpreadModelArray { protected SpreadModelArray() => throw null; + internal SpreadModelArray(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult Get(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/SpreadRecordNonDiscriminatedUnion.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/SpreadRecordNonDiscriminatedUnion.cs index 89de049334c..dfd6786a0ab 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/SpreadRecordNonDiscriminatedUnion.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/SpreadRecordNonDiscriminatedUnion.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -13,6 +14,8 @@ public partial class SpreadRecordNonDiscriminatedUnion { protected SpreadRecordNonDiscriminatedUnion() => throw null; + internal SpreadRecordNonDiscriminatedUnion(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult Get(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/SpreadRecordNonDiscriminatedUnion2.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/SpreadRecordNonDiscriminatedUnion2.cs index e78b2929cd9..d33e1a547dc 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/SpreadRecordNonDiscriminatedUnion2.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/SpreadRecordNonDiscriminatedUnion2.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -13,6 +14,8 @@ public partial class SpreadRecordNonDiscriminatedUnion2 { protected SpreadRecordNonDiscriminatedUnion2() => throw null; + internal SpreadRecordNonDiscriminatedUnion2(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult Get(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/SpreadRecordNonDiscriminatedUnion3.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/SpreadRecordNonDiscriminatedUnion3.cs index ecb9285fa4e..76b3cf8b1fe 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/SpreadRecordNonDiscriminatedUnion3.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/SpreadRecordNonDiscriminatedUnion3.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -13,6 +14,8 @@ public partial class SpreadRecordNonDiscriminatedUnion3 { protected SpreadRecordNonDiscriminatedUnion3() => throw null; + internal SpreadRecordNonDiscriminatedUnion3(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult Get(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/SpreadRecordUnion.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/SpreadRecordUnion.cs index 7cc11db7439..97de92c85f4 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/SpreadRecordUnion.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/SpreadRecordUnion.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -13,6 +14,8 @@ public partial class SpreadRecordUnion { protected SpreadRecordUnion() => throw null; + internal SpreadRecordUnion(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult Get(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/SpreadString.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/SpreadString.cs index 2c4d33288de..4864d532e5a 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/SpreadString.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/SpreadString.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -13,6 +14,8 @@ public partial class SpreadString { protected SpreadString() => throw null; + internal SpreadString(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult Get(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/nullable/src/Generated/Bytes.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/nullable/src/Generated/Bytes.cs index eacf8814b15..4e6ff0b6f10 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/nullable/src/Generated/Bytes.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/nullable/src/Generated/Bytes.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -13,6 +14,8 @@ public partial class Bytes { protected Bytes() => throw null; + internal Bytes(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult GetNonNull(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/nullable/src/Generated/CollectionsByte.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/nullable/src/Generated/CollectionsByte.cs index ad2cd996943..147ed22adef 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/nullable/src/Generated/CollectionsByte.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/nullable/src/Generated/CollectionsByte.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -13,6 +14,8 @@ public partial class CollectionsByte { protected CollectionsByte() => throw null; + internal CollectionsByte(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult GetNonNull(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/nullable/src/Generated/CollectionsModel.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/nullable/src/Generated/CollectionsModel.cs index a424dcc6309..a2cb3752dd3 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/nullable/src/Generated/CollectionsModel.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/nullable/src/Generated/CollectionsModel.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -13,6 +14,8 @@ public partial class CollectionsModel { protected CollectionsModel() => throw null; + internal CollectionsModel(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult GetNonNull(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/nullable/src/Generated/CollectionsString.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/nullable/src/Generated/CollectionsString.cs index 3481b5221d5..9ebdb4ed447 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/nullable/src/Generated/CollectionsString.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/nullable/src/Generated/CollectionsString.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -13,6 +14,8 @@ public partial class CollectionsString { protected CollectionsString() => throw null; + internal CollectionsString(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult GetNonNull(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/nullable/src/Generated/Datetime.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/nullable/src/Generated/Datetime.cs index 2d316f989b4..65fd66ab449 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/nullable/src/Generated/Datetime.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/nullable/src/Generated/Datetime.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -13,6 +14,8 @@ public partial class Datetime { protected Datetime() => throw null; + internal Datetime(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult GetNonNull(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/nullable/src/Generated/Duration.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/nullable/src/Generated/Duration.cs index 5436a4fda27..d1091acfe3d 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/nullable/src/Generated/Duration.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/nullable/src/Generated/Duration.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -13,6 +14,8 @@ public partial class Duration { protected Duration() => throw null; + internal Duration(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult GetNonNull(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/nullable/src/Generated/NullableClient.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/nullable/src/Generated/NullableClient.cs index 345bda037b6..af9921af400 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/nullable/src/Generated/NullableClient.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/nullable/src/Generated/NullableClient.cs @@ -12,10 +12,12 @@ public partial class NullableClient { public NullableClient() : this(new Uri("http://localhost:3000"), new NullableClientOptions()) => throw null; - public NullableClient(Uri endpoint, NullableClientOptions options) => throw null; + internal NullableClient(AuthenticationPolicy authenticationPolicy, Uri endpoint, NullableClientOptions options) => throw null; + + public NullableClient(Uri endpoint, NullableClientOptions options) : this(null, endpoint, options) => throw null; [Experimental("SCME0002")] - public NullableClient(NullableClientSettings settings) : this(settings?.Endpoint, settings?.Options) => throw null; + public NullableClient(NullableClientSettings settings) : this(AuthenticationPolicy.Create(settings), settings?.Endpoint, settings?.Options) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/nullable/src/Generated/String.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/nullable/src/Generated/String.cs index 461ad9d615b..786c381fb0b 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/nullable/src/Generated/String.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/nullable/src/Generated/String.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -13,6 +14,8 @@ public partial class String { protected String() => throw null; + internal String(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult GetNonNull(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/optionality/src/Generated/BooleanLiteral.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/optionality/src/Generated/BooleanLiteral.cs index 593e92d4244..6dca0711f46 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/optionality/src/Generated/BooleanLiteral.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/optionality/src/Generated/BooleanLiteral.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -13,6 +14,8 @@ public partial class BooleanLiteral { protected BooleanLiteral() => throw null; + internal BooleanLiteral(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult GetAll(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/optionality/src/Generated/Bytes.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/optionality/src/Generated/Bytes.cs index b4d7e3788e8..44c535cc253 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/optionality/src/Generated/Bytes.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/optionality/src/Generated/Bytes.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -13,6 +14,8 @@ public partial class Bytes { protected Bytes() => throw null; + internal Bytes(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult GetAll(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/optionality/src/Generated/CollectionsByte.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/optionality/src/Generated/CollectionsByte.cs index 706f6515fc5..808a6ca8b49 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/optionality/src/Generated/CollectionsByte.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/optionality/src/Generated/CollectionsByte.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -13,6 +14,8 @@ public partial class CollectionsByte { protected CollectionsByte() => throw null; + internal CollectionsByte(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult GetAll(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/optionality/src/Generated/CollectionsModel.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/optionality/src/Generated/CollectionsModel.cs index dfe28feac96..00be1dcec43 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/optionality/src/Generated/CollectionsModel.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/optionality/src/Generated/CollectionsModel.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -13,6 +14,8 @@ public partial class CollectionsModel { protected CollectionsModel() => throw null; + internal CollectionsModel(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult GetAll(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/optionality/src/Generated/Datetime.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/optionality/src/Generated/Datetime.cs index 5e578c2da19..3b2e4f0017b 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/optionality/src/Generated/Datetime.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/optionality/src/Generated/Datetime.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -13,6 +14,8 @@ public partial class Datetime { protected Datetime() => throw null; + internal Datetime(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult GetAll(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/optionality/src/Generated/Duration.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/optionality/src/Generated/Duration.cs index 03d2758ff8a..9a9c63ae762 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/optionality/src/Generated/Duration.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/optionality/src/Generated/Duration.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -13,6 +14,8 @@ public partial class Duration { protected Duration() => throw null; + internal Duration(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult GetAll(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/optionality/src/Generated/FloatLiteral.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/optionality/src/Generated/FloatLiteral.cs index 7d71a102cd8..f7504a61cf2 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/optionality/src/Generated/FloatLiteral.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/optionality/src/Generated/FloatLiteral.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -13,6 +14,8 @@ public partial class FloatLiteral { protected FloatLiteral() => throw null; + internal FloatLiteral(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult GetAll(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/optionality/src/Generated/IntLiteral.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/optionality/src/Generated/IntLiteral.cs index 5f5db298391..3309e35bfe2 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/optionality/src/Generated/IntLiteral.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/optionality/src/Generated/IntLiteral.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -13,6 +14,8 @@ public partial class IntLiteral { protected IntLiteral() => throw null; + internal IntLiteral(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult GetAll(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/optionality/src/Generated/OptionalClient.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/optionality/src/Generated/OptionalClient.cs index 63b9eb4e2c4..359640c4a3f 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/optionality/src/Generated/OptionalClient.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/optionality/src/Generated/OptionalClient.cs @@ -12,10 +12,12 @@ public partial class OptionalClient { public OptionalClient() : this(new Uri("http://localhost:3000"), new OptionalClientOptions()) => throw null; - public OptionalClient(Uri endpoint, OptionalClientOptions options) => throw null; + internal OptionalClient(AuthenticationPolicy authenticationPolicy, Uri endpoint, OptionalClientOptions options) => throw null; + + public OptionalClient(Uri endpoint, OptionalClientOptions options) : this(null, endpoint, options) => throw null; [Experimental("SCME0002")] - public OptionalClient(OptionalClientSettings settings) : this(settings?.Endpoint, settings?.Options) => throw null; + public OptionalClient(OptionalClientSettings settings) : this(AuthenticationPolicy.Create(settings), settings?.Endpoint, settings?.Options) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/optionality/src/Generated/PlainDate.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/optionality/src/Generated/PlainDate.cs index 27c9d8c861b..f95ec369404 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/optionality/src/Generated/PlainDate.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/optionality/src/Generated/PlainDate.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -13,6 +14,8 @@ public partial class PlainDate { protected PlainDate() => throw null; + internal PlainDate(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult GetAll(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/optionality/src/Generated/PlainTime.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/optionality/src/Generated/PlainTime.cs index 733f618e280..91c30419caf 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/optionality/src/Generated/PlainTime.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/optionality/src/Generated/PlainTime.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -13,6 +14,8 @@ public partial class PlainTime { protected PlainTime() => throw null; + internal PlainTime(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult GetAll(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/optionality/src/Generated/RequiredAndOptional.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/optionality/src/Generated/RequiredAndOptional.cs index 94bf40cd0f3..3253e5b109d 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/optionality/src/Generated/RequiredAndOptional.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/optionality/src/Generated/RequiredAndOptional.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -13,6 +14,8 @@ public partial class RequiredAndOptional { protected RequiredAndOptional() => throw null; + internal RequiredAndOptional(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult GetAll(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/optionality/src/Generated/String.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/optionality/src/Generated/String.cs index 223187bfb1e..def30985883 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/optionality/src/Generated/String.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/optionality/src/Generated/String.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -13,6 +14,8 @@ public partial class String { protected String() => throw null; + internal String(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult GetAll(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/optionality/src/Generated/StringLiteral.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/optionality/src/Generated/StringLiteral.cs index d6fca1040c1..a60ba46a07e 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/optionality/src/Generated/StringLiteral.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/optionality/src/Generated/StringLiteral.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -13,6 +14,8 @@ public partial class StringLiteral { protected StringLiteral() => throw null; + internal StringLiteral(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult GetAll(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/optionality/src/Generated/UnionFloatLiteral.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/optionality/src/Generated/UnionFloatLiteral.cs index aa088f014e9..9471446beff 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/optionality/src/Generated/UnionFloatLiteral.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/optionality/src/Generated/UnionFloatLiteral.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -13,6 +14,8 @@ public partial class UnionFloatLiteral { protected UnionFloatLiteral() => throw null; + internal UnionFloatLiteral(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult GetAll(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/optionality/src/Generated/UnionIntLiteral.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/optionality/src/Generated/UnionIntLiteral.cs index 65a65dc54ce..45324fc4c4d 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/optionality/src/Generated/UnionIntLiteral.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/optionality/src/Generated/UnionIntLiteral.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -13,6 +14,8 @@ public partial class UnionIntLiteral { protected UnionIntLiteral() => throw null; + internal UnionIntLiteral(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult GetAll(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/optionality/src/Generated/UnionStringLiteral.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/optionality/src/Generated/UnionStringLiteral.cs index 1041ae1cf99..4a44db8c460 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/optionality/src/Generated/UnionStringLiteral.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/optionality/src/Generated/UnionStringLiteral.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -13,6 +14,8 @@ public partial class UnionStringLiteral { protected UnionStringLiteral() => throw null; + internal UnionStringLiteral(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult GetAll(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/Boolean.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/Boolean.cs index 3f6b9d2df7c..f4e93d97aa5 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/Boolean.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/Boolean.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -13,6 +14,8 @@ public partial class Boolean { protected Boolean() => throw null; + internal Boolean(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult Get(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/BooleanLiteral.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/BooleanLiteral.cs index 679f7a738e3..e2bdc72c983 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/BooleanLiteral.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/BooleanLiteral.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -13,6 +14,8 @@ public partial class BooleanLiteral { protected BooleanLiteral() => throw null; + internal BooleanLiteral(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult Get(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/Bytes.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/Bytes.cs index b0a807a9c6d..428e3397974 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/Bytes.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/Bytes.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -13,6 +14,8 @@ public partial class Bytes { protected Bytes() => throw null; + internal Bytes(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult Get(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/CollectionsInt.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/CollectionsInt.cs index 3e6cc227cf5..f49bb79df44 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/CollectionsInt.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/CollectionsInt.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -13,6 +14,8 @@ public partial class CollectionsInt { protected CollectionsInt() => throw null; + internal CollectionsInt(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult Get(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/CollectionsModel.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/CollectionsModel.cs index 2a9ffb958a8..e40359c230c 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/CollectionsModel.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/CollectionsModel.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -13,6 +14,8 @@ public partial class CollectionsModel { protected CollectionsModel() => throw null; + internal CollectionsModel(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult Get(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/CollectionsString.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/CollectionsString.cs index c1dd5d23c45..18a7083e450 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/CollectionsString.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/CollectionsString.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -13,6 +14,8 @@ public partial class CollectionsString { protected CollectionsString() => throw null; + internal CollectionsString(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult Get(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/Datetime.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/Datetime.cs index b8f6983712b..9b6385a11da 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/Datetime.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/Datetime.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -13,6 +14,8 @@ public partial class Datetime { protected Datetime() => throw null; + internal Datetime(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult Get(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/Decimal.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/Decimal.cs index cfc5fa3fc48..90ac68ab77b 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/Decimal.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/Decimal.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -13,6 +14,8 @@ public partial class Decimal { protected Decimal() => throw null; + internal Decimal(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult Get(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/Decimal128.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/Decimal128.cs index 553501b9bdd..06b87e33722 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/Decimal128.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/Decimal128.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -13,6 +14,8 @@ public partial class Decimal128 { protected Decimal128() => throw null; + internal Decimal128(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult Get(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/DictionaryString.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/DictionaryString.cs index 0da288b589b..d1d5dc8e06e 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/DictionaryString.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/DictionaryString.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -13,6 +14,8 @@ public partial class DictionaryString { protected DictionaryString() => throw null; + internal DictionaryString(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult Get(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/Duration.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/Duration.cs index fb81d1ff2de..304ea7ce05e 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/Duration.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/Duration.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -13,6 +14,8 @@ public partial class Duration { protected Duration() => throw null; + internal Duration(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult Get(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/Enum.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/Enum.cs index 082585a6b1b..6ee002b6a38 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/Enum.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/Enum.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -13,6 +14,8 @@ public partial class Enum { protected Enum() => throw null; + internal Enum(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult Get(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/ExtensibleEnum.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/ExtensibleEnum.cs index 1d39d6232b2..05e0b19b4c5 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/ExtensibleEnum.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/ExtensibleEnum.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -13,6 +14,8 @@ public partial class ExtensibleEnum { protected ExtensibleEnum() => throw null; + internal ExtensibleEnum(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult Get(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/Float.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/Float.cs index 89917bd0d67..31ca39d2378 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/Float.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/Float.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -13,6 +14,8 @@ public partial class Float { protected Float() => throw null; + internal Float(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult Get(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/FloatLiteral.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/FloatLiteral.cs index 89f86508d9d..272147c3f79 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/FloatLiteral.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/FloatLiteral.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -13,6 +14,8 @@ public partial class FloatLiteral { protected FloatLiteral() => throw null; + internal FloatLiteral(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult Get(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/Int.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/Int.cs index e4e359014ea..42d5cab9109 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/Int.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/Int.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -13,6 +14,8 @@ public partial class Int { protected Int() => throw null; + internal Int(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult Get(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/IntLiteral.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/IntLiteral.cs index 75851545805..1504957189f 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/IntLiteral.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/IntLiteral.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -13,6 +14,8 @@ public partial class IntLiteral { protected IntLiteral() => throw null; + internal IntLiteral(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult Get(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/Model.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/Model.cs index 83467e85608..1c306e46d07 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/Model.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/Model.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -13,6 +14,8 @@ public partial class Model { protected Model() => throw null; + internal Model(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult Get(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/Never.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/Never.cs index 92ff671d14a..8e08e0fa31e 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/Never.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/Never.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -13,6 +14,8 @@ public partial class Never { protected Never() => throw null; + internal Never(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult Get(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/String.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/String.cs index 750373bbcfc..c49f8856b95 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/String.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/String.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -13,6 +14,8 @@ public partial class String { protected String() => throw null; + internal String(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult Get(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/StringLiteral.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/StringLiteral.cs index d02b76d3dd6..4e4108e032f 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/StringLiteral.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/StringLiteral.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -13,6 +14,8 @@ public partial class StringLiteral { protected StringLiteral() => throw null; + internal StringLiteral(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult Get(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/UnionEnumValue.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/UnionEnumValue.cs index 69962b5cd3f..bc5592782ce 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/UnionEnumValue.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/UnionEnumValue.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -13,6 +14,8 @@ public partial class UnionEnumValue { protected UnionEnumValue() => throw null; + internal UnionEnumValue(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult Get(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/UnionFloatLiteral.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/UnionFloatLiteral.cs index 620ccef7d9d..b722ec14e86 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/UnionFloatLiteral.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/UnionFloatLiteral.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -13,6 +14,8 @@ public partial class UnionFloatLiteral { protected UnionFloatLiteral() => throw null; + internal UnionFloatLiteral(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult Get(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/UnionIntLiteral.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/UnionIntLiteral.cs index 64b2d1651f8..32e42a85f40 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/UnionIntLiteral.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/UnionIntLiteral.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -13,6 +14,8 @@ public partial class UnionIntLiteral { protected UnionIntLiteral() => throw null; + internal UnionIntLiteral(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult Get(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/UnionStringLiteral.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/UnionStringLiteral.cs index 8dbaa7dec43..fde1c748c4d 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/UnionStringLiteral.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/UnionStringLiteral.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -13,6 +14,8 @@ public partial class UnionStringLiteral { protected UnionStringLiteral() => throw null; + internal UnionStringLiteral(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult Get(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/UnknownArray.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/UnknownArray.cs index b8e85f2c700..f40c76b820a 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/UnknownArray.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/UnknownArray.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -13,6 +14,8 @@ public partial class UnknownArray { protected UnknownArray() => throw null; + internal UnknownArray(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult Get(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/UnknownDict.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/UnknownDict.cs index 6c050d94eff..81fdff22645 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/UnknownDict.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/UnknownDict.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -13,6 +14,8 @@ public partial class UnknownDict { protected UnknownDict() => throw null; + internal UnknownDict(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult Get(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/UnknownInt.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/UnknownInt.cs index 222c28277e7..fb2f59c1cc5 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/UnknownInt.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/UnknownInt.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -13,6 +14,8 @@ public partial class UnknownInt { protected UnknownInt() => throw null; + internal UnknownInt(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult Get(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/UnknownString.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/UnknownString.cs index 2af9c5e7276..bb587ae7036 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/UnknownString.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/UnknownString.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -13,6 +14,8 @@ public partial class UnknownString { protected UnknownString() => throw null; + internal UnknownString(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult Get(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/ValueTypesClient.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/ValueTypesClient.cs index b2a31ce63d0..f0d9d59fb35 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/ValueTypesClient.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/ValueTypesClient.cs @@ -12,10 +12,12 @@ public partial class ValueTypesClient { public ValueTypesClient() : this(new Uri("http://localhost:3000"), new ValueTypesClientOptions()) => throw null; - public ValueTypesClient(Uri endpoint, ValueTypesClientOptions options) => throw null; + internal ValueTypesClient(AuthenticationPolicy authenticationPolicy, Uri endpoint, ValueTypesClientOptions options) => throw null; + + public ValueTypesClient(Uri endpoint, ValueTypesClientOptions options) : this(null, endpoint, options) => throw null; [Experimental("SCME0002")] - public ValueTypesClient(ValueTypesClientSettings settings) : this(settings?.Endpoint, settings?.Options) => throw null; + public ValueTypesClient(ValueTypesClientSettings settings) : this(AuthenticationPolicy.Create(settings), settings?.Endpoint, settings?.Options) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/scalar/src/Generated/Boolean.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/scalar/src/Generated/Boolean.cs index 12a173aba7d..f3a074a4c57 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/scalar/src/Generated/Boolean.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/scalar/src/Generated/Boolean.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -13,6 +14,8 @@ public partial class Boolean { protected Boolean() => throw null; + internal Boolean(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult Get(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/scalar/src/Generated/Decimal128Type.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/scalar/src/Generated/Decimal128Type.cs index 941ee7e41dc..6e3566ea66a 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/scalar/src/Generated/Decimal128Type.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/scalar/src/Generated/Decimal128Type.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -13,6 +14,8 @@ public partial class Decimal128Type { protected Decimal128Type() => throw null; + internal Decimal128Type(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult ResponseBody(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/scalar/src/Generated/Decimal128Verify.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/scalar/src/Generated/Decimal128Verify.cs index 01200f453d3..11e138c5ac3 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/scalar/src/Generated/Decimal128Verify.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/scalar/src/Generated/Decimal128Verify.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Collections.Generic; @@ -14,6 +15,8 @@ public partial class Decimal128Verify { protected Decimal128Verify() => throw null; + internal Decimal128Verify(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult PrepareVerify(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/scalar/src/Generated/DecimalType.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/scalar/src/Generated/DecimalType.cs index 281338de6ca..c225451e654 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/scalar/src/Generated/DecimalType.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/scalar/src/Generated/DecimalType.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -13,6 +14,8 @@ public partial class DecimalType { protected DecimalType() => throw null; + internal DecimalType(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult ResponseBody(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/scalar/src/Generated/DecimalVerify.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/scalar/src/Generated/DecimalVerify.cs index 3c38a946f65..6b00b6964ac 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/scalar/src/Generated/DecimalVerify.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/scalar/src/Generated/DecimalVerify.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Collections.Generic; @@ -14,6 +15,8 @@ public partial class DecimalVerify { protected DecimalVerify() => throw null; + internal DecimalVerify(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult PrepareVerify(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/scalar/src/Generated/ScalarClient.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/scalar/src/Generated/ScalarClient.cs index b8d8365878c..c446fb20afc 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/scalar/src/Generated/ScalarClient.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/scalar/src/Generated/ScalarClient.cs @@ -12,10 +12,12 @@ public partial class ScalarClient { public ScalarClient() : this(new Uri("http://localhost:3000"), new ScalarClientOptions()) => throw null; - public ScalarClient(Uri endpoint, ScalarClientOptions options) => throw null; + internal ScalarClient(AuthenticationPolicy authenticationPolicy, Uri endpoint, ScalarClientOptions options) => throw null; + + public ScalarClient(Uri endpoint, ScalarClientOptions options) : this(null, endpoint, options) => throw null; [Experimental("SCME0002")] - public ScalarClient(ScalarClientSettings settings) : this(settings?.Endpoint, settings?.Options) => throw null; + public ScalarClient(ScalarClientSettings settings) : this(AuthenticationPolicy.Create(settings), settings?.Endpoint, settings?.Options) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/scalar/src/Generated/String.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/scalar/src/Generated/String.cs index b1b7388d369..e58e6a99949 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/scalar/src/Generated/String.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/scalar/src/Generated/String.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -13,6 +14,8 @@ public partial class String { protected String() => throw null; + internal String(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult Get(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/scalar/src/Generated/Unknown.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/scalar/src/Generated/Unknown.cs index 39e08fd7025..ad255b77e27 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/scalar/src/Generated/Unknown.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/scalar/src/Generated/Unknown.cs @@ -14,6 +14,8 @@ public partial class Unknown { protected Unknown() => throw null; + internal Unknown(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult Get(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/union/src/Generated/EnumsOnly.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/union/src/Generated/EnumsOnly.cs index 5ea24aef091..326e87184ee 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/union/src/Generated/EnumsOnly.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/union/src/Generated/EnumsOnly.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -13,6 +14,8 @@ public partial class EnumsOnly { protected EnumsOnly() => throw null; + internal EnumsOnly(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult Get(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/union/src/Generated/FloatsOnly.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/union/src/Generated/FloatsOnly.cs index 6165e15eb36..687ca26b9d4 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/union/src/Generated/FloatsOnly.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/union/src/Generated/FloatsOnly.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -13,6 +14,8 @@ public partial class FloatsOnly { protected FloatsOnly() => throw null; + internal FloatsOnly(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult Get(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/union/src/Generated/IntsOnly.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/union/src/Generated/IntsOnly.cs index abb9c25fba4..d9e64843d11 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/union/src/Generated/IntsOnly.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/union/src/Generated/IntsOnly.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -13,6 +14,8 @@ public partial class IntsOnly { protected IntsOnly() => throw null; + internal IntsOnly(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult Get(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/union/src/Generated/MixedLiterals.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/union/src/Generated/MixedLiterals.cs index dc60eb0f3ab..7ee7a6ee49c 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/union/src/Generated/MixedLiterals.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/union/src/Generated/MixedLiterals.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -13,6 +14,8 @@ public partial class MixedLiterals { protected MixedLiterals() => throw null; + internal MixedLiterals(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult Get(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/union/src/Generated/MixedTypes.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/union/src/Generated/MixedTypes.cs index 72608045240..b7ae1cff2e4 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/union/src/Generated/MixedTypes.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/union/src/Generated/MixedTypes.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -13,6 +14,8 @@ public partial class MixedTypes { protected MixedTypes() => throw null; + internal MixedTypes(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult Get(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/union/src/Generated/ModelsOnly.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/union/src/Generated/ModelsOnly.cs index 9d638303f32..ebb37812dc0 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/union/src/Generated/ModelsOnly.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/union/src/Generated/ModelsOnly.cs @@ -14,6 +14,8 @@ public partial class ModelsOnly { protected ModelsOnly() => throw null; + internal ModelsOnly(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult Get(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/union/src/Generated/StringAndArray.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/union/src/Generated/StringAndArray.cs index 914985be3eb..0a470dd358d 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/union/src/Generated/StringAndArray.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/union/src/Generated/StringAndArray.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -13,6 +14,8 @@ public partial class StringAndArray { protected StringAndArray() => throw null; + internal StringAndArray(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult Get(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/union/src/Generated/StringExtensible.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/union/src/Generated/StringExtensible.cs index 04035a679a9..c6d886ad068 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/union/src/Generated/StringExtensible.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/union/src/Generated/StringExtensible.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -13,6 +14,8 @@ public partial class StringExtensible { protected StringExtensible() => throw null; + internal StringExtensible(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult Get(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/union/src/Generated/StringExtensibleNamed.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/union/src/Generated/StringExtensibleNamed.cs index e4299a80a88..85a4d399263 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/union/src/Generated/StringExtensibleNamed.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/union/src/Generated/StringExtensibleNamed.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -13,6 +14,8 @@ public partial class StringExtensibleNamed { protected StringExtensibleNamed() => throw null; + internal StringExtensibleNamed(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult Get(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/union/src/Generated/StringsOnly.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/union/src/Generated/StringsOnly.cs index e94cb73e42f..fb8ec122f24 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/union/src/Generated/StringsOnly.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/union/src/Generated/StringsOnly.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -13,6 +14,8 @@ public partial class StringsOnly { protected StringsOnly() => throw null; + internal StringsOnly(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult Get(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/union/src/Generated/UnionClient.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/union/src/Generated/UnionClient.cs index 84e89fe37f7..48df18bf7cc 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/union/src/Generated/UnionClient.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/union/src/Generated/UnionClient.cs @@ -12,10 +12,12 @@ public partial class UnionClient { public UnionClient() : this(new Uri("http://localhost:3000"), new UnionClientOptions()) => throw null; - public UnionClient(Uri endpoint, UnionClientOptions options) => throw null; + internal UnionClient(AuthenticationPolicy authenticationPolicy, Uri endpoint, UnionClientOptions options) => throw null; + + public UnionClient(Uri endpoint, UnionClientOptions options) : this(null, endpoint, options) => throw null; [Experimental("SCME0002")] - public UnionClient(UnionClientSettings settings) : this(settings?.Endpoint, settings?.Options) => throw null; + public UnionClient(UnionClientSettings settings) : this(AuthenticationPolicy.Create(settings), settings?.Endpoint, settings?.Options) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/added/v1/src/Generated/AddedClient.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/added/v1/src/Generated/AddedClient.cs index e59dbe60aa6..d3cfcb5aa70 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/added/v1/src/Generated/AddedClient.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/added/v1/src/Generated/AddedClient.cs @@ -17,10 +17,12 @@ public partial class AddedClient public AddedClient(Uri endpoint) : this(endpoint, new AddedClientOptions()) => throw null; - public AddedClient(Uri endpoint, AddedClientOptions options) => throw null; + internal AddedClient(AuthenticationPolicy authenticationPolicy, Uri endpoint, AddedClientOptions options) => throw null; + + public AddedClient(Uri endpoint, AddedClientOptions options) : this(null, endpoint, options) => throw null; [Experimental("SCME0002")] - public AddedClient(AddedClientSettings settings) : this(settings?.Endpoint, settings?.Options) => throw null; + public AddedClient(AddedClientSettings settings) : this(AuthenticationPolicy.Create(settings), settings?.Endpoint, settings?.Options) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/added/v2/src/Generated/AddedClient.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/added/v2/src/Generated/AddedClient.cs index 6df5b4baa38..6f27070b32e 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/added/v2/src/Generated/AddedClient.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/added/v2/src/Generated/AddedClient.cs @@ -17,10 +17,12 @@ public partial class AddedClient public AddedClient(Uri endpoint) : this(endpoint, new AddedClientOptions()) => throw null; - public AddedClient(Uri endpoint, AddedClientOptions options) => throw null; + internal AddedClient(AuthenticationPolicy authenticationPolicy, Uri endpoint, AddedClientOptions options) => throw null; + + public AddedClient(Uri endpoint, AddedClientOptions options) : this(null, endpoint, options) => throw null; [Experimental("SCME0002")] - public AddedClient(AddedClientSettings settings) : this(settings?.Endpoint, settings?.Options) => throw null; + public AddedClient(AddedClientSettings settings) : this(AuthenticationPolicy.Create(settings), settings?.Endpoint, settings?.Options) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/added/v2/src/Generated/InterfaceV2.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/added/v2/src/Generated/InterfaceV2.cs index cef6e78f45d..09e38898e24 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/added/v2/src/Generated/InterfaceV2.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/added/v2/src/Generated/InterfaceV2.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -13,6 +14,8 @@ public partial class InterfaceV2 { protected InterfaceV2() => throw null; + internal InterfaceV2(ClientPipeline pipeline, Uri endpoint, string version) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult V2InInterface(BinaryContent content, RequestOptions options = null) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/madeOptional/v1/src/Generated/MadeOptionalClient.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/madeOptional/v1/src/Generated/MadeOptionalClient.cs index 0ede1d2c6c6..d78e1fe494b 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/madeOptional/v1/src/Generated/MadeOptionalClient.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/madeOptional/v1/src/Generated/MadeOptionalClient.cs @@ -17,10 +17,12 @@ public partial class MadeOptionalClient public MadeOptionalClient(Uri endpoint) : this(endpoint, new MadeOptionalClientOptions()) => throw null; - public MadeOptionalClient(Uri endpoint, MadeOptionalClientOptions options) => throw null; + internal MadeOptionalClient(AuthenticationPolicy authenticationPolicy, Uri endpoint, MadeOptionalClientOptions options) => throw null; + + public MadeOptionalClient(Uri endpoint, MadeOptionalClientOptions options) : this(null, endpoint, options) => throw null; [Experimental("SCME0002")] - public MadeOptionalClient(MadeOptionalClientSettings settings) : this(settings?.Endpoint, settings?.Options) => throw null; + public MadeOptionalClient(MadeOptionalClientSettings settings) : this(AuthenticationPolicy.Create(settings), settings?.Endpoint, settings?.Options) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/madeOptional/v2/src/Generated/MadeOptionalClient.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/madeOptional/v2/src/Generated/MadeOptionalClient.cs index d777d66aaf0..a7c5df86c22 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/madeOptional/v2/src/Generated/MadeOptionalClient.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/madeOptional/v2/src/Generated/MadeOptionalClient.cs @@ -17,10 +17,12 @@ public partial class MadeOptionalClient public MadeOptionalClient(Uri endpoint) : this(endpoint, new MadeOptionalClientOptions()) => throw null; - public MadeOptionalClient(Uri endpoint, MadeOptionalClientOptions options) => throw null; + internal MadeOptionalClient(AuthenticationPolicy authenticationPolicy, Uri endpoint, MadeOptionalClientOptions options) => throw null; + + public MadeOptionalClient(Uri endpoint, MadeOptionalClientOptions options) : this(null, endpoint, options) => throw null; [Experimental("SCME0002")] - public MadeOptionalClient(MadeOptionalClientSettings settings) : this(settings?.Endpoint, settings?.Options) => throw null; + public MadeOptionalClient(MadeOptionalClientSettings settings) : this(AuthenticationPolicy.Create(settings), settings?.Endpoint, settings?.Options) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/removed/v1/src/Generated/InterfaceV1.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/removed/v1/src/Generated/InterfaceV1.cs index d3656e7c8d6..65f7690e6d9 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/removed/v1/src/Generated/InterfaceV1.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/removed/v1/src/Generated/InterfaceV1.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -13,6 +14,8 @@ public partial class InterfaceV1 { protected InterfaceV1() => throw null; + internal InterfaceV1(ClientPipeline pipeline, Uri endpoint, string version) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult V1InInterface(BinaryContent content, RequestOptions options = null) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/removed/v1/src/Generated/RemovedClient.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/removed/v1/src/Generated/RemovedClient.cs index 0494eec7ee4..3dfd35529a9 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/removed/v1/src/Generated/RemovedClient.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/removed/v1/src/Generated/RemovedClient.cs @@ -17,10 +17,12 @@ public partial class RemovedClient public RemovedClient(Uri endpoint) : this(endpoint, new RemovedClientOptions()) => throw null; - public RemovedClient(Uri endpoint, RemovedClientOptions options) => throw null; + internal RemovedClient(AuthenticationPolicy authenticationPolicy, Uri endpoint, RemovedClientOptions options) => throw null; + + public RemovedClient(Uri endpoint, RemovedClientOptions options) : this(null, endpoint, options) => throw null; [Experimental("SCME0002")] - public RemovedClient(RemovedClientSettings settings) : this(settings?.Endpoint, settings?.Options) => throw null; + public RemovedClient(RemovedClientSettings settings) : this(AuthenticationPolicy.Create(settings), settings?.Endpoint, settings?.Options) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/removed/v2/src/Generated/RemovedClient.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/removed/v2/src/Generated/RemovedClient.cs index 9c21a4389af..d07a44fd254 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/removed/v2/src/Generated/RemovedClient.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/removed/v2/src/Generated/RemovedClient.cs @@ -17,10 +17,12 @@ public partial class RemovedClient public RemovedClient(Uri endpoint) : this(endpoint, new RemovedClientOptions()) => throw null; - public RemovedClient(Uri endpoint, RemovedClientOptions options) => throw null; + internal RemovedClient(AuthenticationPolicy authenticationPolicy, Uri endpoint, RemovedClientOptions options) => throw null; + + public RemovedClient(Uri endpoint, RemovedClientOptions options) : this(null, endpoint, options) => throw null; [Experimental("SCME0002")] - public RemovedClient(RemovedClientSettings settings) : this(settings?.Endpoint, settings?.Options) => throw null; + public RemovedClient(RemovedClientSettings settings) : this(AuthenticationPolicy.Create(settings), settings?.Endpoint, settings?.Options) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/removed/v2Preview/src/Generated/InterfaceV1.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/removed/v2Preview/src/Generated/InterfaceV1.cs index d3656e7c8d6..65f7690e6d9 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/removed/v2Preview/src/Generated/InterfaceV1.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/removed/v2Preview/src/Generated/InterfaceV1.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -13,6 +14,8 @@ public partial class InterfaceV1 { protected InterfaceV1() => throw null; + internal InterfaceV1(ClientPipeline pipeline, Uri endpoint, string version) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult V1InInterface(BinaryContent content, RequestOptions options = null) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/removed/v2Preview/src/Generated/RemovedClient.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/removed/v2Preview/src/Generated/RemovedClient.cs index 0494eec7ee4..3dfd35529a9 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/removed/v2Preview/src/Generated/RemovedClient.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/removed/v2Preview/src/Generated/RemovedClient.cs @@ -17,10 +17,12 @@ public partial class RemovedClient public RemovedClient(Uri endpoint) : this(endpoint, new RemovedClientOptions()) => throw null; - public RemovedClient(Uri endpoint, RemovedClientOptions options) => throw null; + internal RemovedClient(AuthenticationPolicy authenticationPolicy, Uri endpoint, RemovedClientOptions options) => throw null; + + public RemovedClient(Uri endpoint, RemovedClientOptions options) : this(null, endpoint, options) => throw null; [Experimental("SCME0002")] - public RemovedClient(RemovedClientSettings settings) : this(settings?.Endpoint, settings?.Options) => throw null; + public RemovedClient(RemovedClientSettings settings) : this(AuthenticationPolicy.Create(settings), settings?.Endpoint, settings?.Options) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/renamedFrom/v1/src/Generated/OldInterface.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/renamedFrom/v1/src/Generated/OldInterface.cs index 27d6fdcc629..165af44a376 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/renamedFrom/v1/src/Generated/OldInterface.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/renamedFrom/v1/src/Generated/OldInterface.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -13,6 +14,8 @@ public partial class OldInterface { protected OldInterface() => throw null; + internal OldInterface(ClientPipeline pipeline, Uri endpoint, string version) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult NewOpInNewInterface(BinaryContent content, RequestOptions options = null) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/renamedFrom/v1/src/Generated/RenamedFromClient.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/renamedFrom/v1/src/Generated/RenamedFromClient.cs index 77a991092ec..936e395e08f 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/renamedFrom/v1/src/Generated/RenamedFromClient.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/renamedFrom/v1/src/Generated/RenamedFromClient.cs @@ -17,10 +17,12 @@ public partial class RenamedFromClient public RenamedFromClient(Uri endpoint) : this(endpoint, new RenamedFromClientOptions()) => throw null; - public RenamedFromClient(Uri endpoint, RenamedFromClientOptions options) => throw null; + internal RenamedFromClient(AuthenticationPolicy authenticationPolicy, Uri endpoint, RenamedFromClientOptions options) => throw null; + + public RenamedFromClient(Uri endpoint, RenamedFromClientOptions options) : this(null, endpoint, options) => throw null; [Experimental("SCME0002")] - public RenamedFromClient(RenamedFromClientSettings settings) : this(settings?.Endpoint, settings?.Options) => throw null; + public RenamedFromClient(RenamedFromClientSettings settings) : this(AuthenticationPolicy.Create(settings), settings?.Endpoint, settings?.Options) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/renamedFrom/v2/src/Generated/NewInterface.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/renamedFrom/v2/src/Generated/NewInterface.cs index 959c7a48106..5a2e1c3333e 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/renamedFrom/v2/src/Generated/NewInterface.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/renamedFrom/v2/src/Generated/NewInterface.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -13,6 +14,8 @@ public partial class NewInterface { protected NewInterface() => throw null; + internal NewInterface(ClientPipeline pipeline, Uri endpoint, string version) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult NewOpInNewInterface(BinaryContent content, RequestOptions options = null) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/renamedFrom/v2/src/Generated/RenamedFromClient.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/renamedFrom/v2/src/Generated/RenamedFromClient.cs index 02cd0a8b330..18dab03d399 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/renamedFrom/v2/src/Generated/RenamedFromClient.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/renamedFrom/v2/src/Generated/RenamedFromClient.cs @@ -17,10 +17,12 @@ public partial class RenamedFromClient public RenamedFromClient(Uri endpoint) : this(endpoint, new RenamedFromClientOptions()) => throw null; - public RenamedFromClient(Uri endpoint, RenamedFromClientOptions options) => throw null; + internal RenamedFromClient(AuthenticationPolicy authenticationPolicy, Uri endpoint, RenamedFromClientOptions options) => throw null; + + public RenamedFromClient(Uri endpoint, RenamedFromClientOptions options) : this(null, endpoint, options) => throw null; [Experimental("SCME0002")] - public RenamedFromClient(RenamedFromClientSettings settings) : this(settings?.Endpoint, settings?.Options) => throw null; + public RenamedFromClient(RenamedFromClientSettings settings) : this(AuthenticationPolicy.Create(settings), settings?.Endpoint, settings?.Options) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/returnTypeChangedFrom/v1/src/Generated/ReturnTypeChangedFromClient.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/returnTypeChangedFrom/v1/src/Generated/ReturnTypeChangedFromClient.cs index 8841b668a8f..60b54b0ab97 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/returnTypeChangedFrom/v1/src/Generated/ReturnTypeChangedFromClient.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/returnTypeChangedFrom/v1/src/Generated/ReturnTypeChangedFromClient.cs @@ -17,10 +17,12 @@ public partial class ReturnTypeChangedFromClient public ReturnTypeChangedFromClient(Uri endpoint) : this(endpoint, new ReturnTypeChangedFromClientOptions()) => throw null; - public ReturnTypeChangedFromClient(Uri endpoint, ReturnTypeChangedFromClientOptions options) => throw null; + internal ReturnTypeChangedFromClient(AuthenticationPolicy authenticationPolicy, Uri endpoint, ReturnTypeChangedFromClientOptions options) => throw null; + + public ReturnTypeChangedFromClient(Uri endpoint, ReturnTypeChangedFromClientOptions options) : this(null, endpoint, options) => throw null; [Experimental("SCME0002")] - public ReturnTypeChangedFromClient(ReturnTypeChangedFromClientSettings settings) : this(settings?.Endpoint, settings?.Options) => throw null; + public ReturnTypeChangedFromClient(ReturnTypeChangedFromClientSettings settings) : this(AuthenticationPolicy.Create(settings), settings?.Endpoint, settings?.Options) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/returnTypeChangedFrom/v2/src/Generated/ReturnTypeChangedFromClient.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/returnTypeChangedFrom/v2/src/Generated/ReturnTypeChangedFromClient.cs index 4cb7e5f51eb..5a20ae37bc3 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/returnTypeChangedFrom/v2/src/Generated/ReturnTypeChangedFromClient.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/returnTypeChangedFrom/v2/src/Generated/ReturnTypeChangedFromClient.cs @@ -17,10 +17,12 @@ public partial class ReturnTypeChangedFromClient public ReturnTypeChangedFromClient(Uri endpoint) : this(endpoint, new ReturnTypeChangedFromClientOptions()) => throw null; - public ReturnTypeChangedFromClient(Uri endpoint, ReturnTypeChangedFromClientOptions options) => throw null; + internal ReturnTypeChangedFromClient(AuthenticationPolicy authenticationPolicy, Uri endpoint, ReturnTypeChangedFromClientOptions options) => throw null; + + public ReturnTypeChangedFromClient(Uri endpoint, ReturnTypeChangedFromClientOptions options) : this(null, endpoint, options) => throw null; [Experimental("SCME0002")] - public ReturnTypeChangedFromClient(ReturnTypeChangedFromClientSettings settings) : this(settings?.Endpoint, settings?.Options) => throw null; + public ReturnTypeChangedFromClient(ReturnTypeChangedFromClientSettings settings) : this(AuthenticationPolicy.Create(settings), settings?.Endpoint, settings?.Options) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/typeChangedFrom/v1/src/Generated/TypeChangedFromClient.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/typeChangedFrom/v1/src/Generated/TypeChangedFromClient.cs index 2d4aaf1394b..fc0dde04309 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/typeChangedFrom/v1/src/Generated/TypeChangedFromClient.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/typeChangedFrom/v1/src/Generated/TypeChangedFromClient.cs @@ -17,10 +17,12 @@ public partial class TypeChangedFromClient public TypeChangedFromClient(Uri endpoint) : this(endpoint, new TypeChangedFromClientOptions()) => throw null; - public TypeChangedFromClient(Uri endpoint, TypeChangedFromClientOptions options) => throw null; + internal TypeChangedFromClient(AuthenticationPolicy authenticationPolicy, Uri endpoint, TypeChangedFromClientOptions options) => throw null; + + public TypeChangedFromClient(Uri endpoint, TypeChangedFromClientOptions options) : this(null, endpoint, options) => throw null; [Experimental("SCME0002")] - public TypeChangedFromClient(TypeChangedFromClientSettings settings) : this(settings?.Endpoint, settings?.Options) => throw null; + public TypeChangedFromClient(TypeChangedFromClientSettings settings) : this(AuthenticationPolicy.Create(settings), settings?.Endpoint, settings?.Options) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/typeChangedFrom/v2/src/Generated/TypeChangedFromClient.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/typeChangedFrom/v2/src/Generated/TypeChangedFromClient.cs index 69ce861f652..bbb62a54e1a 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/typeChangedFrom/v2/src/Generated/TypeChangedFromClient.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/typeChangedFrom/v2/src/Generated/TypeChangedFromClient.cs @@ -17,10 +17,12 @@ public partial class TypeChangedFromClient public TypeChangedFromClient(Uri endpoint) : this(endpoint, new TypeChangedFromClientOptions()) => throw null; - public TypeChangedFromClient(Uri endpoint, TypeChangedFromClientOptions options) => throw null; + internal TypeChangedFromClient(AuthenticationPolicy authenticationPolicy, Uri endpoint, TypeChangedFromClientOptions options) => throw null; + + public TypeChangedFromClient(Uri endpoint, TypeChangedFromClientOptions options) : this(null, endpoint, options) => throw null; [Experimental("SCME0002")] - public TypeChangedFromClient(TypeChangedFromClientSettings settings) : this(settings?.Endpoint, settings?.Options) => throw null; + public TypeChangedFromClient(TypeChangedFromClientSettings settings) : this(AuthenticationPolicy.Create(settings), settings?.Endpoint, settings?.Options) => throw null; public ClientPipeline Pipeline => throw null; From a2b7147ad8b040b34e5a56a3ca211654114f6508 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 11 Mar 2026 04:49:12 +0000 Subject: [PATCH 13/38] fix(http-client-csharp): remove internal ctors from stubbed libraries; strip this() initializers from stubs Co-authored-by: JoshLove-msft <54595583+JoshLove-msft@users.noreply.github.com> --- .../src/StubLibraryVisitor.cs | 44 ++++++++++--------- .../api-key/src/Generated/ApiKeyClient.cs | 12 ++--- .../http/custom/src/Generated/CustomClient.cs | 13 ++---- .../oauth2/src/Generated/OAuth2Client.cs | 21 ++------- .../union/src/Generated/UnionClient.cs | 28 +++--------- .../src/Generated/FirstClient.cs | 8 ++-- .../src/Generated/Group3.cs | 4 -- .../src/Generated/Group4.cs | 4 -- .../src/Generated/Group5.cs | 4 -- .../src/Generated/SubNamespaceSecondClient.cs | 8 ++-- .../structure/default/src/Generated/Bar.cs | 3 -- .../structure/default/src/Generated/Baz.cs | 4 -- .../structure/default/src/Generated/BazFoo.cs | 4 -- .../structure/default/src/Generated/Foo.cs | 3 -- .../structure/default/src/Generated/Qux.cs | 4 -- .../structure/default/src/Generated/QuxBar.cs | 4 -- .../default/src/Generated/ServiceClient.cs | 8 ++-- .../src/Generated/ClientAClient.cs | 8 ++-- .../src/Generated/ClientBClient.cs | 8 ++-- .../renamed-operation/src/Generated/Group.cs | 4 -- .../src/Generated/RenamedOperationClient.cs | 8 ++-- .../src/Generated/Group1.cs | 4 -- .../src/Generated/Group2.cs | 4 -- .../src/Generated/TwoOperationGroupClient.cs | 8 ++-- .../src/Generated/DocumentationClient.cs | 8 ++-- .../http/documentation/src/Generated/Lists.cs | 3 -- .../src/Generated/TextFormatting.cs | 3 -- .../encode/array/src/Generated/ArrayClient.cs | 8 ++-- .../encode/array/src/Generated/Property.cs | 3 -- .../encode/bytes/src/Generated/BytesClient.cs | 8 ++-- .../http/encode/bytes/src/Generated/Header.cs | 2 - .../encode/bytes/src/Generated/Property.cs | 3 -- .../http/encode/bytes/src/Generated/Query.cs | 2 - .../encode/bytes/src/Generated/RequestBody.cs | 2 - .../bytes/src/Generated/ResponseBody.cs | 2 - .../datetime/src/Generated/DatetimeClient.cs | 8 ++-- .../encode/datetime/src/Generated/Header.cs | 2 - .../encode/datetime/src/Generated/Property.cs | 3 -- .../encode/datetime/src/Generated/Query.cs | 2 - .../datetime/src/Generated/ResponseHeader.cs | 3 -- .../duration/src/Generated/DurationClient.cs | 8 ++-- .../encode/duration/src/Generated/Header.cs | 2 - .../encode/duration/src/Generated/Property.cs | 3 -- .../encode/duration/src/Generated/Query.cs | 2 - .../numeric/src/Generated/NumericClient.cs | 8 ++-- .../encode/numeric/src/Generated/Property.cs | 3 -- .../basic/src/Generated/BasicClient.cs | 8 ++-- .../basic/src/Generated/ExplicitBody.cs | 3 -- .../basic/src/Generated/ImplicitBody.cs | 3 -- .../src/Generated/BodyOptionalityClient.cs | 8 ++-- .../src/Generated/OptionalExplicit.cs | 3 -- .../src/Generated/CollectionFormatClient.cs | 8 ++-- .../collection-format/src/Generated/Header.cs | 3 -- .../collection-format/src/Generated/Query.cs | 3 -- .../path/src/Generated/PathClient.cs | 8 ++-- .../query/src/Generated/Constant.cs | 3 -- .../query/src/Generated/QueryClient.cs | 8 ++-- .../parameters/spread/src/Generated/Alias.cs | 3 -- .../parameters/spread/src/Generated/Model.cs | 3 -- .../spread/src/Generated/SpreadClient.cs | 8 ++-- .../src/Generated/ContentNegotiationClient.cs | 8 ++-- .../src/Generated/DifferentBody.cs | 2 - .../src/Generated/SameBody.cs | 2 - .../src/Generated/JsonMergePatchClient.cs | 8 ++-- .../src/Generated/MediaTypeClient.cs | 8 ++-- .../media-type/src/Generated/StringBody.cs | 3 -- .../multipart/src/Generated/FormData.cs | 3 -- .../multipart/src/Generated/FormDataFile.cs | 3 -- .../src/Generated/FormDataHttpParts.cs | 3 -- .../Generated/FormDataHttpPartsContentType.cs | 3 -- .../Generated/FormDataHttpPartsNonString.cs | 3 -- .../src/Generated/MultiPartClient.cs | 8 ++-- .../pageable/src/Generated/PageSize.cs | 3 -- .../pageable/src/Generated/PageableClient.cs | 8 ++-- .../src/Generated/ServerDrivenPagination.cs | 3 -- ...ServerDrivenPaginationContinuationToken.cs | 3 -- .../pageable/src/Generated/XmlPagination.cs | 3 -- .../Generated/ModelWithArrayOfModelValue.cs | 3 -- .../src/Generated/ModelWithAttributesValue.cs | 3 -- .../src/Generated/ModelWithDictionaryValue.cs | 3 -- .../src/Generated/ModelWithEmptyArrayValue.cs | 3 -- .../Generated/ModelWithEncodedNamesValue.cs | 3 -- .../Generated/ModelWithOptionalFieldValue.cs | 3 -- .../Generated/ModelWithRenamedArraysValue.cs | 3 -- .../Generated/ModelWithRenamedFieldsValue.cs | 3 -- .../Generated/ModelWithSimpleArraysValue.cs | 3 -- .../xml/src/Generated/ModelWithTextValue.cs | 3 -- .../Generated/ModelWithUnwrappedArrayValue.cs | 3 -- .../xml/src/Generated/SimpleModelValue.cs | 3 -- .../payload/xml/src/Generated/XmlClient.cs | 8 ++-- .../xml/src/Generated/XmlErrorValue.cs | 3 -- .../ResiliencyServiceDrivenClient.cs | 8 ++-- .../ResiliencyServiceDrivenClient.cs | 8 ++-- .../src/Generated/StatusCodeRangeClient.cs | 8 ++-- .../http/routes/src/Generated/InInterface.cs | 3 -- .../routes/src/Generated/PathParameters.cs | 3 -- .../Generated/PathParametersLabelExpansion.cs | 3 -- .../PathParametersLabelExpansionExplode.cs | 3 -- .../PathParametersLabelExpansionStandard.cs | 3 -- .../PathParametersMatrixExpansion.cs | 3 -- .../PathParametersMatrixExpansionExplode.cs | 3 -- .../PathParametersMatrixExpansionStandard.cs | 3 -- .../Generated/PathParametersPathExpansion.cs | 3 -- .../PathParametersPathExpansionExplode.cs | 3 -- .../PathParametersPathExpansionStandard.cs | 3 -- .../PathParametersReservedExpansion.cs | 3 -- .../PathParametersSimpleExpansion.cs | 3 -- .../PathParametersSimpleExpansionExplode.cs | 3 -- .../PathParametersSimpleExpansionStandard.cs | 3 -- .../routes/src/Generated/QueryParameters.cs | 3 -- .../QueryParametersQueryContinuation.cs | 3 -- ...QueryParametersQueryContinuationExplode.cs | 3 -- ...ueryParametersQueryContinuationStandard.cs | 3 -- .../QueryParametersQueryExpansion.cs | 3 -- .../QueryParametersQueryExpansionExplode.cs | 3 -- .../QueryParametersQueryExpansionStandard.cs | 3 -- .../http/routes/src/Generated/RoutesClient.cs | 8 ++-- .../json/src/Generated/JsonClient.cs | 8 ++-- .../json/src/Generated/Property.cs | 3 -- .../src/Generated/NotDefinedClient.cs | 8 ++-- .../multiple/src/Generated/MultipleClient.cs | 8 ++-- .../path/single/src/Generated/SingleClient.cs | 8 ++-- .../src/Generated/NotVersionedClient.cs | 8 ++-- .../src/Generated/VersionedClient.cs | 8 ++-- .../src/Generated/ConditionalRequestClient.cs | 8 ++-- .../src/Generated/RepeatabilityClient.cs | 8 ++-- .../src/Generated/ModelProperties.cs | 3 -- .../special-words/src/Generated/Models.cs | 3 -- .../special-words/src/Generated/Operations.cs | 3 -- .../special-words/src/Generated/Parameters.cs | 3 -- .../src/Generated/SpecialWordsClient.cs | 8 ++-- .../type/array/src/Generated/ArrayClient.cs | 8 ++-- .../type/array/src/Generated/BooleanValue.cs | 3 -- .../type/array/src/Generated/DatetimeValue.cs | 2 - .../type/array/src/Generated/DurationValue.cs | 2 - .../type/array/src/Generated/Float32Value.cs | 3 -- .../type/array/src/Generated/Int32Value.cs | 3 -- .../type/array/src/Generated/Int64Value.cs | 3 -- .../type/array/src/Generated/ModelValue.cs | 3 -- .../src/Generated/NullableBooleanValue.cs | 3 -- .../array/src/Generated/NullableFloatValue.cs | 3 -- .../array/src/Generated/NullableInt32Value.cs | 3 -- .../array/src/Generated/NullableModelValue.cs | 3 -- .../src/Generated/NullableStringValue.cs | 3 -- .../type/array/src/Generated/StringValue.cs | 3 -- .../type/array/src/Generated/UnknownValue.cs | 2 - .../dictionary/src/Generated/BooleanValue.cs | 3 -- .../dictionary/src/Generated/DatetimeValue.cs | 2 - .../src/Generated/DictionaryClient.cs | 8 ++-- .../dictionary/src/Generated/DurationValue.cs | 2 - .../dictionary/src/Generated/Float32Value.cs | 3 -- .../dictionary/src/Generated/Int32Value.cs | 3 -- .../dictionary/src/Generated/Int64Value.cs | 3 -- .../dictionary/src/Generated/ModelValue.cs | 3 -- .../src/Generated/NullableFloatValue.cs | 3 -- .../src/Generated/RecursiveModelValue.cs | 3 -- .../dictionary/src/Generated/StringValue.cs | 3 -- .../dictionary/src/Generated/UnknownValue.cs | 2 - .../src/Generated/ExtensibleClient.cs | 8 ++-- .../enum/extensible/src/Generated/String.cs | 3 -- .../enum/fixed/src/Generated/FixedClient.cs | 8 ++-- .../type/enum/fixed/src/Generated/String.cs | 3 -- .../model/empty/src/Generated/EmptyClient.cs | 8 ++-- .../src/Generated/EnumDiscriminatorClient.cs | 8 ++-- .../Generated/NestedDiscriminatorClient.cs | 8 ++-- .../src/Generated/NotDiscriminatedClient.cs | 8 ++-- .../src/Generated/RecursiveClient.cs | 8 ++-- .../Generated/SingleDiscriminatorClient.cs | 8 ++-- .../model/usage/src/Generated/UsageClient.cs | 8 ++-- .../src/Generated/VisibilityClient.cs | 8 ++-- .../Generated/AdditionalPropertiesClient.cs | 8 ++-- .../Generated/ExtendsDifferentSpreadFloat.cs | 3 -- .../Generated/ExtendsDifferentSpreadModel.cs | 3 -- .../ExtendsDifferentSpreadModelArray.cs | 3 -- .../Generated/ExtendsDifferentSpreadString.cs | 3 -- .../src/Generated/ExtendsFloat.cs | 3 -- .../src/Generated/ExtendsModel.cs | 3 -- .../src/Generated/ExtendsModelArray.cs | 3 -- .../src/Generated/ExtendsString.cs | 3 -- .../src/Generated/ExtendsUnknown.cs | 3 -- .../src/Generated/ExtendsUnknownDerived.cs | 3 -- .../Generated/ExtendsUnknownDiscriminated.cs | 3 -- .../src/Generated/IsFloat.cs | 3 -- .../src/Generated/IsModel.cs | 3 -- .../src/Generated/IsModelArray.cs | 3 -- .../src/Generated/IsString.cs | 3 -- .../src/Generated/IsUnknown.cs | 3 -- .../src/Generated/IsUnknownDerived.cs | 3 -- .../src/Generated/IsUnknownDiscriminated.cs | 3 -- .../src/Generated/MultipleSpread.cs | 3 -- .../src/Generated/SpreadDifferentFloat.cs | 3 -- .../src/Generated/SpreadDifferentModel.cs | 3 -- .../Generated/SpreadDifferentModelArray.cs | 3 -- .../src/Generated/SpreadDifferentString.cs | 3 -- .../src/Generated/SpreadFloat.cs | 3 -- .../src/Generated/SpreadModel.cs | 3 -- .../src/Generated/SpreadModelArray.cs | 3 -- .../SpreadRecordNonDiscriminatedUnion.cs | 3 -- .../SpreadRecordNonDiscriminatedUnion2.cs | 3 -- .../SpreadRecordNonDiscriminatedUnion3.cs | 3 -- .../src/Generated/SpreadRecordUnion.cs | 3 -- .../src/Generated/SpreadString.cs | 3 -- .../property/nullable/src/Generated/Bytes.cs | 3 -- .../nullable/src/Generated/CollectionsByte.cs | 3 -- .../src/Generated/CollectionsModel.cs | 3 -- .../src/Generated/CollectionsString.cs | 3 -- .../nullable/src/Generated/Datetime.cs | 3 -- .../nullable/src/Generated/Duration.cs | 3 -- .../nullable/src/Generated/NullableClient.cs | 8 ++-- .../property/nullable/src/Generated/String.cs | 3 -- .../src/Generated/BooleanLiteral.cs | 3 -- .../optionality/src/Generated/Bytes.cs | 3 -- .../src/Generated/CollectionsByte.cs | 3 -- .../src/Generated/CollectionsModel.cs | 3 -- .../optionality/src/Generated/Datetime.cs | 3 -- .../optionality/src/Generated/Duration.cs | 3 -- .../optionality/src/Generated/FloatLiteral.cs | 3 -- .../optionality/src/Generated/IntLiteral.cs | 3 -- .../src/Generated/OptionalClient.cs | 8 ++-- .../optionality/src/Generated/PlainDate.cs | 3 -- .../optionality/src/Generated/PlainTime.cs | 3 -- .../src/Generated/RequiredAndOptional.cs | 3 -- .../optionality/src/Generated/String.cs | 3 -- .../src/Generated/StringLiteral.cs | 3 -- .../src/Generated/UnionFloatLiteral.cs | 3 -- .../src/Generated/UnionIntLiteral.cs | 3 -- .../src/Generated/UnionStringLiteral.cs | 3 -- .../value-types/src/Generated/Boolean.cs | 3 -- .../src/Generated/BooleanLiteral.cs | 3 -- .../value-types/src/Generated/Bytes.cs | 3 -- .../src/Generated/CollectionsInt.cs | 3 -- .../src/Generated/CollectionsModel.cs | 3 -- .../src/Generated/CollectionsString.cs | 3 -- .../value-types/src/Generated/Datetime.cs | 3 -- .../value-types/src/Generated/Decimal.cs | 3 -- .../value-types/src/Generated/Decimal128.cs | 3 -- .../src/Generated/DictionaryString.cs | 3 -- .../value-types/src/Generated/Duration.cs | 3 -- .../value-types/src/Generated/Enum.cs | 3 -- .../src/Generated/ExtensibleEnum.cs | 3 -- .../value-types/src/Generated/Float.cs | 3 -- .../value-types/src/Generated/FloatLiteral.cs | 3 -- .../property/value-types/src/Generated/Int.cs | 3 -- .../value-types/src/Generated/IntLiteral.cs | 3 -- .../value-types/src/Generated/Model.cs | 3 -- .../value-types/src/Generated/Never.cs | 3 -- .../value-types/src/Generated/String.cs | 3 -- .../src/Generated/StringLiteral.cs | 3 -- .../src/Generated/UnionEnumValue.cs | 3 -- .../src/Generated/UnionFloatLiteral.cs | 3 -- .../src/Generated/UnionIntLiteral.cs | 3 -- .../src/Generated/UnionStringLiteral.cs | 3 -- .../value-types/src/Generated/UnknownArray.cs | 3 -- .../value-types/src/Generated/UnknownDict.cs | 3 -- .../value-types/src/Generated/UnknownInt.cs | 3 -- .../src/Generated/UnknownString.cs | 3 -- .../src/Generated/ValueTypesClient.cs | 8 ++-- .../http/type/scalar/src/Generated/Boolean.cs | 3 -- .../scalar/src/Generated/Decimal128Type.cs | 3 -- .../scalar/src/Generated/Decimal128Verify.cs | 3 -- .../type/scalar/src/Generated/DecimalType.cs | 3 -- .../scalar/src/Generated/DecimalVerify.cs | 3 -- .../type/scalar/src/Generated/ScalarClient.cs | 8 ++-- .../http/type/scalar/src/Generated/String.cs | 3 -- .../http/type/scalar/src/Generated/Unknown.cs | 2 - .../type/union/src/Generated/EnumsOnly.cs | 3 -- .../type/union/src/Generated/FloatsOnly.cs | 3 -- .../http/type/union/src/Generated/IntsOnly.cs | 3 -- .../type/union/src/Generated/MixedLiterals.cs | 3 -- .../type/union/src/Generated/MixedTypes.cs | 3 -- .../type/union/src/Generated/ModelsOnly.cs | 2 - .../union/src/Generated/StringAndArray.cs | 3 -- .../union/src/Generated/StringExtensible.cs | 3 -- .../src/Generated/StringExtensibleNamed.cs | 3 -- .../type/union/src/Generated/StringsOnly.cs | 3 -- .../type/union/src/Generated/UnionClient.cs | 8 ++-- .../added/v1/src/Generated/AddedClient.cs | 8 ++-- .../added/v2/src/Generated/AddedClient.cs | 8 ++-- .../added/v2/src/Generated/InterfaceV2.cs | 3 -- .../v1/src/Generated/MadeOptionalClient.cs | 8 ++-- .../v2/src/Generated/MadeOptionalClient.cs | 8 ++-- .../removed/v1/src/Generated/InterfaceV1.cs | 3 -- .../removed/v1/src/Generated/RemovedClient.cs | 8 ++-- .../removed/v2/src/Generated/RemovedClient.cs | 8 ++-- .../v2Preview/src/Generated/InterfaceV1.cs | 3 -- .../v2Preview/src/Generated/RemovedClient.cs | 8 ++-- .../v1/src/Generated/OldInterface.cs | 3 -- .../v1/src/Generated/RenamedFromClient.cs | 8 ++-- .../v2/src/Generated/NewInterface.cs | 3 -- .../v2/src/Generated/RenamedFromClient.cs | 8 ++-- .../Generated/ReturnTypeChangedFromClient.cs | 8 ++-- .../Generated/ReturnTypeChangedFromClient.cs | 8 ++-- .../v1/src/Generated/TypeChangedFromClient.cs | 8 ++-- .../v2/src/Generated/TypeChangedFromClient.cs | 8 ++-- 294 files changed, 250 insertions(+), 1072 deletions(-) diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel.StubLibrary/src/StubLibraryVisitor.cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel.StubLibrary/src/StubLibraryVisitor.cs index a24a1b21c42..b440332c224 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel.StubLibrary/src/StubLibraryVisitor.cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel.StubLibrary/src/StubLibraryVisitor.cs @@ -3,7 +3,6 @@ using System; using System.ClientModel.Primitives; -using System.Linq; using Microsoft.TypeSpec.Generator.ClientModel.Providers; using Microsoft.TypeSpec.Generator.Expressions; using Microsoft.TypeSpec.Generator.Primitives; @@ -46,26 +45,36 @@ internal class StubLibraryVisitor : ScmLibraryVisitor if (!IsCallingBaseCtor(constructor) && !IsEffectivelyPublic(constructor.Signature.Modifiers) && !IsParameterlessInternalCtorOnMrwSerializationType(constructor) && - !IsInternalClientConstructor(constructor) && (constructor.EnclosingType is not ModelProvider model || model.DerivedModels.Count == 0)) return null; - constructor.Update( - bodyStatements: null, - bodyExpression: _throwNull, - xmlDocs: XmlDocProvider.Empty); + // Strip this() initializers from stubs — only base() initializers are preserved. + // The stub body is just `=> throw null!` so this() delegation is unnecessary. + if (constructor.Signature.Initializer is { IsBase: false }) + { + constructor.Update( + signature: new ConstructorSignature( + constructor.Signature.Type, + constructor.Signature.Description, + constructor.Signature.Modifiers, + constructor.Signature.Parameters, + constructor.Signature.Attributes, + initializer: null), + bodyStatements: null, + bodyExpression: _throwNull, + xmlDocs: XmlDocProvider.Empty); + } + else + { + constructor.Update( + bodyStatements: null, + bodyExpression: _throwNull, + xmlDocs: XmlDocProvider.Empty); + } return constructor; } - private static bool IsInternalClientConstructor(ConstructorProvider constructor) - { - if (!constructor.Signature.Modifiers.HasFlag(MethodSignatureModifiers.Internal)) - return false; - - return constructor.EnclosingType is ClientProvider; - } - private static bool IsParameterlessInternalCtorOnMrwSerializationType(ConstructorProvider constructor) { if (constructor.Signature.Parameters.Count != 0) @@ -87,13 +96,8 @@ private static bool IsCallingBaseCtor(ConstructorProvider constructor) protected override FieldProvider? VisitField(FieldProvider field) { // For ClientOptions, keep the non-public field as this currently represents the latest service version for a client. - // For ClientProvider, keep const and static fields as they are referenced by stub constructor initializers - // (e.g. AuthorizationHeader const used in this() API key ctor, _flows static used in this() OAuth2 ctor). return (field.Modifiers.HasFlag(FieldModifiers.Public) - || field.EnclosingType.BaseType?.Equals(typeof(ClientPipelineOptions)) == true - || (field.EnclosingType is ClientProvider - && (field.Modifiers.HasFlag(FieldModifiers.Const) - || field.Modifiers.HasFlag(FieldModifiers.Static)))) + || field.EnclosingType.BaseType?.Equals(typeof(ClientPipelineOptions)) == true) ? field : null; } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/authentication/api-key/src/Generated/ApiKeyClient.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/authentication/api-key/src/Generated/ApiKeyClient.cs index bb90d193964..16a22cda47c 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/authentication/api-key/src/Generated/ApiKeyClient.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/authentication/api-key/src/Generated/ApiKeyClient.cs @@ -13,20 +13,16 @@ namespace Authentication.ApiKey { public partial class ApiKeyClient { - private const string AuthorizationHeader = "x-ms-api-key"; - protected ApiKeyClient() => throw null; - public ApiKeyClient(ApiKeyCredential credential) : this(new Uri("http://localhost:3000"), credential, new ApiKeyClientOptions()) => throw null; - - public ApiKeyClient(ApiKeyCredential credential, ApiKeyClientOptions options) : this(new Uri("http://localhost:3000"), credential, options) => throw null; + public ApiKeyClient(ApiKeyCredential credential) => throw null; - internal ApiKeyClient(AuthenticationPolicy authenticationPolicy, Uri endpoint, ApiKeyClientOptions options) => throw null; + public ApiKeyClient(ApiKeyCredential credential, ApiKeyClientOptions options) => throw null; - public ApiKeyClient(Uri endpoint, ApiKeyCredential credential, ApiKeyClientOptions options) : this(ApiKeyAuthenticationPolicy.CreateHeaderApiKeyPolicy(credential, AuthorizationHeader), endpoint, options) => throw null; + public ApiKeyClient(Uri endpoint, ApiKeyCredential credential, ApiKeyClientOptions options) => throw null; [Experimental("SCME0002")] - public ApiKeyClient(ApiKeyClientSettings settings) : this(AuthenticationPolicy.Create(settings), settings?.Endpoint, settings?.Options) => throw null; + public ApiKeyClient(ApiKeyClientSettings settings) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/authentication/http/custom/src/Generated/CustomClient.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/authentication/http/custom/src/Generated/CustomClient.cs index 25ff19d43b1..f4afaefada7 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/authentication/http/custom/src/Generated/CustomClient.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/authentication/http/custom/src/Generated/CustomClient.cs @@ -13,21 +13,16 @@ namespace Authentication.Http.Custom { public partial class CustomClient { - private const string AuthorizationHeader = "Authorization"; - private const string AuthorizationApiKeyPrefix = "SharedAccessKey"; - protected CustomClient() => throw null; - public CustomClient(ApiKeyCredential credential) : this(new Uri("http://localhost:3000"), credential, new CustomClientOptions()) => throw null; - - public CustomClient(ApiKeyCredential credential, CustomClientOptions options) : this(new Uri("http://localhost:3000"), credential, options) => throw null; + public CustomClient(ApiKeyCredential credential) => throw null; - internal CustomClient(AuthenticationPolicy authenticationPolicy, Uri endpoint, CustomClientOptions options) => throw null; + public CustomClient(ApiKeyCredential credential, CustomClientOptions options) => throw null; - public CustomClient(Uri endpoint, ApiKeyCredential credential, CustomClientOptions options) : this(ApiKeyAuthenticationPolicy.CreateHeaderApiKeyPolicy(credential, AuthorizationHeader, AuthorizationApiKeyPrefix), endpoint, options) => throw null; + public CustomClient(Uri endpoint, ApiKeyCredential credential, CustomClientOptions options) => throw null; [Experimental("SCME0002")] - public CustomClient(CustomClientSettings settings) : this(AuthenticationPolicy.Create(settings), settings?.Endpoint, settings?.Options) => throw null; + public CustomClient(CustomClientSettings settings) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/authentication/oauth2/src/Generated/OAuth2Client.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/authentication/oauth2/src/Generated/OAuth2Client.cs index 0b34d500610..93db86e7cf5 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/authentication/oauth2/src/Generated/OAuth2Client.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/authentication/oauth2/src/Generated/OAuth2Client.cs @@ -5,7 +5,6 @@ using System; using System.ClientModel; using System.ClientModel.Primitives; -using System.Collections.Generic; using System.Diagnostics.CodeAnalysis; using System.Threading; using System.Threading.Tasks; @@ -14,28 +13,16 @@ namespace Authentication.OAuth2 { public partial class OAuth2Client { - /// The OAuth2 flows supported by the service. - private static readonly Dictionary[] _flows = new Dictionary[] - { - new Dictionary - { - { GetTokenOptions.ScopesPropertyName, new string[] { "https://security.microsoft.com/.default" } }, - { GetTokenOptions.AuthorizationUrlPropertyName, "https://login.microsoftonline.com/common/oauth2/authorize" } - } - }; - protected OAuth2Client() => throw null; - public OAuth2Client(AuthenticationTokenProvider tokenProvider) : this(new Uri("http://localhost:3000"), tokenProvider, new OAuth2ClientOptions()) => throw null; - - public OAuth2Client(AuthenticationTokenProvider tokenProvider, OAuth2ClientOptions options) : this(new Uri("http://localhost:3000"), tokenProvider, options) => throw null; + public OAuth2Client(AuthenticationTokenProvider tokenProvider) => throw null; - internal OAuth2Client(AuthenticationPolicy authenticationPolicy, Uri endpoint, OAuth2ClientOptions options) => throw null; + public OAuth2Client(AuthenticationTokenProvider tokenProvider, OAuth2ClientOptions options) => throw null; - public OAuth2Client(Uri endpoint, AuthenticationTokenProvider tokenProvider, OAuth2ClientOptions options) : this(new BearerTokenPolicy(tokenProvider, _flows), endpoint, options) => throw null; + public OAuth2Client(Uri endpoint, AuthenticationTokenProvider tokenProvider, OAuth2ClientOptions options) => throw null; [Experimental("SCME0002")] - public OAuth2Client(OAuth2ClientSettings settings) : this(AuthenticationPolicy.Create(settings), settings?.Endpoint, settings?.Options) => throw null; + public OAuth2Client(OAuth2ClientSettings settings) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/authentication/union/src/Generated/UnionClient.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/authentication/union/src/Generated/UnionClient.cs index cf14844ba08..dad80c4f39b 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/authentication/union/src/Generated/UnionClient.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/authentication/union/src/Generated/UnionClient.cs @@ -5,7 +5,6 @@ using System; using System.ClientModel; using System.ClientModel.Primitives; -using System.Collections.Generic; using System.Diagnostics.CodeAnalysis; using System.Threading; using System.Threading.Tasks; @@ -14,35 +13,22 @@ namespace Authentication.Union { public partial class UnionClient { - private const string AuthorizationHeader = "x-ms-api-key"; - /// The OAuth2 flows supported by the service. - private static readonly Dictionary[] _flows = new Dictionary[] - { - new Dictionary - { - { GetTokenOptions.ScopesPropertyName, new string[] { "https://security.microsoft.com/.default" } }, - { GetTokenOptions.AuthorizationUrlPropertyName, "https://login.microsoftonline.com/common/oauth2/authorize" } - } - }; - protected UnionClient() => throw null; - public UnionClient(ApiKeyCredential credential) : this(new Uri("http://localhost:3000"), credential, new UnionClientOptions()) => throw null; - - public UnionClient(ApiKeyCredential credential, UnionClientOptions options) : this(new Uri("http://localhost:3000"), credential, options) => throw null; + public UnionClient(ApiKeyCredential credential) => throw null; - public UnionClient(AuthenticationTokenProvider tokenProvider) : this(new Uri("http://localhost:3000"), tokenProvider, new UnionClientOptions()) => throw null; + public UnionClient(ApiKeyCredential credential, UnionClientOptions options) => throw null; - public UnionClient(AuthenticationTokenProvider tokenProvider, UnionClientOptions options) : this(new Uri("http://localhost:3000"), tokenProvider, options) => throw null; + public UnionClient(AuthenticationTokenProvider tokenProvider) => throw null; - internal UnionClient(AuthenticationPolicy authenticationPolicy, Uri endpoint, UnionClientOptions options) => throw null; + public UnionClient(AuthenticationTokenProvider tokenProvider, UnionClientOptions options) => throw null; - public UnionClient(Uri endpoint, ApiKeyCredential credential, UnionClientOptions options) : this(ApiKeyAuthenticationPolicy.CreateHeaderApiKeyPolicy(credential, AuthorizationHeader), endpoint, options) => throw null; + public UnionClient(Uri endpoint, ApiKeyCredential credential, UnionClientOptions options) => throw null; - public UnionClient(Uri endpoint, AuthenticationTokenProvider tokenProvider, UnionClientOptions options) : this(new BearerTokenPolicy(tokenProvider, _flows), endpoint, options) => throw null; + public UnionClient(Uri endpoint, AuthenticationTokenProvider tokenProvider, UnionClientOptions options) => throw null; [Experimental("SCME0002")] - public UnionClient(UnionClientSettings settings) : this(AuthenticationPolicy.Create(settings), settings?.Endpoint, settings?.Options) => throw null; + public UnionClient(UnionClientSettings settings) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/client-operation-group/src/Generated/FirstClient.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/client-operation-group/src/Generated/FirstClient.cs index 0ae16d068ff..e8843114291 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/client-operation-group/src/Generated/FirstClient.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/client-operation-group/src/Generated/FirstClient.cs @@ -16,14 +16,12 @@ public partial class FirstClient { protected FirstClient() => throw null; - public FirstClient(Uri endpoint, ClientType client) : this(endpoint, client, new FirstClientOptions()) => throw null; + public FirstClient(Uri endpoint, ClientType client) => throw null; - internal FirstClient(AuthenticationPolicy authenticationPolicy, Uri endpoint, ClientType client, FirstClientOptions options) => throw null; - - public FirstClient(Uri endpoint, ClientType client, FirstClientOptions options) : this(null, endpoint, client, options) => throw null; + public FirstClient(Uri endpoint, ClientType client, FirstClientOptions options) => throw null; [Experimental("SCME0002")] - public FirstClient(FirstClientSettings settings) : this(AuthenticationPolicy.Create(settings), settings?.Endpoint, settings?.Client ?? default, settings?.Options) => throw null; + public FirstClient(FirstClientSettings settings) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/client-operation-group/src/Generated/Group3.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/client-operation-group/src/Generated/Group3.cs index 424b1f729bd..36f592b901d 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/client-operation-group/src/Generated/Group3.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/client-operation-group/src/Generated/Group3.cs @@ -2,12 +2,10 @@ #nullable disable -using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; using System.Threading.Tasks; -using Client.Structure.Service; namespace Client.Structure.ClientOperationGroup { @@ -15,8 +13,6 @@ public partial class Group3 { protected Group3() => throw null; - internal Group3(ClientPipeline pipeline, Uri endpoint, ClientType client) => throw null; - public ClientPipeline Pipeline => throw null; public virtual ClientResult Two(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/client-operation-group/src/Generated/Group4.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/client-operation-group/src/Generated/Group4.cs index 6f372e14c53..5470b3bbc52 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/client-operation-group/src/Generated/Group4.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/client-operation-group/src/Generated/Group4.cs @@ -2,12 +2,10 @@ #nullable disable -using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; using System.Threading.Tasks; -using Client.Structure.Service; namespace Client.Structure.ClientOperationGroup { @@ -15,8 +13,6 @@ public partial class Group4 { protected Group4() => throw null; - internal Group4(ClientPipeline pipeline, Uri endpoint, ClientType client) => throw null; - public ClientPipeline Pipeline => throw null; public virtual ClientResult Four(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/client-operation-group/src/Generated/Group5.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/client-operation-group/src/Generated/Group5.cs index 16a035048f3..eb10cff56a7 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/client-operation-group/src/Generated/Group5.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/client-operation-group/src/Generated/Group5.cs @@ -2,12 +2,10 @@ #nullable disable -using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; using System.Threading.Tasks; -using Client.Structure.Service; namespace Client.Structure.AnotherClientOperationGroup { @@ -15,8 +13,6 @@ public partial class Group5 { protected Group5() => throw null; - internal Group5(ClientPipeline pipeline, Uri endpoint, ClientType client) => throw null; - public ClientPipeline Pipeline => throw null; public virtual ClientResult Six(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/client-operation-group/src/Generated/SubNamespaceSecondClient.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/client-operation-group/src/Generated/SubNamespaceSecondClient.cs index 693eca9df30..008771e23e5 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/client-operation-group/src/Generated/SubNamespaceSecondClient.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/client-operation-group/src/Generated/SubNamespaceSecondClient.cs @@ -16,14 +16,12 @@ public partial class SubNamespaceSecondClient { protected SubNamespaceSecondClient() => throw null; - public SubNamespaceSecondClient(Uri endpoint, ClientType client) : this(endpoint, client, new SubNamespaceSecondClientOptions()) => throw null; + public SubNamespaceSecondClient(Uri endpoint, ClientType client) => throw null; - internal SubNamespaceSecondClient(AuthenticationPolicy authenticationPolicy, Uri endpoint, ClientType client, SubNamespaceSecondClientOptions options) => throw null; - - public SubNamespaceSecondClient(Uri endpoint, ClientType client, SubNamespaceSecondClientOptions options) : this(null, endpoint, client, options) => throw null; + public SubNamespaceSecondClient(Uri endpoint, ClientType client, SubNamespaceSecondClientOptions options) => throw null; [Experimental("SCME0002")] - public SubNamespaceSecondClient(SubNamespaceSecondClientSettings settings) : this(AuthenticationPolicy.Create(settings), settings?.Endpoint, settings?.Client ?? default, settings?.Options) => throw null; + public SubNamespaceSecondClient(SubNamespaceSecondClientSettings settings) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/default/src/Generated/Bar.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/default/src/Generated/Bar.cs index ecb520de880..b477c997e2f 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/default/src/Generated/Bar.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/default/src/Generated/Bar.cs @@ -2,7 +2,6 @@ #nullable disable -using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -14,8 +13,6 @@ public partial class Bar { protected Bar() => throw null; - internal Bar(ClientPipeline pipeline, Uri endpoint, ClientType client) => throw null; - public ClientPipeline Pipeline => throw null; public virtual ClientResult Five(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/default/src/Generated/Baz.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/default/src/Generated/Baz.cs index 9846828d6a2..c13fd297ec5 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/default/src/Generated/Baz.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/default/src/Generated/Baz.cs @@ -2,9 +2,7 @@ #nullable disable -using System; using System.ClientModel.Primitives; -using Client.Structure.Service; namespace Client.Structure.Service._Baz { @@ -12,8 +10,6 @@ public partial class Baz { protected Baz() => throw null; - internal Baz(ClientPipeline pipeline, Uri endpoint, ClientType client) => throw null; - public ClientPipeline Pipeline => throw null; public virtual BazFoo GetBazFooClient() => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/default/src/Generated/BazFoo.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/default/src/Generated/BazFoo.cs index 4b8d81d5939..6ed62d51d4e 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/default/src/Generated/BazFoo.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/default/src/Generated/BazFoo.cs @@ -2,12 +2,10 @@ #nullable disable -using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; using System.Threading.Tasks; -using Client.Structure.Service; namespace Client.Structure.Service._Baz { @@ -15,8 +13,6 @@ public partial class BazFoo { protected BazFoo() => throw null; - internal BazFoo(ClientPipeline pipeline, Uri endpoint, ClientType client) => throw null; - public ClientPipeline Pipeline => throw null; public virtual ClientResult Seven(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/default/src/Generated/Foo.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/default/src/Generated/Foo.cs index 40c3caa537f..4989e29298c 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/default/src/Generated/Foo.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/default/src/Generated/Foo.cs @@ -2,7 +2,6 @@ #nullable disable -using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -14,8 +13,6 @@ public partial class Foo { protected Foo() => throw null; - internal Foo(ClientPipeline pipeline, Uri endpoint, ClientType client) => throw null; - public ClientPipeline Pipeline => throw null; public virtual ClientResult Three(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/default/src/Generated/Qux.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/default/src/Generated/Qux.cs index 886bf284df7..e94b919e17f 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/default/src/Generated/Qux.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/default/src/Generated/Qux.cs @@ -2,12 +2,10 @@ #nullable disable -using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; using System.Threading.Tasks; -using Client.Structure.Service; namespace Client.Structure.Service._Qux { @@ -15,8 +13,6 @@ public partial class Qux { protected Qux() => throw null; - internal Qux(ClientPipeline pipeline, Uri endpoint, ClientType client) => throw null; - public ClientPipeline Pipeline => throw null; public virtual ClientResult Eight(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/default/src/Generated/QuxBar.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/default/src/Generated/QuxBar.cs index 5b7bc794ae7..1cf32f91487 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/default/src/Generated/QuxBar.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/default/src/Generated/QuxBar.cs @@ -2,12 +2,10 @@ #nullable disable -using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; using System.Threading.Tasks; -using Client.Structure.Service; namespace Client.Structure.Service._Qux { @@ -15,8 +13,6 @@ public partial class QuxBar { protected QuxBar() => throw null; - internal QuxBar(ClientPipeline pipeline, Uri endpoint, ClientType client) => throw null; - public ClientPipeline Pipeline => throw null; public virtual ClientResult Nine(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/default/src/Generated/ServiceClient.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/default/src/Generated/ServiceClient.cs index 7dd25ed35c3..002f116b958 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/default/src/Generated/ServiceClient.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/default/src/Generated/ServiceClient.cs @@ -17,14 +17,12 @@ public partial class ServiceClient { protected ServiceClient() => throw null; - public ServiceClient(Uri endpoint, ClientType client) : this(endpoint, client, new ServiceClientOptions()) => throw null; + public ServiceClient(Uri endpoint, ClientType client) => throw null; - internal ServiceClient(AuthenticationPolicy authenticationPolicy, Uri endpoint, ClientType client, ServiceClientOptions options) => throw null; - - public ServiceClient(Uri endpoint, ClientType client, ServiceClientOptions options) : this(null, endpoint, client, options) => throw null; + public ServiceClient(Uri endpoint, ClientType client, ServiceClientOptions options) => throw null; [Experimental("SCME0002")] - public ServiceClient(ServiceClientSettings settings) : this(AuthenticationPolicy.Create(settings), settings?.Endpoint, settings?.Client ?? default, settings?.Options) => throw null; + public ServiceClient(ServiceClientSettings settings) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/multi-client/src/Generated/ClientAClient.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/multi-client/src/Generated/ClientAClient.cs index 8c586cc178c..ad8883a48e0 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/multi-client/src/Generated/ClientAClient.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/multi-client/src/Generated/ClientAClient.cs @@ -16,14 +16,12 @@ public partial class ClientAClient { protected ClientAClient() => throw null; - public ClientAClient(Uri endpoint, ClientType client) : this(endpoint, client, new ClientAClientOptions()) => throw null; + public ClientAClient(Uri endpoint, ClientType client) => throw null; - internal ClientAClient(AuthenticationPolicy authenticationPolicy, Uri endpoint, ClientType client, ClientAClientOptions options) => throw null; - - public ClientAClient(Uri endpoint, ClientType client, ClientAClientOptions options) : this(null, endpoint, client, options) => throw null; + public ClientAClient(Uri endpoint, ClientType client, ClientAClientOptions options) => throw null; [Experimental("SCME0002")] - public ClientAClient(ClientAClientSettings settings) : this(AuthenticationPolicy.Create(settings), settings?.Endpoint, settings?.Client ?? default, settings?.Options) => throw null; + public ClientAClient(ClientAClientSettings settings) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/multi-client/src/Generated/ClientBClient.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/multi-client/src/Generated/ClientBClient.cs index 603a41b38b0..cea7a426dbd 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/multi-client/src/Generated/ClientBClient.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/multi-client/src/Generated/ClientBClient.cs @@ -16,14 +16,12 @@ public partial class ClientBClient { protected ClientBClient() => throw null; - public ClientBClient(Uri endpoint, ClientType client) : this(endpoint, client, new ClientBClientOptions()) => throw null; + public ClientBClient(Uri endpoint, ClientType client) => throw null; - internal ClientBClient(AuthenticationPolicy authenticationPolicy, Uri endpoint, ClientType client, ClientBClientOptions options) => throw null; - - public ClientBClient(Uri endpoint, ClientType client, ClientBClientOptions options) : this(null, endpoint, client, options) => throw null; + public ClientBClient(Uri endpoint, ClientType client, ClientBClientOptions options) => throw null; [Experimental("SCME0002")] - public ClientBClient(ClientBClientSettings settings) : this(AuthenticationPolicy.Create(settings), settings?.Endpoint, settings?.Client ?? default, settings?.Options) => throw null; + public ClientBClient(ClientBClientSettings settings) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/renamed-operation/src/Generated/Group.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/renamed-operation/src/Generated/Group.cs index f9ce619bfe6..43d04d3edb0 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/renamed-operation/src/Generated/Group.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/renamed-operation/src/Generated/Group.cs @@ -2,12 +2,10 @@ #nullable disable -using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; using System.Threading.Tasks; -using Client.Structure.Service; namespace Client.Structure.RenamedOperation { @@ -15,8 +13,6 @@ public partial class Group { protected Group() => throw null; - internal Group(ClientPipeline pipeline, Uri endpoint, ClientType client) => throw null; - public ClientPipeline Pipeline => throw null; public virtual ClientResult RenamedTwo(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/renamed-operation/src/Generated/RenamedOperationClient.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/renamed-operation/src/Generated/RenamedOperationClient.cs index a3aa6ae6103..7c7ae48d485 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/renamed-operation/src/Generated/RenamedOperationClient.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/renamed-operation/src/Generated/RenamedOperationClient.cs @@ -16,14 +16,12 @@ public partial class RenamedOperationClient { protected RenamedOperationClient() => throw null; - public RenamedOperationClient(Uri endpoint, ClientType client) : this(endpoint, client, new RenamedOperationClientOptions()) => throw null; + public RenamedOperationClient(Uri endpoint, ClientType client) => throw null; - internal RenamedOperationClient(AuthenticationPolicy authenticationPolicy, Uri endpoint, ClientType client, RenamedOperationClientOptions options) => throw null; - - public RenamedOperationClient(Uri endpoint, ClientType client, RenamedOperationClientOptions options) : this(null, endpoint, client, options) => throw null; + public RenamedOperationClient(Uri endpoint, ClientType client, RenamedOperationClientOptions options) => throw null; [Experimental("SCME0002")] - public RenamedOperationClient(RenamedOperationClientSettings settings) : this(AuthenticationPolicy.Create(settings), settings?.Endpoint, settings?.Client ?? default, settings?.Options) => throw null; + public RenamedOperationClient(RenamedOperationClientSettings settings) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/two-operation-group/src/Generated/Group1.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/two-operation-group/src/Generated/Group1.cs index 292fd14c3c6..4657d169616 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/two-operation-group/src/Generated/Group1.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/two-operation-group/src/Generated/Group1.cs @@ -2,12 +2,10 @@ #nullable disable -using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; using System.Threading.Tasks; -using Client.Structure.Service; namespace Client.Structure.TwoOperationGroup { @@ -15,8 +13,6 @@ public partial class Group1 { protected Group1() => throw null; - internal Group1(ClientPipeline pipeline, Uri endpoint, ClientType client) => throw null; - public ClientPipeline Pipeline => throw null; public virtual ClientResult One(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/two-operation-group/src/Generated/Group2.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/two-operation-group/src/Generated/Group2.cs index 9b04ac2eba9..783310627ed 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/two-operation-group/src/Generated/Group2.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/two-operation-group/src/Generated/Group2.cs @@ -2,12 +2,10 @@ #nullable disable -using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; using System.Threading.Tasks; -using Client.Structure.Service; namespace Client.Structure.TwoOperationGroup { @@ -15,8 +13,6 @@ public partial class Group2 { protected Group2() => throw null; - internal Group2(ClientPipeline pipeline, Uri endpoint, ClientType client) => throw null; - public ClientPipeline Pipeline => throw null; public virtual ClientResult Two(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/two-operation-group/src/Generated/TwoOperationGroupClient.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/two-operation-group/src/Generated/TwoOperationGroupClient.cs index a5ae0dae401..026c4a176f1 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/two-operation-group/src/Generated/TwoOperationGroupClient.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/two-operation-group/src/Generated/TwoOperationGroupClient.cs @@ -13,14 +13,12 @@ public partial class TwoOperationGroupClient { protected TwoOperationGroupClient() => throw null; - public TwoOperationGroupClient(Uri endpoint, ClientType client) : this(endpoint, client, new TwoOperationGroupClientOptions()) => throw null; + public TwoOperationGroupClient(Uri endpoint, ClientType client) => throw null; - internal TwoOperationGroupClient(AuthenticationPolicy authenticationPolicy, Uri endpoint, ClientType client, TwoOperationGroupClientOptions options) => throw null; - - public TwoOperationGroupClient(Uri endpoint, ClientType client, TwoOperationGroupClientOptions options) : this(null, endpoint, client, options) => throw null; + public TwoOperationGroupClient(Uri endpoint, ClientType client, TwoOperationGroupClientOptions options) => throw null; [Experimental("SCME0002")] - public TwoOperationGroupClient(TwoOperationGroupClientSettings settings) : this(AuthenticationPolicy.Create(settings), settings?.Endpoint, settings?.Client ?? default, settings?.Options) => throw null; + public TwoOperationGroupClient(TwoOperationGroupClientSettings settings) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/documentation/src/Generated/DocumentationClient.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/documentation/src/Generated/DocumentationClient.cs index a666718a60c..ab3274eb4ba 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/documentation/src/Generated/DocumentationClient.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/documentation/src/Generated/DocumentationClient.cs @@ -12,14 +12,12 @@ namespace Documentation { public partial class DocumentationClient { - public DocumentationClient() : this(new Uri("http://localhost:3000"), new DocumentationClientOptions()) => throw null; + public DocumentationClient() => throw null; - internal DocumentationClient(AuthenticationPolicy authenticationPolicy, Uri endpoint, DocumentationClientOptions options) => throw null; - - public DocumentationClient(Uri endpoint, DocumentationClientOptions options) : this(null, endpoint, options) => throw null; + public DocumentationClient(Uri endpoint, DocumentationClientOptions options) => throw null; [Experimental("SCME0002")] - public DocumentationClient(DocumentationClientSettings settings) : this(AuthenticationPolicy.Create(settings), settings?.Endpoint, settings?.Options) => throw null; + public DocumentationClient(DocumentationClientSettings settings) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/documentation/src/Generated/Lists.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/documentation/src/Generated/Lists.cs index 448bdd8c7c6..34bf1c4e427 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/documentation/src/Generated/Lists.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/documentation/src/Generated/Lists.cs @@ -2,7 +2,6 @@ #nullable disable -using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -14,8 +13,6 @@ public partial class Lists { protected Lists() => throw null; - internal Lists(ClientPipeline pipeline, Uri endpoint) => throw null; - public ClientPipeline Pipeline => throw null; public virtual ClientResult BulletPointsOp(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/documentation/src/Generated/TextFormatting.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/documentation/src/Generated/TextFormatting.cs index d2190f98461..6fb8a1e8646 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/documentation/src/Generated/TextFormatting.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/documentation/src/Generated/TextFormatting.cs @@ -2,7 +2,6 @@ #nullable disable -using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -14,8 +13,6 @@ public partial class TextFormatting { protected TextFormatting() => throw null; - internal TextFormatting(ClientPipeline pipeline, Uri endpoint) => throw null; - public ClientPipeline Pipeline => throw null; public virtual ClientResult BoldText(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/array/src/Generated/ArrayClient.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/array/src/Generated/ArrayClient.cs index be13cf124dd..a00e84e8e78 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/array/src/Generated/ArrayClient.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/array/src/Generated/ArrayClient.cs @@ -11,14 +11,12 @@ namespace Encode._Array { public partial class ArrayClient { - public ArrayClient() : this(new Uri("http://localhost:3000"), new ArrayClientOptions()) => throw null; + public ArrayClient() => throw null; - internal ArrayClient(AuthenticationPolicy authenticationPolicy, Uri endpoint, ArrayClientOptions options) => throw null; - - public ArrayClient(Uri endpoint, ArrayClientOptions options) : this(null, endpoint, options) => throw null; + public ArrayClient(Uri endpoint, ArrayClientOptions options) => throw null; [Experimental("SCME0002")] - public ArrayClient(ArrayClientSettings settings) : this(AuthenticationPolicy.Create(settings), settings?.Endpoint, settings?.Options) => throw null; + public ArrayClient(ArrayClientSettings settings) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/array/src/Generated/Property.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/array/src/Generated/Property.cs index cca72b3496d..11ac1e8bde6 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/array/src/Generated/Property.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/array/src/Generated/Property.cs @@ -2,7 +2,6 @@ #nullable disable -using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -15,8 +14,6 @@ public partial class Property { protected Property() => throw null; - internal Property(ClientPipeline pipeline, Uri endpoint) => throw null; - public ClientPipeline Pipeline => throw null; public virtual ClientResult CommaDelimited(BinaryContent content, RequestOptions options = null) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/bytes/src/Generated/BytesClient.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/bytes/src/Generated/BytesClient.cs index 66889ea19e6..175395c97b7 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/bytes/src/Generated/BytesClient.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/bytes/src/Generated/BytesClient.cs @@ -15,14 +15,12 @@ namespace Encode.Bytes { public partial class BytesClient { - public BytesClient() : this(new Uri("http://localhost:3000"), new BytesClientOptions()) => throw null; + public BytesClient() => throw null; - internal BytesClient(AuthenticationPolicy authenticationPolicy, Uri endpoint, BytesClientOptions options) => throw null; - - public BytesClient(Uri endpoint, BytesClientOptions options) : this(null, endpoint, options) => throw null; + public BytesClient(Uri endpoint, BytesClientOptions options) => throw null; [Experimental("SCME0002")] - public BytesClient(BytesClientSettings settings) : this(AuthenticationPolicy.Create(settings), settings?.Endpoint, settings?.Options) => throw null; + public BytesClient(BytesClientSettings settings) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/bytes/src/Generated/Header.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/bytes/src/Generated/Header.cs index fd23134b48c..04f54e9db06 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/bytes/src/Generated/Header.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/bytes/src/Generated/Header.cs @@ -15,8 +15,6 @@ public partial class Header { protected Header() => throw null; - internal Header(ClientPipeline pipeline, Uri endpoint) => throw null; - public ClientPipeline Pipeline => throw null; public virtual ClientResult Default(BinaryData value, RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/bytes/src/Generated/Property.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/bytes/src/Generated/Property.cs index 98856cd5b6c..cd447f162f2 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/bytes/src/Generated/Property.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/bytes/src/Generated/Property.cs @@ -2,7 +2,6 @@ #nullable disable -using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -15,8 +14,6 @@ public partial class Property { protected Property() => throw null; - internal Property(ClientPipeline pipeline, Uri endpoint) => throw null; - public ClientPipeline Pipeline => throw null; public virtual ClientResult Default(BinaryContent content, RequestOptions options = null) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/bytes/src/Generated/Query.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/bytes/src/Generated/Query.cs index a4bdf915ccf..e833cb0b334 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/bytes/src/Generated/Query.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/bytes/src/Generated/Query.cs @@ -15,8 +15,6 @@ public partial class Query { protected Query() => throw null; - internal Query(ClientPipeline pipeline, Uri endpoint) => throw null; - public ClientPipeline Pipeline => throw null; public virtual ClientResult Default(BinaryData value, RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/bytes/src/Generated/RequestBody.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/bytes/src/Generated/RequestBody.cs index 11350490a12..8f2b981bd11 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/bytes/src/Generated/RequestBody.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/bytes/src/Generated/RequestBody.cs @@ -14,8 +14,6 @@ public partial class RequestBody { protected RequestBody() => throw null; - internal RequestBody(ClientPipeline pipeline, Uri endpoint) => throw null; - public ClientPipeline Pipeline => throw null; public virtual ClientResult Default(BinaryContent content, RequestOptions options = null) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/bytes/src/Generated/ResponseBody.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/bytes/src/Generated/ResponseBody.cs index 2ccbb28aadf..d61d52ae44f 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/bytes/src/Generated/ResponseBody.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/bytes/src/Generated/ResponseBody.cs @@ -14,8 +14,6 @@ public partial class ResponseBody { protected ResponseBody() => throw null; - internal ResponseBody(ClientPipeline pipeline, Uri endpoint) => throw null; - public ClientPipeline Pipeline => throw null; public virtual ClientResult Default(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/datetime/src/Generated/DatetimeClient.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/datetime/src/Generated/DatetimeClient.cs index 52989bc8104..0b9e20658cc 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/datetime/src/Generated/DatetimeClient.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/datetime/src/Generated/DatetimeClient.cs @@ -14,14 +14,12 @@ namespace Encode.Datetime { public partial class DatetimeClient { - public DatetimeClient() : this(new Uri("http://localhost:3000"), new DatetimeClientOptions()) => throw null; + public DatetimeClient() => throw null; - internal DatetimeClient(AuthenticationPolicy authenticationPolicy, Uri endpoint, DatetimeClientOptions options) => throw null; - - public DatetimeClient(Uri endpoint, DatetimeClientOptions options) : this(null, endpoint, options) => throw null; + public DatetimeClient(Uri endpoint, DatetimeClientOptions options) => throw null; [Experimental("SCME0002")] - public DatetimeClient(DatetimeClientSettings settings) : this(AuthenticationPolicy.Create(settings), settings?.Endpoint, settings?.Options) => throw null; + public DatetimeClient(DatetimeClientSettings settings) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/datetime/src/Generated/Header.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/datetime/src/Generated/Header.cs index 73e83a93a8d..5fb8d90bc90 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/datetime/src/Generated/Header.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/datetime/src/Generated/Header.cs @@ -15,8 +15,6 @@ public partial class Header { protected Header() => throw null; - internal Header(ClientPipeline pipeline, Uri endpoint) => throw null; - public ClientPipeline Pipeline => throw null; public virtual ClientResult Default(DateTimeOffset value, RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/datetime/src/Generated/Property.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/datetime/src/Generated/Property.cs index 178a86cf0b2..2a05e4eb487 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/datetime/src/Generated/Property.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/datetime/src/Generated/Property.cs @@ -2,7 +2,6 @@ #nullable disable -using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -15,8 +14,6 @@ public partial class Property { protected Property() => throw null; - internal Property(ClientPipeline pipeline, Uri endpoint) => throw null; - public ClientPipeline Pipeline => throw null; public virtual ClientResult Default(BinaryContent content, RequestOptions options = null) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/datetime/src/Generated/Query.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/datetime/src/Generated/Query.cs index 2e39c63316f..797db67529f 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/datetime/src/Generated/Query.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/datetime/src/Generated/Query.cs @@ -15,8 +15,6 @@ public partial class Query { protected Query() => throw null; - internal Query(ClientPipeline pipeline, Uri endpoint) => throw null; - public ClientPipeline Pipeline => throw null; public virtual ClientResult Default(DateTimeOffset value, RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/datetime/src/Generated/ResponseHeader.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/datetime/src/Generated/ResponseHeader.cs index 0f6c15d6f9e..01d39032c85 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/datetime/src/Generated/ResponseHeader.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/datetime/src/Generated/ResponseHeader.cs @@ -2,7 +2,6 @@ #nullable disable -using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -14,8 +13,6 @@ public partial class ResponseHeader { protected ResponseHeader() => throw null; - internal ResponseHeader(ClientPipeline pipeline, Uri endpoint) => throw null; - public ClientPipeline Pipeline => throw null; public virtual ClientResult Default(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/duration/src/Generated/DurationClient.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/duration/src/Generated/DurationClient.cs index efdd9208ab4..445f0e3aabb 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/duration/src/Generated/DurationClient.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/duration/src/Generated/DurationClient.cs @@ -13,14 +13,12 @@ namespace Encode.Duration { public partial class DurationClient { - public DurationClient() : this(new Uri("http://localhost:3000"), new DurationClientOptions()) => throw null; + public DurationClient() => throw null; - internal DurationClient(AuthenticationPolicy authenticationPolicy, Uri endpoint, DurationClientOptions options) => throw null; - - public DurationClient(Uri endpoint, DurationClientOptions options) : this(null, endpoint, options) => throw null; + public DurationClient(Uri endpoint, DurationClientOptions options) => throw null; [Experimental("SCME0002")] - public DurationClient(DurationClientSettings settings) : this(AuthenticationPolicy.Create(settings), settings?.Endpoint, settings?.Options) => throw null; + public DurationClient(DurationClientSettings settings) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/duration/src/Generated/Header.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/duration/src/Generated/Header.cs index 60aaa9d639d..f8b13ad6053 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/duration/src/Generated/Header.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/duration/src/Generated/Header.cs @@ -15,8 +15,6 @@ public partial class Header { protected Header() => throw null; - internal Header(ClientPipeline pipeline, Uri endpoint) => throw null; - public ClientPipeline Pipeline => throw null; public virtual ClientResult Default(TimeSpan duration, RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/duration/src/Generated/Property.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/duration/src/Generated/Property.cs index 5932c8916b1..68a98785695 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/duration/src/Generated/Property.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/duration/src/Generated/Property.cs @@ -2,7 +2,6 @@ #nullable disable -using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -14,8 +13,6 @@ public partial class Property { protected Property() => throw null; - internal Property(ClientPipeline pipeline, Uri endpoint) => throw null; - public ClientPipeline Pipeline => throw null; public virtual ClientResult Default(BinaryContent content, RequestOptions options = null) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/duration/src/Generated/Query.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/duration/src/Generated/Query.cs index 3389d4bc03c..ab8d0db30f9 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/duration/src/Generated/Query.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/duration/src/Generated/Query.cs @@ -15,8 +15,6 @@ public partial class Query { protected Query() => throw null; - internal Query(ClientPipeline pipeline, Uri endpoint) => throw null; - public ClientPipeline Pipeline => throw null; public virtual ClientResult Default(TimeSpan input, RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/numeric/src/Generated/NumericClient.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/numeric/src/Generated/NumericClient.cs index 62c37a7e84d..e4ada4e9e93 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/numeric/src/Generated/NumericClient.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/numeric/src/Generated/NumericClient.cs @@ -11,14 +11,12 @@ namespace Encode.Numeric { public partial class NumericClient { - public NumericClient() : this(new Uri("http://localhost:3000"), new NumericClientOptions()) => throw null; + public NumericClient() => throw null; - internal NumericClient(AuthenticationPolicy authenticationPolicy, Uri endpoint, NumericClientOptions options) => throw null; - - public NumericClient(Uri endpoint, NumericClientOptions options) : this(null, endpoint, options) => throw null; + public NumericClient(Uri endpoint, NumericClientOptions options) => throw null; [Experimental("SCME0002")] - public NumericClient(NumericClientSettings settings) : this(AuthenticationPolicy.Create(settings), settings?.Endpoint, settings?.Options) => throw null; + public NumericClient(NumericClientSettings settings) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/numeric/src/Generated/Property.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/numeric/src/Generated/Property.cs index a24512ae6df..49349a4add9 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/numeric/src/Generated/Property.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/numeric/src/Generated/Property.cs @@ -2,7 +2,6 @@ #nullable disable -using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -14,8 +13,6 @@ public partial class Property { protected Property() => throw null; - internal Property(ClientPipeline pipeline, Uri endpoint) => throw null; - public ClientPipeline Pipeline => throw null; public virtual ClientResult SafeintAsString(BinaryContent content, RequestOptions options = null) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/basic/src/Generated/BasicClient.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/basic/src/Generated/BasicClient.cs index 14502febffd..05b19fd618c 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/basic/src/Generated/BasicClient.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/basic/src/Generated/BasicClient.cs @@ -12,14 +12,12 @@ namespace Parameters.Basic { public partial class BasicClient { - public BasicClient() : this(new Uri("http://localhost:3000"), new BasicClientOptions()) => throw null; + public BasicClient() => throw null; - internal BasicClient(AuthenticationPolicy authenticationPolicy, Uri endpoint, BasicClientOptions options) => throw null; - - public BasicClient(Uri endpoint, BasicClientOptions options) : this(null, endpoint, options) => throw null; + public BasicClient(Uri endpoint, BasicClientOptions options) => throw null; [Experimental("SCME0002")] - public BasicClient(BasicClientSettings settings) : this(AuthenticationPolicy.Create(settings), settings?.Endpoint, settings?.Options) => throw null; + public BasicClient(BasicClientSettings settings) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/basic/src/Generated/ExplicitBody.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/basic/src/Generated/ExplicitBody.cs index d9157b03926..383030dc1bf 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/basic/src/Generated/ExplicitBody.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/basic/src/Generated/ExplicitBody.cs @@ -2,7 +2,6 @@ #nullable disable -using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -14,8 +13,6 @@ public partial class ExplicitBody { protected ExplicitBody() => throw null; - internal ExplicitBody(ClientPipeline pipeline, Uri endpoint) => throw null; - public ClientPipeline Pipeline => throw null; public virtual ClientResult Simple(BinaryContent content, RequestOptions options = null) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/basic/src/Generated/ImplicitBody.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/basic/src/Generated/ImplicitBody.cs index 8d46cf80d63..478ec3b4e2e 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/basic/src/Generated/ImplicitBody.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/basic/src/Generated/ImplicitBody.cs @@ -2,7 +2,6 @@ #nullable disable -using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -14,8 +13,6 @@ public partial class ImplicitBody { protected ImplicitBody() => throw null; - internal ImplicitBody(ClientPipeline pipeline, Uri endpoint) => throw null; - public ClientPipeline Pipeline => throw null; public virtual ClientResult Simple(BinaryContent content, RequestOptions options = null) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/body-optionality/src/Generated/BodyOptionalityClient.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/body-optionality/src/Generated/BodyOptionalityClient.cs index 457b49eac2f..6e4e705df6a 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/body-optionality/src/Generated/BodyOptionalityClient.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/body-optionality/src/Generated/BodyOptionalityClient.cs @@ -14,14 +14,12 @@ namespace Parameters.BodyOptionality { public partial class BodyOptionalityClient { - public BodyOptionalityClient() : this(new Uri("http://localhost:3000"), new BodyOptionalityClientOptions()) => throw null; + public BodyOptionalityClient() => throw null; - internal BodyOptionalityClient(AuthenticationPolicy authenticationPolicy, Uri endpoint, BodyOptionalityClientOptions options) => throw null; - - public BodyOptionalityClient(Uri endpoint, BodyOptionalityClientOptions options) : this(null, endpoint, options) => throw null; + public BodyOptionalityClient(Uri endpoint, BodyOptionalityClientOptions options) => throw null; [Experimental("SCME0002")] - public BodyOptionalityClient(BodyOptionalityClientSettings settings) : this(AuthenticationPolicy.Create(settings), settings?.Endpoint, settings?.Options) => throw null; + public BodyOptionalityClient(BodyOptionalityClientSettings settings) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/body-optionality/src/Generated/OptionalExplicit.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/body-optionality/src/Generated/OptionalExplicit.cs index 5d4de240634..ffa4809571b 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/body-optionality/src/Generated/OptionalExplicit.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/body-optionality/src/Generated/OptionalExplicit.cs @@ -2,7 +2,6 @@ #nullable disable -using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -15,8 +14,6 @@ public partial class OptionalExplicit { protected OptionalExplicit() => throw null; - internal OptionalExplicit(ClientPipeline pipeline, Uri endpoint) => throw null; - public ClientPipeline Pipeline => throw null; public virtual ClientResult Set(BinaryContent content, RequestOptions options = null) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/collection-format/src/Generated/CollectionFormatClient.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/collection-format/src/Generated/CollectionFormatClient.cs index cfac396e5f9..ecbb80dad60 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/collection-format/src/Generated/CollectionFormatClient.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/collection-format/src/Generated/CollectionFormatClient.cs @@ -12,14 +12,12 @@ namespace Parameters.CollectionFormat { public partial class CollectionFormatClient { - public CollectionFormatClient() : this(new Uri("http://localhost:3000"), new CollectionFormatClientOptions()) => throw null; + public CollectionFormatClient() => throw null; - internal CollectionFormatClient(AuthenticationPolicy authenticationPolicy, Uri endpoint, CollectionFormatClientOptions options) => throw null; - - public CollectionFormatClient(Uri endpoint, CollectionFormatClientOptions options) : this(null, endpoint, options) => throw null; + public CollectionFormatClient(Uri endpoint, CollectionFormatClientOptions options) => throw null; [Experimental("SCME0002")] - public CollectionFormatClient(CollectionFormatClientSettings settings) : this(AuthenticationPolicy.Create(settings), settings?.Endpoint, settings?.Options) => throw null; + public CollectionFormatClient(CollectionFormatClientSettings settings) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/collection-format/src/Generated/Header.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/collection-format/src/Generated/Header.cs index e29a1876bcd..6188a2785ea 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/collection-format/src/Generated/Header.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/collection-format/src/Generated/Header.cs @@ -2,7 +2,6 @@ #nullable disable -using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Collections.Generic; @@ -15,8 +14,6 @@ public partial class Header { protected Header() => throw null; - internal Header(ClientPipeline pipeline, Uri endpoint) => throw null; - public ClientPipeline Pipeline => throw null; public virtual ClientResult Csv(IEnumerable colors, RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/collection-format/src/Generated/Query.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/collection-format/src/Generated/Query.cs index f0d37525882..c54d95436b6 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/collection-format/src/Generated/Query.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/collection-format/src/Generated/Query.cs @@ -2,7 +2,6 @@ #nullable disable -using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Collections.Generic; @@ -15,8 +14,6 @@ public partial class Query { protected Query() => throw null; - internal Query(ClientPipeline pipeline, Uri endpoint) => throw null; - public ClientPipeline Pipeline => throw null; public virtual ClientResult Multi(IEnumerable colors, RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/path/src/Generated/PathClient.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/path/src/Generated/PathClient.cs index d0563f49bda..11094da54ed 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/path/src/Generated/PathClient.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/path/src/Generated/PathClient.cs @@ -13,14 +13,12 @@ namespace Parameters.Path { public partial class PathClient { - public PathClient() : this(new Uri("http://localhost:3000"), new PathClientOptions()) => throw null; + public PathClient() => throw null; - internal PathClient(AuthenticationPolicy authenticationPolicy, Uri endpoint, PathClientOptions options) => throw null; - - public PathClient(Uri endpoint, PathClientOptions options) : this(null, endpoint, options) => throw null; + public PathClient(Uri endpoint, PathClientOptions options) => throw null; [Experimental("SCME0002")] - public PathClient(PathClientSettings settings) : this(AuthenticationPolicy.Create(settings), settings?.Endpoint, settings?.Options) => throw null; + public PathClient(PathClientSettings settings) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/query/src/Generated/Constant.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/query/src/Generated/Constant.cs index 3545cccf023..b1be965f2d8 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/query/src/Generated/Constant.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/query/src/Generated/Constant.cs @@ -2,7 +2,6 @@ #nullable disable -using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -14,8 +13,6 @@ public partial class Constant { protected Constant() => throw null; - internal Constant(ClientPipeline pipeline, Uri endpoint) => throw null; - public ClientPipeline Pipeline => throw null; public virtual ClientResult Post(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/query/src/Generated/QueryClient.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/query/src/Generated/QueryClient.cs index 6a4be8cbeed..e9a23f5c534 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/query/src/Generated/QueryClient.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/query/src/Generated/QueryClient.cs @@ -10,14 +10,12 @@ namespace Parameters.Query { public partial class QueryClient { - public QueryClient() : this(new Uri("http://localhost:3000"), new QueryClientOptions()) => throw null; + public QueryClient() => throw null; - internal QueryClient(AuthenticationPolicy authenticationPolicy, Uri endpoint, QueryClientOptions options) => throw null; - - public QueryClient(Uri endpoint, QueryClientOptions options) : this(null, endpoint, options) => throw null; + public QueryClient(Uri endpoint, QueryClientOptions options) => throw null; [Experimental("SCME0002")] - public QueryClient(QueryClientSettings settings) : this(AuthenticationPolicy.Create(settings), settings?.Endpoint, settings?.Options) => throw null; + public QueryClient(QueryClientSettings settings) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/spread/src/Generated/Alias.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/spread/src/Generated/Alias.cs index 201900b0bc1..ec8be6a9570 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/spread/src/Generated/Alias.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/spread/src/Generated/Alias.cs @@ -2,7 +2,6 @@ #nullable disable -using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Collections.Generic; @@ -15,8 +14,6 @@ public partial class Alias { protected Alias() => throw null; - internal Alias(ClientPipeline pipeline, Uri endpoint) => throw null; - public ClientPipeline Pipeline => throw null; public virtual ClientResult SpreadAsRequestBody(BinaryContent content, RequestOptions options = null) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/spread/src/Generated/Model.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/spread/src/Generated/Model.cs index 792e9511624..31ca1bfeab4 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/spread/src/Generated/Model.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/spread/src/Generated/Model.cs @@ -2,7 +2,6 @@ #nullable disable -using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -14,8 +13,6 @@ public partial class Model { protected Model() => throw null; - internal Model(ClientPipeline pipeline, Uri endpoint) => throw null; - public ClientPipeline Pipeline => throw null; public virtual ClientResult SpreadAsRequestBody(BinaryContent content, RequestOptions options = null) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/spread/src/Generated/SpreadClient.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/spread/src/Generated/SpreadClient.cs index 5367a1359ab..c5a95ad9cc7 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/spread/src/Generated/SpreadClient.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/spread/src/Generated/SpreadClient.cs @@ -12,14 +12,12 @@ namespace Parameters.Spread { public partial class SpreadClient { - public SpreadClient() : this(new Uri("http://localhost:3000"), new SpreadClientOptions()) => throw null; + public SpreadClient() => throw null; - internal SpreadClient(AuthenticationPolicy authenticationPolicy, Uri endpoint, SpreadClientOptions options) => throw null; - - public SpreadClient(Uri endpoint, SpreadClientOptions options) : this(null, endpoint, options) => throw null; + public SpreadClient(Uri endpoint, SpreadClientOptions options) => throw null; [Experimental("SCME0002")] - public SpreadClient(SpreadClientSettings settings) : this(AuthenticationPolicy.Create(settings), settings?.Endpoint, settings?.Options) => throw null; + public SpreadClient(SpreadClientSettings settings) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/content-negotiation/src/Generated/ContentNegotiationClient.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/content-negotiation/src/Generated/ContentNegotiationClient.cs index 919000580c5..d4401918516 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/content-negotiation/src/Generated/ContentNegotiationClient.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/content-negotiation/src/Generated/ContentNegotiationClient.cs @@ -12,14 +12,12 @@ namespace Payload.ContentNegotiation { public partial class ContentNegotiationClient { - public ContentNegotiationClient() : this(new Uri("http://localhost:3000"), new ContentNegotiationClientOptions()) => throw null; + public ContentNegotiationClient() => throw null; - internal ContentNegotiationClient(AuthenticationPolicy authenticationPolicy, Uri endpoint, ContentNegotiationClientOptions options) => throw null; - - public ContentNegotiationClient(Uri endpoint, ContentNegotiationClientOptions options) : this(null, endpoint, options) => throw null; + public ContentNegotiationClient(Uri endpoint, ContentNegotiationClientOptions options) => throw null; [Experimental("SCME0002")] - public ContentNegotiationClient(ContentNegotiationClientSettings settings) : this(AuthenticationPolicy.Create(settings), settings?.Endpoint, settings?.Options) => throw null; + public ContentNegotiationClient(ContentNegotiationClientSettings settings) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/content-negotiation/src/Generated/DifferentBody.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/content-negotiation/src/Generated/DifferentBody.cs index 765ef0cc721..76ada7bada7 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/content-negotiation/src/Generated/DifferentBody.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/content-negotiation/src/Generated/DifferentBody.cs @@ -14,8 +14,6 @@ public partial class DifferentBody { protected DifferentBody() => throw null; - internal DifferentBody(ClientPipeline pipeline, Uri endpoint) => throw null; - public ClientPipeline Pipeline => throw null; public virtual ClientResult GetAvatarAsPng(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/content-negotiation/src/Generated/SameBody.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/content-negotiation/src/Generated/SameBody.cs index 57af2a77ab4..fd6ad96379d 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/content-negotiation/src/Generated/SameBody.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/content-negotiation/src/Generated/SameBody.cs @@ -14,8 +14,6 @@ public partial class SameBody { protected SameBody() => throw null; - internal SameBody(ClientPipeline pipeline, Uri endpoint) => throw null; - public ClientPipeline Pipeline => throw null; public virtual ClientResult GetAvatarAsPng(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/json-merge-patch/src/Generated/JsonMergePatchClient.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/json-merge-patch/src/Generated/JsonMergePatchClient.cs index 878bd2ed9bd..01a560ae62b 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/json-merge-patch/src/Generated/JsonMergePatchClient.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/json-merge-patch/src/Generated/JsonMergePatchClient.cs @@ -13,14 +13,12 @@ namespace Payload.JsonMergePatch { public partial class JsonMergePatchClient { - public JsonMergePatchClient() : this(new Uri("http://localhost:3000"), new JsonMergePatchClientOptions()) => throw null; + public JsonMergePatchClient() => throw null; - internal JsonMergePatchClient(AuthenticationPolicy authenticationPolicy, Uri endpoint, JsonMergePatchClientOptions options) => throw null; - - public JsonMergePatchClient(Uri endpoint, JsonMergePatchClientOptions options) : this(null, endpoint, options) => throw null; + public JsonMergePatchClient(Uri endpoint, JsonMergePatchClientOptions options) => throw null; [Experimental("SCME0002")] - public JsonMergePatchClient(JsonMergePatchClientSettings settings) : this(AuthenticationPolicy.Create(settings), settings?.Endpoint, settings?.Options) => throw null; + public JsonMergePatchClient(JsonMergePatchClientSettings settings) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/media-type/src/Generated/MediaTypeClient.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/media-type/src/Generated/MediaTypeClient.cs index dbfd6a68c4c..eb46a8d77b6 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/media-type/src/Generated/MediaTypeClient.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/media-type/src/Generated/MediaTypeClient.cs @@ -11,14 +11,12 @@ namespace Payload.MediaType { public partial class MediaTypeClient { - public MediaTypeClient() : this(new Uri("http://localhost:3000"), new MediaTypeClientOptions()) => throw null; + public MediaTypeClient() => throw null; - internal MediaTypeClient(AuthenticationPolicy authenticationPolicy, Uri endpoint, MediaTypeClientOptions options) => throw null; - - public MediaTypeClient(Uri endpoint, MediaTypeClientOptions options) : this(null, endpoint, options) => throw null; + public MediaTypeClient(Uri endpoint, MediaTypeClientOptions options) => throw null; [Experimental("SCME0002")] - public MediaTypeClient(MediaTypeClientSettings settings) : this(AuthenticationPolicy.Create(settings), settings?.Endpoint, settings?.Options) => throw null; + public MediaTypeClient(MediaTypeClientSettings settings) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/media-type/src/Generated/StringBody.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/media-type/src/Generated/StringBody.cs index 3efbadabb94..f31c4875707 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/media-type/src/Generated/StringBody.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/media-type/src/Generated/StringBody.cs @@ -2,7 +2,6 @@ #nullable disable -using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -14,8 +13,6 @@ public partial class StringBody { protected StringBody() => throw null; - internal StringBody(ClientPipeline pipeline, Uri endpoint) => throw null; - public ClientPipeline Pipeline => throw null; public virtual ClientResult SendAsText(BinaryContent content, RequestOptions options = null) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/multipart/src/Generated/FormData.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/multipart/src/Generated/FormData.cs index 7af85b26e37..c6e02e93832 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/multipart/src/Generated/FormData.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/multipart/src/Generated/FormData.cs @@ -2,7 +2,6 @@ #nullable disable -using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading.Tasks; @@ -15,8 +14,6 @@ public partial class FormData { protected FormData() => throw null; - internal FormData(ClientPipeline pipeline, Uri endpoint) => throw null; - public ClientPipeline Pipeline => throw null; public virtual ClientResult Basic(BinaryContent content, string contentType, RequestOptions options = null) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/multipart/src/Generated/FormDataFile.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/multipart/src/Generated/FormDataFile.cs index af3b92422ad..055f8f20cb7 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/multipart/src/Generated/FormDataFile.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/multipart/src/Generated/FormDataFile.cs @@ -2,7 +2,6 @@ #nullable disable -using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading.Tasks; @@ -13,8 +12,6 @@ public partial class FormDataFile { protected FormDataFile() => throw null; - internal FormDataFile(ClientPipeline pipeline, Uri endpoint) => throw null; - public ClientPipeline Pipeline => throw null; public virtual ClientResult UploadFileSpecificContentType(BinaryContent content, string contentType, RequestOptions options = null) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/multipart/src/Generated/FormDataHttpParts.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/multipart/src/Generated/FormDataHttpParts.cs index 53b236c7af8..033e295e92d 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/multipart/src/Generated/FormDataHttpParts.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/multipart/src/Generated/FormDataHttpParts.cs @@ -2,7 +2,6 @@ #nullable disable -using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading.Tasks; @@ -15,8 +14,6 @@ public partial class FormDataHttpParts { protected FormDataHttpParts() => throw null; - internal FormDataHttpParts(ClientPipeline pipeline, Uri endpoint) => throw null; - public ClientPipeline Pipeline => throw null; public virtual ClientResult JsonArrayAndFileArray(BinaryContent content, string contentType, RequestOptions options = null) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/multipart/src/Generated/FormDataHttpPartsContentType.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/multipart/src/Generated/FormDataHttpPartsContentType.cs index 971ee6ad114..32cb80df3d0 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/multipart/src/Generated/FormDataHttpPartsContentType.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/multipart/src/Generated/FormDataHttpPartsContentType.cs @@ -2,7 +2,6 @@ #nullable disable -using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading.Tasks; @@ -13,8 +12,6 @@ public partial class FormDataHttpPartsContentType { protected FormDataHttpPartsContentType() => throw null; - internal FormDataHttpPartsContentType(ClientPipeline pipeline, Uri endpoint) => throw null; - public ClientPipeline Pipeline => throw null; public virtual ClientResult ImageJpegContentType(BinaryContent content, string contentType, RequestOptions options = null) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/multipart/src/Generated/FormDataHttpPartsNonString.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/multipart/src/Generated/FormDataHttpPartsNonString.cs index cfb735ba1c8..47557d7876b 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/multipart/src/Generated/FormDataHttpPartsNonString.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/multipart/src/Generated/FormDataHttpPartsNonString.cs @@ -2,7 +2,6 @@ #nullable disable -using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading.Tasks; @@ -13,8 +12,6 @@ public partial class FormDataHttpPartsNonString { protected FormDataHttpPartsNonString() => throw null; - internal FormDataHttpPartsNonString(ClientPipeline pipeline, Uri endpoint) => throw null; - public ClientPipeline Pipeline => throw null; public virtual ClientResult Float(BinaryContent content, string contentType, RequestOptions options = null) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/multipart/src/Generated/MultiPartClient.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/multipart/src/Generated/MultiPartClient.cs index 882e5cd3826..ae8d9b57459 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/multipart/src/Generated/MultiPartClient.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/multipart/src/Generated/MultiPartClient.cs @@ -11,14 +11,12 @@ namespace Payload.MultiPart { public partial class MultiPartClient { - public MultiPartClient() : this(new Uri("http://localhost:3000"), new MultiPartClientOptions()) => throw null; + public MultiPartClient() => throw null; - internal MultiPartClient(AuthenticationPolicy authenticationPolicy, Uri endpoint, MultiPartClientOptions options) => throw null; - - public MultiPartClient(Uri endpoint, MultiPartClientOptions options) : this(null, endpoint, options) => throw null; + public MultiPartClient(Uri endpoint, MultiPartClientOptions options) => throw null; [Experimental("SCME0002")] - public MultiPartClient(MultiPartClientSettings settings) : this(AuthenticationPolicy.Create(settings), settings?.Endpoint, settings?.Options) => throw null; + public MultiPartClient(MultiPartClientSettings settings) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/pageable/src/Generated/PageSize.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/pageable/src/Generated/PageSize.cs index 1ba387d0819..aa4b7b3ce6a 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/pageable/src/Generated/PageSize.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/pageable/src/Generated/PageSize.cs @@ -2,7 +2,6 @@ #nullable disable -using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -14,8 +13,6 @@ public partial class PageSize { protected PageSize() => throw null; - internal PageSize(ClientPipeline pipeline, Uri endpoint) => throw null; - public ClientPipeline Pipeline => throw null; public virtual CollectionResult GetWithoutContinuation(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/pageable/src/Generated/PageableClient.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/pageable/src/Generated/PageableClient.cs index 3b78a1ed79c..c4d9477bd64 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/pageable/src/Generated/PageableClient.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/pageable/src/Generated/PageableClient.cs @@ -13,14 +13,12 @@ namespace Payload.Pageable { public partial class PageableClient { - public PageableClient() : this(new Uri("http://localhost:3000"), new PageableClientOptions()) => throw null; + public PageableClient() => throw null; - internal PageableClient(AuthenticationPolicy authenticationPolicy, Uri endpoint, PageableClientOptions options) => throw null; - - public PageableClient(Uri endpoint, PageableClientOptions options) : this(null, endpoint, options) => throw null; + public PageableClient(Uri endpoint, PageableClientOptions options) => throw null; [Experimental("SCME0002")] - public PageableClient(PageableClientSettings settings) : this(AuthenticationPolicy.Create(settings), settings?.Endpoint, settings?.Options) => throw null; + public PageableClient(PageableClientSettings settings) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/pageable/src/Generated/ServerDrivenPagination.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/pageable/src/Generated/ServerDrivenPagination.cs index b027b296309..b611ba4910d 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/pageable/src/Generated/ServerDrivenPagination.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/pageable/src/Generated/ServerDrivenPagination.cs @@ -2,7 +2,6 @@ #nullable disable -using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -15,8 +14,6 @@ public partial class ServerDrivenPagination { protected ServerDrivenPagination() => throw null; - internal ServerDrivenPagination(ClientPipeline pipeline, Uri endpoint) => throw null; - public ClientPipeline Pipeline => throw null; public virtual CollectionResult Link(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/pageable/src/Generated/ServerDrivenPaginationContinuationToken.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/pageable/src/Generated/ServerDrivenPaginationContinuationToken.cs index 928eaab911f..5c48d40f9b3 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/pageable/src/Generated/ServerDrivenPaginationContinuationToken.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/pageable/src/Generated/ServerDrivenPaginationContinuationToken.cs @@ -2,7 +2,6 @@ #nullable disable -using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -14,8 +13,6 @@ public partial class ServerDrivenPaginationContinuationToken { protected ServerDrivenPaginationContinuationToken() => throw null; - internal ServerDrivenPaginationContinuationToken(ClientPipeline pipeline, Uri endpoint) => throw null; - public ClientPipeline Pipeline => throw null; public virtual CollectionResult RequestQueryResponseBody(string token, string foo, string bar, RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/pageable/src/Generated/XmlPagination.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/pageable/src/Generated/XmlPagination.cs index edbc61168f7..f5423d536cc 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/pageable/src/Generated/XmlPagination.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/pageable/src/Generated/XmlPagination.cs @@ -2,7 +2,6 @@ #nullable disable -using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -14,8 +13,6 @@ public partial class XmlPagination { protected XmlPagination() => throw null; - internal XmlPagination(ClientPipeline pipeline, Uri endpoint) => throw null; - public ClientPipeline Pipeline => throw null; public virtual CollectionResult GetWithContinuation(string marker, RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/xml/src/Generated/ModelWithArrayOfModelValue.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/xml/src/Generated/ModelWithArrayOfModelValue.cs index f1cfe2710d1..e3bb0da6da6 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/xml/src/Generated/ModelWithArrayOfModelValue.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/xml/src/Generated/ModelWithArrayOfModelValue.cs @@ -2,7 +2,6 @@ #nullable disable -using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -14,8 +13,6 @@ public partial class ModelWithArrayOfModelValue { protected ModelWithArrayOfModelValue() => throw null; - internal ModelWithArrayOfModelValue(ClientPipeline pipeline, Uri endpoint) => throw null; - public ClientPipeline Pipeline => throw null; public virtual ClientResult Get(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/xml/src/Generated/ModelWithAttributesValue.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/xml/src/Generated/ModelWithAttributesValue.cs index 283cfb4c443..b9e82ff75b4 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/xml/src/Generated/ModelWithAttributesValue.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/xml/src/Generated/ModelWithAttributesValue.cs @@ -2,7 +2,6 @@ #nullable disable -using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -14,8 +13,6 @@ public partial class ModelWithAttributesValue { protected ModelWithAttributesValue() => throw null; - internal ModelWithAttributesValue(ClientPipeline pipeline, Uri endpoint) => throw null; - public ClientPipeline Pipeline => throw null; public virtual ClientResult Get(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/xml/src/Generated/ModelWithDictionaryValue.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/xml/src/Generated/ModelWithDictionaryValue.cs index 0c0df435c8a..454fd7f51b9 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/xml/src/Generated/ModelWithDictionaryValue.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/xml/src/Generated/ModelWithDictionaryValue.cs @@ -2,7 +2,6 @@ #nullable disable -using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -14,8 +13,6 @@ public partial class ModelWithDictionaryValue { protected ModelWithDictionaryValue() => throw null; - internal ModelWithDictionaryValue(ClientPipeline pipeline, Uri endpoint) => throw null; - public ClientPipeline Pipeline => throw null; public virtual ClientResult Get(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/xml/src/Generated/ModelWithEmptyArrayValue.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/xml/src/Generated/ModelWithEmptyArrayValue.cs index bad31fbc8cc..f97e5bb89d6 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/xml/src/Generated/ModelWithEmptyArrayValue.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/xml/src/Generated/ModelWithEmptyArrayValue.cs @@ -2,7 +2,6 @@ #nullable disable -using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -14,8 +13,6 @@ public partial class ModelWithEmptyArrayValue { protected ModelWithEmptyArrayValue() => throw null; - internal ModelWithEmptyArrayValue(ClientPipeline pipeline, Uri endpoint) => throw null; - public ClientPipeline Pipeline => throw null; public virtual ClientResult Get(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/xml/src/Generated/ModelWithEncodedNamesValue.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/xml/src/Generated/ModelWithEncodedNamesValue.cs index 6b6a02b751f..1dbf3924200 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/xml/src/Generated/ModelWithEncodedNamesValue.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/xml/src/Generated/ModelWithEncodedNamesValue.cs @@ -2,7 +2,6 @@ #nullable disable -using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -14,8 +13,6 @@ public partial class ModelWithEncodedNamesValue { protected ModelWithEncodedNamesValue() => throw null; - internal ModelWithEncodedNamesValue(ClientPipeline pipeline, Uri endpoint) => throw null; - public ClientPipeline Pipeline => throw null; public virtual ClientResult Get(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/xml/src/Generated/ModelWithOptionalFieldValue.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/xml/src/Generated/ModelWithOptionalFieldValue.cs index e2bbd2a0fe9..3dc923de469 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/xml/src/Generated/ModelWithOptionalFieldValue.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/xml/src/Generated/ModelWithOptionalFieldValue.cs @@ -2,7 +2,6 @@ #nullable disable -using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -14,8 +13,6 @@ public partial class ModelWithOptionalFieldValue { protected ModelWithOptionalFieldValue() => throw null; - internal ModelWithOptionalFieldValue(ClientPipeline pipeline, Uri endpoint) => throw null; - public ClientPipeline Pipeline => throw null; public virtual ClientResult Get(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/xml/src/Generated/ModelWithRenamedArraysValue.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/xml/src/Generated/ModelWithRenamedArraysValue.cs index f387ba00d47..c27e948d0ef 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/xml/src/Generated/ModelWithRenamedArraysValue.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/xml/src/Generated/ModelWithRenamedArraysValue.cs @@ -2,7 +2,6 @@ #nullable disable -using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -14,8 +13,6 @@ public partial class ModelWithRenamedArraysValue { protected ModelWithRenamedArraysValue() => throw null; - internal ModelWithRenamedArraysValue(ClientPipeline pipeline, Uri endpoint) => throw null; - public ClientPipeline Pipeline => throw null; public virtual ClientResult Get(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/xml/src/Generated/ModelWithRenamedFieldsValue.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/xml/src/Generated/ModelWithRenamedFieldsValue.cs index 291ca0113d2..976fe8192f3 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/xml/src/Generated/ModelWithRenamedFieldsValue.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/xml/src/Generated/ModelWithRenamedFieldsValue.cs @@ -2,7 +2,6 @@ #nullable disable -using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -14,8 +13,6 @@ public partial class ModelWithRenamedFieldsValue { protected ModelWithRenamedFieldsValue() => throw null; - internal ModelWithRenamedFieldsValue(ClientPipeline pipeline, Uri endpoint) => throw null; - public ClientPipeline Pipeline => throw null; public virtual ClientResult Get(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/xml/src/Generated/ModelWithSimpleArraysValue.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/xml/src/Generated/ModelWithSimpleArraysValue.cs index ef168252ce1..221293cbc43 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/xml/src/Generated/ModelWithSimpleArraysValue.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/xml/src/Generated/ModelWithSimpleArraysValue.cs @@ -2,7 +2,6 @@ #nullable disable -using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -14,8 +13,6 @@ public partial class ModelWithSimpleArraysValue { protected ModelWithSimpleArraysValue() => throw null; - internal ModelWithSimpleArraysValue(ClientPipeline pipeline, Uri endpoint) => throw null; - public ClientPipeline Pipeline => throw null; public virtual ClientResult Get(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/xml/src/Generated/ModelWithTextValue.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/xml/src/Generated/ModelWithTextValue.cs index 273515d228e..c87bf14cccd 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/xml/src/Generated/ModelWithTextValue.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/xml/src/Generated/ModelWithTextValue.cs @@ -2,7 +2,6 @@ #nullable disable -using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -14,8 +13,6 @@ public partial class ModelWithTextValue { protected ModelWithTextValue() => throw null; - internal ModelWithTextValue(ClientPipeline pipeline, Uri endpoint) => throw null; - public ClientPipeline Pipeline => throw null; public virtual ClientResult Get(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/xml/src/Generated/ModelWithUnwrappedArrayValue.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/xml/src/Generated/ModelWithUnwrappedArrayValue.cs index 319bba5194c..74372fd6b84 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/xml/src/Generated/ModelWithUnwrappedArrayValue.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/xml/src/Generated/ModelWithUnwrappedArrayValue.cs @@ -2,7 +2,6 @@ #nullable disable -using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -14,8 +13,6 @@ public partial class ModelWithUnwrappedArrayValue { protected ModelWithUnwrappedArrayValue() => throw null; - internal ModelWithUnwrappedArrayValue(ClientPipeline pipeline, Uri endpoint) => throw null; - public ClientPipeline Pipeline => throw null; public virtual ClientResult Get(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/xml/src/Generated/SimpleModelValue.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/xml/src/Generated/SimpleModelValue.cs index 0ca41673678..6a020d4c531 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/xml/src/Generated/SimpleModelValue.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/xml/src/Generated/SimpleModelValue.cs @@ -2,7 +2,6 @@ #nullable disable -using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -14,8 +13,6 @@ public partial class SimpleModelValue { protected SimpleModelValue() => throw null; - internal SimpleModelValue(ClientPipeline pipeline, Uri endpoint) => throw null; - public ClientPipeline Pipeline => throw null; public virtual ClientResult Get(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/xml/src/Generated/XmlClient.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/xml/src/Generated/XmlClient.cs index cab5046952f..81dc325d12a 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/xml/src/Generated/XmlClient.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/xml/src/Generated/XmlClient.cs @@ -10,14 +10,12 @@ namespace Payload.Xml { public partial class XmlClient { - public XmlClient() : this(new Uri("http://localhost:3000"), new XmlClientOptions()) => throw null; + public XmlClient() => throw null; - internal XmlClient(AuthenticationPolicy authenticationPolicy, Uri endpoint, XmlClientOptions options) => throw null; - - public XmlClient(Uri endpoint, XmlClientOptions options) : this(null, endpoint, options) => throw null; + public XmlClient(Uri endpoint, XmlClientOptions options) => throw null; [Experimental("SCME0002")] - public XmlClient(XmlClientSettings settings) : this(AuthenticationPolicy.Create(settings), settings?.Endpoint, settings?.Options) => throw null; + public XmlClient(XmlClientSettings settings) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/xml/src/Generated/XmlErrorValue.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/xml/src/Generated/XmlErrorValue.cs index cf37b300967..13069ff4ebb 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/xml/src/Generated/XmlErrorValue.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/xml/src/Generated/XmlErrorValue.cs @@ -2,7 +2,6 @@ #nullable disable -using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -14,8 +13,6 @@ public partial class XmlErrorValue { protected XmlErrorValue() => throw null; - internal XmlErrorValue(ClientPipeline pipeline, Uri endpoint) => throw null; - public ClientPipeline Pipeline => throw null; public virtual ClientResult Get(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/resiliency/srv-driven/v1/src/Generated/ResiliencyServiceDrivenClient.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/resiliency/srv-driven/v1/src/Generated/ResiliencyServiceDrivenClient.cs index 0d010ec8ea0..0858f38f289 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/resiliency/srv-driven/v1/src/Generated/ResiliencyServiceDrivenClient.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/resiliency/srv-driven/v1/src/Generated/ResiliencyServiceDrivenClient.cs @@ -15,14 +15,12 @@ public partial class ResiliencyServiceDrivenClient { protected ResiliencyServiceDrivenClient() => throw null; - public ResiliencyServiceDrivenClient(Uri endpoint, string serviceDeploymentVersion) : this(endpoint, serviceDeploymentVersion, new ResiliencyServiceDrivenClientOptions()) => throw null; + public ResiliencyServiceDrivenClient(Uri endpoint, string serviceDeploymentVersion) => throw null; - internal ResiliencyServiceDrivenClient(AuthenticationPolicy authenticationPolicy, Uri endpoint, string serviceDeploymentVersion, ResiliencyServiceDrivenClientOptions options) => throw null; - - public ResiliencyServiceDrivenClient(Uri endpoint, string serviceDeploymentVersion, ResiliencyServiceDrivenClientOptions options) : this(null, endpoint, serviceDeploymentVersion, options) => throw null; + public ResiliencyServiceDrivenClient(Uri endpoint, string serviceDeploymentVersion, ResiliencyServiceDrivenClientOptions options) => throw null; [Experimental("SCME0002")] - public ResiliencyServiceDrivenClient(ResiliencyServiceDrivenClientSettings settings) : this(AuthenticationPolicy.Create(settings), settings?.Endpoint, settings?.ServiceDeploymentVersion, settings?.Options) => throw null; + public ResiliencyServiceDrivenClient(ResiliencyServiceDrivenClientSettings settings) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/resiliency/srv-driven/v2/src/Generated/ResiliencyServiceDrivenClient.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/resiliency/srv-driven/v2/src/Generated/ResiliencyServiceDrivenClient.cs index 59d7160e347..24668d794cd 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/resiliency/srv-driven/v2/src/Generated/ResiliencyServiceDrivenClient.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/resiliency/srv-driven/v2/src/Generated/ResiliencyServiceDrivenClient.cs @@ -15,14 +15,12 @@ public partial class ResiliencyServiceDrivenClient { protected ResiliencyServiceDrivenClient() => throw null; - public ResiliencyServiceDrivenClient(Uri endpoint, string serviceDeploymentVersion) : this(endpoint, serviceDeploymentVersion, new ResiliencyServiceDrivenClientOptions()) => throw null; + public ResiliencyServiceDrivenClient(Uri endpoint, string serviceDeploymentVersion) => throw null; - internal ResiliencyServiceDrivenClient(AuthenticationPolicy authenticationPolicy, Uri endpoint, string serviceDeploymentVersion, ResiliencyServiceDrivenClientOptions options) => throw null; - - public ResiliencyServiceDrivenClient(Uri endpoint, string serviceDeploymentVersion, ResiliencyServiceDrivenClientOptions options) : this(null, endpoint, serviceDeploymentVersion, options) => throw null; + public ResiliencyServiceDrivenClient(Uri endpoint, string serviceDeploymentVersion, ResiliencyServiceDrivenClientOptions options) => throw null; [Experimental("SCME0002")] - public ResiliencyServiceDrivenClient(ResiliencyServiceDrivenClientSettings settings) : this(AuthenticationPolicy.Create(settings), settings?.Endpoint, settings?.ServiceDeploymentVersion, settings?.Options) => throw null; + public ResiliencyServiceDrivenClient(ResiliencyServiceDrivenClientSettings settings) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/response/status-code-range/src/Generated/StatusCodeRangeClient.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/response/status-code-range/src/Generated/StatusCodeRangeClient.cs index 1cf6258e804..e0c48a15a85 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/response/status-code-range/src/Generated/StatusCodeRangeClient.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/response/status-code-range/src/Generated/StatusCodeRangeClient.cs @@ -13,14 +13,12 @@ namespace Response.StatusCodeRange { public partial class StatusCodeRangeClient { - public StatusCodeRangeClient() : this(new Uri("http://localhost:3000"), new StatusCodeRangeClientOptions()) => throw null; + public StatusCodeRangeClient() => throw null; - internal StatusCodeRangeClient(AuthenticationPolicy authenticationPolicy, Uri endpoint, StatusCodeRangeClientOptions options) => throw null; - - public StatusCodeRangeClient(Uri endpoint, StatusCodeRangeClientOptions options) : this(null, endpoint, options) => throw null; + public StatusCodeRangeClient(Uri endpoint, StatusCodeRangeClientOptions options) => throw null; [Experimental("SCME0002")] - public StatusCodeRangeClient(StatusCodeRangeClientSettings settings) : this(AuthenticationPolicy.Create(settings), settings?.Endpoint, settings?.Options) => throw null; + public StatusCodeRangeClient(StatusCodeRangeClientSettings settings) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/InInterface.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/InInterface.cs index 934018fdcc3..2c68d8281b8 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/InInterface.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/InInterface.cs @@ -2,7 +2,6 @@ #nullable disable -using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -14,8 +13,6 @@ public partial class InInterface { protected InInterface() => throw null; - internal InInterface(ClientPipeline pipeline, Uri endpoint) => throw null; - public ClientPipeline Pipeline => throw null; public virtual ClientResult Fixed(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/PathParameters.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/PathParameters.cs index 305a607546a..3e17767b7d8 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/PathParameters.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/PathParameters.cs @@ -2,7 +2,6 @@ #nullable disable -using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -19,8 +18,6 @@ public partial class PathParameters { protected PathParameters() => throw null; - internal PathParameters(ClientPipeline pipeline, Uri endpoint) => throw null; - public ClientPipeline Pipeline => throw null; public virtual ClientResult TemplateOnly(string @param, RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/PathParametersLabelExpansion.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/PathParametersLabelExpansion.cs index a3daa8878cb..b7d6a6cbc7c 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/PathParametersLabelExpansion.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/PathParametersLabelExpansion.cs @@ -2,7 +2,6 @@ #nullable disable -using System; using System.ClientModel.Primitives; using Routes._PathParameters.LabelExpansion.Explode; using Routes._PathParameters.LabelExpansion.Standard; @@ -13,8 +12,6 @@ public partial class PathParametersLabelExpansion { protected PathParametersLabelExpansion() => throw null; - internal PathParametersLabelExpansion(ClientPipeline pipeline, Uri endpoint) => throw null; - public ClientPipeline Pipeline => throw null; public virtual PathParametersLabelExpansionStandard GetPathParametersLabelExpansionStandardClient() => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/PathParametersLabelExpansionExplode.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/PathParametersLabelExpansionExplode.cs index d032c33fc38..79470e680e1 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/PathParametersLabelExpansionExplode.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/PathParametersLabelExpansionExplode.cs @@ -2,7 +2,6 @@ #nullable disable -using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Collections.Generic; @@ -15,8 +14,6 @@ public partial class PathParametersLabelExpansionExplode { protected PathParametersLabelExpansionExplode() => throw null; - internal PathParametersLabelExpansionExplode(ClientPipeline pipeline, Uri endpoint) => throw null; - public ClientPipeline Pipeline => throw null; public virtual ClientResult Primitive(string @param, RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/PathParametersLabelExpansionStandard.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/PathParametersLabelExpansionStandard.cs index f18f1e516cc..0b742d05724 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/PathParametersLabelExpansionStandard.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/PathParametersLabelExpansionStandard.cs @@ -2,7 +2,6 @@ #nullable disable -using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Collections.Generic; @@ -15,8 +14,6 @@ public partial class PathParametersLabelExpansionStandard { protected PathParametersLabelExpansionStandard() => throw null; - internal PathParametersLabelExpansionStandard(ClientPipeline pipeline, Uri endpoint) => throw null; - public ClientPipeline Pipeline => throw null; public virtual ClientResult Primitive(string @param, RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/PathParametersMatrixExpansion.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/PathParametersMatrixExpansion.cs index 5c60d18f7bb..6bf98190256 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/PathParametersMatrixExpansion.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/PathParametersMatrixExpansion.cs @@ -2,7 +2,6 @@ #nullable disable -using System; using System.ClientModel.Primitives; using Routes._PathParameters.MatrixExpansion.Explode; using Routes._PathParameters.MatrixExpansion.Standard; @@ -13,8 +12,6 @@ public partial class PathParametersMatrixExpansion { protected PathParametersMatrixExpansion() => throw null; - internal PathParametersMatrixExpansion(ClientPipeline pipeline, Uri endpoint) => throw null; - public ClientPipeline Pipeline => throw null; public virtual PathParametersMatrixExpansionStandard GetPathParametersMatrixExpansionStandardClient() => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/PathParametersMatrixExpansionExplode.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/PathParametersMatrixExpansionExplode.cs index bf3f3e88d58..b92df406571 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/PathParametersMatrixExpansionExplode.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/PathParametersMatrixExpansionExplode.cs @@ -2,7 +2,6 @@ #nullable disable -using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Collections.Generic; @@ -15,8 +14,6 @@ public partial class PathParametersMatrixExpansionExplode { protected PathParametersMatrixExpansionExplode() => throw null; - internal PathParametersMatrixExpansionExplode(ClientPipeline pipeline, Uri endpoint) => throw null; - public ClientPipeline Pipeline => throw null; public virtual ClientResult Primitive(string @param, RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/PathParametersMatrixExpansionStandard.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/PathParametersMatrixExpansionStandard.cs index 165a76d190f..d40c1696d15 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/PathParametersMatrixExpansionStandard.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/PathParametersMatrixExpansionStandard.cs @@ -2,7 +2,6 @@ #nullable disable -using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Collections.Generic; @@ -15,8 +14,6 @@ public partial class PathParametersMatrixExpansionStandard { protected PathParametersMatrixExpansionStandard() => throw null; - internal PathParametersMatrixExpansionStandard(ClientPipeline pipeline, Uri endpoint) => throw null; - public ClientPipeline Pipeline => throw null; public virtual ClientResult Primitive(string @param, RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/PathParametersPathExpansion.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/PathParametersPathExpansion.cs index 11bd31de479..ec2f665c1a2 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/PathParametersPathExpansion.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/PathParametersPathExpansion.cs @@ -2,7 +2,6 @@ #nullable disable -using System; using System.ClientModel.Primitives; using Routes._PathParameters.PathExpansion.Explode; using Routes._PathParameters.PathExpansion.Standard; @@ -13,8 +12,6 @@ public partial class PathParametersPathExpansion { protected PathParametersPathExpansion() => throw null; - internal PathParametersPathExpansion(ClientPipeline pipeline, Uri endpoint) => throw null; - public ClientPipeline Pipeline => throw null; public virtual PathParametersPathExpansionStandard GetPathParametersPathExpansionStandardClient() => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/PathParametersPathExpansionExplode.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/PathParametersPathExpansionExplode.cs index e2368337641..b7f10f1c6d4 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/PathParametersPathExpansionExplode.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/PathParametersPathExpansionExplode.cs @@ -2,7 +2,6 @@ #nullable disable -using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Collections.Generic; @@ -15,8 +14,6 @@ public partial class PathParametersPathExpansionExplode { protected PathParametersPathExpansionExplode() => throw null; - internal PathParametersPathExpansionExplode(ClientPipeline pipeline, Uri endpoint) => throw null; - public ClientPipeline Pipeline => throw null; public virtual ClientResult Primitive(string @param, RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/PathParametersPathExpansionStandard.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/PathParametersPathExpansionStandard.cs index 8c63b0829fb..d58ca6fbc4d 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/PathParametersPathExpansionStandard.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/PathParametersPathExpansionStandard.cs @@ -2,7 +2,6 @@ #nullable disable -using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Collections.Generic; @@ -15,8 +14,6 @@ public partial class PathParametersPathExpansionStandard { protected PathParametersPathExpansionStandard() => throw null; - internal PathParametersPathExpansionStandard(ClientPipeline pipeline, Uri endpoint) => throw null; - public ClientPipeline Pipeline => throw null; public virtual ClientResult Primitive(string @param, RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/PathParametersReservedExpansion.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/PathParametersReservedExpansion.cs index 60f78bfde07..3becc3ca8f2 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/PathParametersReservedExpansion.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/PathParametersReservedExpansion.cs @@ -2,7 +2,6 @@ #nullable disable -using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -14,8 +13,6 @@ public partial class PathParametersReservedExpansion { protected PathParametersReservedExpansion() => throw null; - internal PathParametersReservedExpansion(ClientPipeline pipeline, Uri endpoint) => throw null; - public ClientPipeline Pipeline => throw null; public virtual ClientResult Template(string @param, RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/PathParametersSimpleExpansion.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/PathParametersSimpleExpansion.cs index 87724df6d6d..cb3b2ce1c3a 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/PathParametersSimpleExpansion.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/PathParametersSimpleExpansion.cs @@ -2,7 +2,6 @@ #nullable disable -using System; using System.ClientModel.Primitives; using Routes._PathParameters.SimpleExpansion.Explode; using Routes._PathParameters.SimpleExpansion.Standard; @@ -13,8 +12,6 @@ public partial class PathParametersSimpleExpansion { protected PathParametersSimpleExpansion() => throw null; - internal PathParametersSimpleExpansion(ClientPipeline pipeline, Uri endpoint) => throw null; - public ClientPipeline Pipeline => throw null; public virtual PathParametersSimpleExpansionStandard GetPathParametersSimpleExpansionStandardClient() => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/PathParametersSimpleExpansionExplode.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/PathParametersSimpleExpansionExplode.cs index 2abcc233d4b..00c4d218a1c 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/PathParametersSimpleExpansionExplode.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/PathParametersSimpleExpansionExplode.cs @@ -2,7 +2,6 @@ #nullable disable -using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Collections.Generic; @@ -15,8 +14,6 @@ public partial class PathParametersSimpleExpansionExplode { protected PathParametersSimpleExpansionExplode() => throw null; - internal PathParametersSimpleExpansionExplode(ClientPipeline pipeline, Uri endpoint) => throw null; - public ClientPipeline Pipeline => throw null; public virtual ClientResult Primitive(string @param, RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/PathParametersSimpleExpansionStandard.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/PathParametersSimpleExpansionStandard.cs index 21f896bcdb3..63477a318ae 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/PathParametersSimpleExpansionStandard.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/PathParametersSimpleExpansionStandard.cs @@ -2,7 +2,6 @@ #nullable disable -using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Collections.Generic; @@ -15,8 +14,6 @@ public partial class PathParametersSimpleExpansionStandard { protected PathParametersSimpleExpansionStandard() => throw null; - internal PathParametersSimpleExpansionStandard(ClientPipeline pipeline, Uri endpoint) => throw null; - public ClientPipeline Pipeline => throw null; public virtual ClientResult Primitive(string @param, RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/QueryParameters.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/QueryParameters.cs index 50f707d2cf0..4ccfde73030 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/QueryParameters.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/QueryParameters.cs @@ -2,7 +2,6 @@ #nullable disable -using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -16,8 +15,6 @@ public partial class QueryParameters { protected QueryParameters() => throw null; - internal QueryParameters(ClientPipeline pipeline, Uri endpoint) => throw null; - public ClientPipeline Pipeline => throw null; public virtual ClientResult TemplateOnly(string @param, RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/QueryParametersQueryContinuation.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/QueryParametersQueryContinuation.cs index 3aa640a00e5..c1e1821e791 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/QueryParametersQueryContinuation.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/QueryParametersQueryContinuation.cs @@ -2,7 +2,6 @@ #nullable disable -using System; using System.ClientModel.Primitives; using Routes._QueryParameters.QueryContinuation.Explode; using Routes._QueryParameters.QueryContinuation.Standard; @@ -13,8 +12,6 @@ public partial class QueryParametersQueryContinuation { protected QueryParametersQueryContinuation() => throw null; - internal QueryParametersQueryContinuation(ClientPipeline pipeline, Uri endpoint) => throw null; - public ClientPipeline Pipeline => throw null; public virtual QueryParametersQueryContinuationStandard GetQueryParametersQueryContinuationStandardClient() => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/QueryParametersQueryContinuationExplode.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/QueryParametersQueryContinuationExplode.cs index ca911b55cb3..b9a3cb696d4 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/QueryParametersQueryContinuationExplode.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/QueryParametersQueryContinuationExplode.cs @@ -2,7 +2,6 @@ #nullable disable -using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Collections.Generic; @@ -15,8 +14,6 @@ public partial class QueryParametersQueryContinuationExplode { protected QueryParametersQueryContinuationExplode() => throw null; - internal QueryParametersQueryContinuationExplode(ClientPipeline pipeline, Uri endpoint) => throw null; - public ClientPipeline Pipeline => throw null; public virtual ClientResult Primitive(string @param, RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/QueryParametersQueryContinuationStandard.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/QueryParametersQueryContinuationStandard.cs index 828f03e49f2..679ca546a46 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/QueryParametersQueryContinuationStandard.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/QueryParametersQueryContinuationStandard.cs @@ -2,7 +2,6 @@ #nullable disable -using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Collections.Generic; @@ -15,8 +14,6 @@ public partial class QueryParametersQueryContinuationStandard { protected QueryParametersQueryContinuationStandard() => throw null; - internal QueryParametersQueryContinuationStandard(ClientPipeline pipeline, Uri endpoint) => throw null; - public ClientPipeline Pipeline => throw null; public virtual ClientResult Primitive(string @param, RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/QueryParametersQueryExpansion.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/QueryParametersQueryExpansion.cs index 4d2b16565c0..7038262cc30 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/QueryParametersQueryExpansion.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/QueryParametersQueryExpansion.cs @@ -2,7 +2,6 @@ #nullable disable -using System; using System.ClientModel.Primitives; using Routes._QueryParameters.QueryExpansion.Explode; using Routes._QueryParameters.QueryExpansion.Standard; @@ -13,8 +12,6 @@ public partial class QueryParametersQueryExpansion { protected QueryParametersQueryExpansion() => throw null; - internal QueryParametersQueryExpansion(ClientPipeline pipeline, Uri endpoint) => throw null; - public ClientPipeline Pipeline => throw null; public virtual QueryParametersQueryExpansionStandard GetQueryParametersQueryExpansionStandardClient() => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/QueryParametersQueryExpansionExplode.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/QueryParametersQueryExpansionExplode.cs index e8989434a9d..cedde7fe6aa 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/QueryParametersQueryExpansionExplode.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/QueryParametersQueryExpansionExplode.cs @@ -2,7 +2,6 @@ #nullable disable -using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Collections.Generic; @@ -15,8 +14,6 @@ public partial class QueryParametersQueryExpansionExplode { protected QueryParametersQueryExpansionExplode() => throw null; - internal QueryParametersQueryExpansionExplode(ClientPipeline pipeline, Uri endpoint) => throw null; - public ClientPipeline Pipeline => throw null; public virtual ClientResult Primitive(string @param, RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/QueryParametersQueryExpansionStandard.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/QueryParametersQueryExpansionStandard.cs index 9566e4d25f8..dd88da3b509 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/QueryParametersQueryExpansionStandard.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/QueryParametersQueryExpansionStandard.cs @@ -2,7 +2,6 @@ #nullable disable -using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Collections.Generic; @@ -15,8 +14,6 @@ public partial class QueryParametersQueryExpansionStandard { protected QueryParametersQueryExpansionStandard() => throw null; - internal QueryParametersQueryExpansionStandard(ClientPipeline pipeline, Uri endpoint) => throw null; - public ClientPipeline Pipeline => throw null; public virtual ClientResult Primitive(string @param, RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/RoutesClient.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/RoutesClient.cs index 8e156cfd6b7..835c7c58cd7 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/RoutesClient.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/RoutesClient.cs @@ -15,14 +15,12 @@ namespace Routes { public partial class RoutesClient { - public RoutesClient() : this(new Uri("http://localhost:3000"), new RoutesClientOptions()) => throw null; + public RoutesClient() => throw null; - internal RoutesClient(AuthenticationPolicy authenticationPolicy, Uri endpoint, RoutesClientOptions options) => throw null; - - public RoutesClient(Uri endpoint, RoutesClientOptions options) : this(null, endpoint, options) => throw null; + public RoutesClient(Uri endpoint, RoutesClientOptions options) => throw null; [Experimental("SCME0002")] - public RoutesClient(RoutesClientSettings settings) : this(AuthenticationPolicy.Create(settings), settings?.Endpoint, settings?.Options) => throw null; + public RoutesClient(RoutesClientSettings settings) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/serialization/encoded-name/json/src/Generated/JsonClient.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/serialization/encoded-name/json/src/Generated/JsonClient.cs index 5501186e310..628ce575919 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/serialization/encoded-name/json/src/Generated/JsonClient.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/serialization/encoded-name/json/src/Generated/JsonClient.cs @@ -11,14 +11,12 @@ namespace Serialization.EncodedName.Json { public partial class JsonClient { - public JsonClient() : this(new Uri("http://localhost:3000"), new JsonClientOptions()) => throw null; + public JsonClient() => throw null; - internal JsonClient(AuthenticationPolicy authenticationPolicy, Uri endpoint, JsonClientOptions options) => throw null; - - public JsonClient(Uri endpoint, JsonClientOptions options) : this(null, endpoint, options) => throw null; + public JsonClient(Uri endpoint, JsonClientOptions options) => throw null; [Experimental("SCME0002")] - public JsonClient(JsonClientSettings settings) : this(AuthenticationPolicy.Create(settings), settings?.Endpoint, settings?.Options) => throw null; + public JsonClient(JsonClientSettings settings) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/serialization/encoded-name/json/src/Generated/Property.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/serialization/encoded-name/json/src/Generated/Property.cs index 67558d68030..2a1aea1756d 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/serialization/encoded-name/json/src/Generated/Property.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/serialization/encoded-name/json/src/Generated/Property.cs @@ -2,7 +2,6 @@ #nullable disable -using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -14,8 +13,6 @@ public partial class Property { protected Property() => throw null; - internal Property(ClientPipeline pipeline, Uri endpoint) => throw null; - public ClientPipeline Pipeline => throw null; public virtual ClientResult Send(BinaryContent content, RequestOptions options = null) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/server/endpoint/not-defined/src/Generated/NotDefinedClient.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/server/endpoint/not-defined/src/Generated/NotDefinedClient.cs index a503b59d200..4f941f9c7c3 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/server/endpoint/not-defined/src/Generated/NotDefinedClient.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/server/endpoint/not-defined/src/Generated/NotDefinedClient.cs @@ -15,14 +15,12 @@ public partial class NotDefinedClient { protected NotDefinedClient() => throw null; - public NotDefinedClient(Uri endpoint) : this(endpoint, new NotDefinedClientOptions()) => throw null; + public NotDefinedClient(Uri endpoint) => throw null; - internal NotDefinedClient(AuthenticationPolicy authenticationPolicy, Uri endpoint, NotDefinedClientOptions options) => throw null; - - public NotDefinedClient(Uri endpoint, NotDefinedClientOptions options) : this(null, endpoint, options) => throw null; + public NotDefinedClient(Uri endpoint, NotDefinedClientOptions options) => throw null; [Experimental("SCME0002")] - public NotDefinedClient(NotDefinedClientSettings settings) : this(AuthenticationPolicy.Create(settings), settings?.Endpoint, settings?.Options) => throw null; + public NotDefinedClient(NotDefinedClientSettings settings) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/server/path/multiple/src/Generated/MultipleClient.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/server/path/multiple/src/Generated/MultipleClient.cs index 10ba60fb3a1..d4c2debf3bd 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/server/path/multiple/src/Generated/MultipleClient.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/server/path/multiple/src/Generated/MultipleClient.cs @@ -15,14 +15,12 @@ public partial class MultipleClient { protected MultipleClient() => throw null; - public MultipleClient(Uri endpoint) : this(endpoint, new MultipleClientOptions()) => throw null; + public MultipleClient(Uri endpoint) => throw null; - internal MultipleClient(AuthenticationPolicy authenticationPolicy, Uri endpoint, MultipleClientOptions options) => throw null; - - public MultipleClient(Uri endpoint, MultipleClientOptions options) : this(null, endpoint, options) => throw null; + public MultipleClient(Uri endpoint, MultipleClientOptions options) => throw null; [Experimental("SCME0002")] - public MultipleClient(MultipleClientSettings settings) : this(AuthenticationPolicy.Create(settings), settings?.Endpoint, settings?.Options) => throw null; + public MultipleClient(MultipleClientSettings settings) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/server/path/single/src/Generated/SingleClient.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/server/path/single/src/Generated/SingleClient.cs index 3bc250e9775..4c47fdb1c66 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/server/path/single/src/Generated/SingleClient.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/server/path/single/src/Generated/SingleClient.cs @@ -15,14 +15,12 @@ public partial class SingleClient { protected SingleClient() => throw null; - public SingleClient(Uri endpoint) : this(endpoint, new SingleClientOptions()) => throw null; + public SingleClient(Uri endpoint) => throw null; - internal SingleClient(AuthenticationPolicy authenticationPolicy, Uri endpoint, SingleClientOptions options) => throw null; - - public SingleClient(Uri endpoint, SingleClientOptions options) : this(null, endpoint, options) => throw null; + public SingleClient(Uri endpoint, SingleClientOptions options) => throw null; [Experimental("SCME0002")] - public SingleClient(SingleClientSettings settings) : this(AuthenticationPolicy.Create(settings), settings?.Endpoint, settings?.Options) => throw null; + public SingleClient(SingleClientSettings settings) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/server/versions/not-versioned/src/Generated/NotVersionedClient.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/server/versions/not-versioned/src/Generated/NotVersionedClient.cs index 66b8752fa2d..78167a7b2af 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/server/versions/not-versioned/src/Generated/NotVersionedClient.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/server/versions/not-versioned/src/Generated/NotVersionedClient.cs @@ -15,14 +15,12 @@ public partial class NotVersionedClient { protected NotVersionedClient() => throw null; - public NotVersionedClient(Uri endpoint) : this(endpoint, new NotVersionedClientOptions()) => throw null; + public NotVersionedClient(Uri endpoint) => throw null; - internal NotVersionedClient(AuthenticationPolicy authenticationPolicy, Uri endpoint, NotVersionedClientOptions options) => throw null; - - public NotVersionedClient(Uri endpoint, NotVersionedClientOptions options) : this(null, endpoint, options) => throw null; + public NotVersionedClient(Uri endpoint, NotVersionedClientOptions options) => throw null; [Experimental("SCME0002")] - public NotVersionedClient(NotVersionedClientSettings settings) : this(AuthenticationPolicy.Create(settings), settings?.Endpoint, settings?.Options) => throw null; + public NotVersionedClient(NotVersionedClientSettings settings) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/server/versions/versioned/src/Generated/VersionedClient.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/server/versions/versioned/src/Generated/VersionedClient.cs index fc5d889c517..114ebf9a3b8 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/server/versions/versioned/src/Generated/VersionedClient.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/server/versions/versioned/src/Generated/VersionedClient.cs @@ -15,14 +15,12 @@ public partial class VersionedClient { protected VersionedClient() => throw null; - public VersionedClient(Uri endpoint) : this(endpoint, new VersionedClientOptions()) => throw null; + public VersionedClient(Uri endpoint) => throw null; - internal VersionedClient(AuthenticationPolicy authenticationPolicy, Uri endpoint, VersionedClientOptions options) => throw null; - - public VersionedClient(Uri endpoint, VersionedClientOptions options) : this(null, endpoint, options) => throw null; + public VersionedClient(Uri endpoint, VersionedClientOptions options) => throw null; [Experimental("SCME0002")] - public VersionedClient(VersionedClientSettings settings) : this(AuthenticationPolicy.Create(settings), settings?.Endpoint, settings?.Options) => throw null; + public VersionedClient(VersionedClientSettings settings) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/special-headers/conditional-request/src/Generated/ConditionalRequestClient.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/special-headers/conditional-request/src/Generated/ConditionalRequestClient.cs index cac754cfedb..4b5d78f3e38 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/special-headers/conditional-request/src/Generated/ConditionalRequestClient.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/special-headers/conditional-request/src/Generated/ConditionalRequestClient.cs @@ -13,14 +13,12 @@ namespace SpecialHeaders.ConditionalRequest { public partial class ConditionalRequestClient { - public ConditionalRequestClient() : this(new Uri("http://localhost:3000"), new ConditionalRequestClientOptions()) => throw null; + public ConditionalRequestClient() => throw null; - internal ConditionalRequestClient(AuthenticationPolicy authenticationPolicy, Uri endpoint, ConditionalRequestClientOptions options) => throw null; - - public ConditionalRequestClient(Uri endpoint, ConditionalRequestClientOptions options) : this(null, endpoint, options) => throw null; + public ConditionalRequestClient(Uri endpoint, ConditionalRequestClientOptions options) => throw null; [Experimental("SCME0002")] - public ConditionalRequestClient(ConditionalRequestClientSettings settings) : this(AuthenticationPolicy.Create(settings), settings?.Endpoint, settings?.Options) => throw null; + public ConditionalRequestClient(ConditionalRequestClientSettings settings) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/special-headers/repeatability/src/Generated/RepeatabilityClient.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/special-headers/repeatability/src/Generated/RepeatabilityClient.cs index cff3310bcef..8dbfdce2d83 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/special-headers/repeatability/src/Generated/RepeatabilityClient.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/special-headers/repeatability/src/Generated/RepeatabilityClient.cs @@ -13,14 +13,12 @@ namespace SpecialHeaders.Repeatability { public partial class RepeatabilityClient { - public RepeatabilityClient() : this(new Uri("http://localhost:3000"), new RepeatabilityClientOptions()) => throw null; + public RepeatabilityClient() => throw null; - internal RepeatabilityClient(AuthenticationPolicy authenticationPolicy, Uri endpoint, RepeatabilityClientOptions options) => throw null; - - public RepeatabilityClient(Uri endpoint, RepeatabilityClientOptions options) : this(null, endpoint, options) => throw null; + public RepeatabilityClient(Uri endpoint, RepeatabilityClientOptions options) => throw null; [Experimental("SCME0002")] - public RepeatabilityClient(RepeatabilityClientSettings settings) : this(AuthenticationPolicy.Create(settings), settings?.Endpoint, settings?.Options) => throw null; + public RepeatabilityClient(RepeatabilityClientSettings settings) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/special-words/src/Generated/ModelProperties.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/special-words/src/Generated/ModelProperties.cs index 145be0ededd..76f4b999169 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/special-words/src/Generated/ModelProperties.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/special-words/src/Generated/ModelProperties.cs @@ -2,7 +2,6 @@ #nullable disable -using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -14,8 +13,6 @@ public partial class ModelProperties { protected ModelProperties() => throw null; - internal ModelProperties(ClientPipeline pipeline, Uri endpoint) => throw null; - public ClientPipeline Pipeline => throw null; public virtual ClientResult SameAsModel(BinaryContent content, RequestOptions options = null) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/special-words/src/Generated/Models.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/special-words/src/Generated/Models.cs index ec89fe4d3f7..af9e99fa778 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/special-words/src/Generated/Models.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/special-words/src/Generated/Models.cs @@ -2,7 +2,6 @@ #nullable disable -using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -14,8 +13,6 @@ public partial class Models { protected Models() => throw null; - internal Models(ClientPipeline pipeline, Uri endpoint) => throw null; - public ClientPipeline Pipeline => throw null; public virtual ClientResult WithAnd(BinaryContent content, RequestOptions options = null) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/special-words/src/Generated/Operations.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/special-words/src/Generated/Operations.cs index 1dfa7cdcfbe..bb367d9e0e7 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/special-words/src/Generated/Operations.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/special-words/src/Generated/Operations.cs @@ -2,7 +2,6 @@ #nullable disable -using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -14,8 +13,6 @@ public partial class Operations { protected Operations() => throw null; - internal Operations(ClientPipeline pipeline, Uri endpoint) => throw null; - public ClientPipeline Pipeline => throw null; public virtual ClientResult And(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/special-words/src/Generated/Parameters.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/special-words/src/Generated/Parameters.cs index fb1b60d7ad1..a489749d1a9 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/special-words/src/Generated/Parameters.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/special-words/src/Generated/Parameters.cs @@ -2,7 +2,6 @@ #nullable disable -using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -14,8 +13,6 @@ public partial class Parameters { protected Parameters() => throw null; - internal Parameters(ClientPipeline pipeline, Uri endpoint) => throw null; - public ClientPipeline Pipeline => throw null; public virtual ClientResult WithAnd(string @and, RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/special-words/src/Generated/SpecialWordsClient.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/special-words/src/Generated/SpecialWordsClient.cs index 92dda3fce4e..d984f1ee8b4 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/special-words/src/Generated/SpecialWordsClient.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/special-words/src/Generated/SpecialWordsClient.cs @@ -12,14 +12,12 @@ namespace SpecialWords { public partial class SpecialWordsClient { - public SpecialWordsClient() : this(new Uri("http://localhost:3000"), new SpecialWordsClientOptions()) => throw null; + public SpecialWordsClient() => throw null; - internal SpecialWordsClient(AuthenticationPolicy authenticationPolicy, Uri endpoint, SpecialWordsClientOptions options) => throw null; - - public SpecialWordsClient(Uri endpoint, SpecialWordsClientOptions options) : this(null, endpoint, options) => throw null; + public SpecialWordsClient(Uri endpoint, SpecialWordsClientOptions options) => throw null; [Experimental("SCME0002")] - public SpecialWordsClient(SpecialWordsClientSettings settings) : this(AuthenticationPolicy.Create(settings), settings?.Endpoint, settings?.Options) => throw null; + public SpecialWordsClient(SpecialWordsClientSettings settings) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/array/src/Generated/ArrayClient.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/array/src/Generated/ArrayClient.cs index 1597bfe32fb..a26f44fb210 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/array/src/Generated/ArrayClient.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/array/src/Generated/ArrayClient.cs @@ -10,14 +10,12 @@ namespace _Type._Array { public partial class ArrayClient { - public ArrayClient() : this(new Uri("http://localhost:3000"), new ArrayClientOptions()) => throw null; + public ArrayClient() => throw null; - internal ArrayClient(AuthenticationPolicy authenticationPolicy, Uri endpoint, ArrayClientOptions options) => throw null; - - public ArrayClient(Uri endpoint, ArrayClientOptions options) : this(null, endpoint, options) => throw null; + public ArrayClient(Uri endpoint, ArrayClientOptions options) => throw null; [Experimental("SCME0002")] - public ArrayClient(ArrayClientSettings settings) : this(AuthenticationPolicy.Create(settings), settings?.Endpoint, settings?.Options) => throw null; + public ArrayClient(ArrayClientSettings settings) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/array/src/Generated/BooleanValue.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/array/src/Generated/BooleanValue.cs index d290fed4d03..01b3af52309 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/array/src/Generated/BooleanValue.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/array/src/Generated/BooleanValue.cs @@ -2,7 +2,6 @@ #nullable disable -using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Collections.Generic; @@ -15,8 +14,6 @@ public partial class BooleanValue { protected BooleanValue() => throw null; - internal BooleanValue(ClientPipeline pipeline, Uri endpoint) => throw null; - public ClientPipeline Pipeline => throw null; public virtual ClientResult Get(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/array/src/Generated/DatetimeValue.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/array/src/Generated/DatetimeValue.cs index c7cd4718045..720dc85c07b 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/array/src/Generated/DatetimeValue.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/array/src/Generated/DatetimeValue.cs @@ -15,8 +15,6 @@ public partial class DatetimeValue { protected DatetimeValue() => throw null; - internal DatetimeValue(ClientPipeline pipeline, Uri endpoint) => throw null; - public ClientPipeline Pipeline => throw null; public virtual ClientResult Get(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/array/src/Generated/DurationValue.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/array/src/Generated/DurationValue.cs index d41e7956ded..2b2696da40c 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/array/src/Generated/DurationValue.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/array/src/Generated/DurationValue.cs @@ -15,8 +15,6 @@ public partial class DurationValue { protected DurationValue() => throw null; - internal DurationValue(ClientPipeline pipeline, Uri endpoint) => throw null; - public ClientPipeline Pipeline => throw null; public virtual ClientResult Get(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/array/src/Generated/Float32Value.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/array/src/Generated/Float32Value.cs index 139091b980e..56b5ffb2f95 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/array/src/Generated/Float32Value.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/array/src/Generated/Float32Value.cs @@ -2,7 +2,6 @@ #nullable disable -using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Collections.Generic; @@ -15,8 +14,6 @@ public partial class Float32Value { protected Float32Value() => throw null; - internal Float32Value(ClientPipeline pipeline, Uri endpoint) => throw null; - public ClientPipeline Pipeline => throw null; public virtual ClientResult Get(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/array/src/Generated/Int32Value.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/array/src/Generated/Int32Value.cs index b38525f6496..7babbc0f8f9 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/array/src/Generated/Int32Value.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/array/src/Generated/Int32Value.cs @@ -2,7 +2,6 @@ #nullable disable -using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Collections.Generic; @@ -15,8 +14,6 @@ public partial class Int32Value { protected Int32Value() => throw null; - internal Int32Value(ClientPipeline pipeline, Uri endpoint) => throw null; - public ClientPipeline Pipeline => throw null; public virtual ClientResult Get(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/array/src/Generated/Int64Value.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/array/src/Generated/Int64Value.cs index 952fb96e4cc..ba6f600bae1 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/array/src/Generated/Int64Value.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/array/src/Generated/Int64Value.cs @@ -2,7 +2,6 @@ #nullable disable -using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Collections.Generic; @@ -15,8 +14,6 @@ public partial class Int64Value { protected Int64Value() => throw null; - internal Int64Value(ClientPipeline pipeline, Uri endpoint) => throw null; - public ClientPipeline Pipeline => throw null; public virtual ClientResult Get(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/array/src/Generated/ModelValue.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/array/src/Generated/ModelValue.cs index 333dfabdcff..d842b2c8829 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/array/src/Generated/ModelValue.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/array/src/Generated/ModelValue.cs @@ -2,7 +2,6 @@ #nullable disable -using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Collections.Generic; @@ -15,8 +14,6 @@ public partial class ModelValue { protected ModelValue() => throw null; - internal ModelValue(ClientPipeline pipeline, Uri endpoint) => throw null; - public ClientPipeline Pipeline => throw null; public virtual ClientResult Get(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/array/src/Generated/NullableBooleanValue.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/array/src/Generated/NullableBooleanValue.cs index eb0177c832a..21c9ed002fe 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/array/src/Generated/NullableBooleanValue.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/array/src/Generated/NullableBooleanValue.cs @@ -2,7 +2,6 @@ #nullable disable -using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Collections.Generic; @@ -15,8 +14,6 @@ public partial class NullableBooleanValue { protected NullableBooleanValue() => throw null; - internal NullableBooleanValue(ClientPipeline pipeline, Uri endpoint) => throw null; - public ClientPipeline Pipeline => throw null; public virtual ClientResult Get(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/array/src/Generated/NullableFloatValue.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/array/src/Generated/NullableFloatValue.cs index ab401bf7739..dcfe8553721 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/array/src/Generated/NullableFloatValue.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/array/src/Generated/NullableFloatValue.cs @@ -2,7 +2,6 @@ #nullable disable -using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Collections.Generic; @@ -15,8 +14,6 @@ public partial class NullableFloatValue { protected NullableFloatValue() => throw null; - internal NullableFloatValue(ClientPipeline pipeline, Uri endpoint) => throw null; - public ClientPipeline Pipeline => throw null; public virtual ClientResult Get(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/array/src/Generated/NullableInt32Value.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/array/src/Generated/NullableInt32Value.cs index df168f64ea3..6aae5a6a603 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/array/src/Generated/NullableInt32Value.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/array/src/Generated/NullableInt32Value.cs @@ -2,7 +2,6 @@ #nullable disable -using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Collections.Generic; @@ -15,8 +14,6 @@ public partial class NullableInt32Value { protected NullableInt32Value() => throw null; - internal NullableInt32Value(ClientPipeline pipeline, Uri endpoint) => throw null; - public ClientPipeline Pipeline => throw null; public virtual ClientResult Get(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/array/src/Generated/NullableModelValue.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/array/src/Generated/NullableModelValue.cs index 336d4186bd1..bb14d5e8e9d 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/array/src/Generated/NullableModelValue.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/array/src/Generated/NullableModelValue.cs @@ -2,7 +2,6 @@ #nullable disable -using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Collections.Generic; @@ -15,8 +14,6 @@ public partial class NullableModelValue { protected NullableModelValue() => throw null; - internal NullableModelValue(ClientPipeline pipeline, Uri endpoint) => throw null; - public ClientPipeline Pipeline => throw null; public virtual ClientResult Get(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/array/src/Generated/NullableStringValue.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/array/src/Generated/NullableStringValue.cs index f22d0fb8493..490dd4aad6e 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/array/src/Generated/NullableStringValue.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/array/src/Generated/NullableStringValue.cs @@ -2,7 +2,6 @@ #nullable disable -using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Collections.Generic; @@ -15,8 +14,6 @@ public partial class NullableStringValue { protected NullableStringValue() => throw null; - internal NullableStringValue(ClientPipeline pipeline, Uri endpoint) => throw null; - public ClientPipeline Pipeline => throw null; public virtual ClientResult Get(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/array/src/Generated/StringValue.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/array/src/Generated/StringValue.cs index e330fa6ffa4..7d61138920c 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/array/src/Generated/StringValue.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/array/src/Generated/StringValue.cs @@ -2,7 +2,6 @@ #nullable disable -using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Collections.Generic; @@ -15,8 +14,6 @@ public partial class StringValue { protected StringValue() => throw null; - internal StringValue(ClientPipeline pipeline, Uri endpoint) => throw null; - public ClientPipeline Pipeline => throw null; public virtual ClientResult Get(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/array/src/Generated/UnknownValue.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/array/src/Generated/UnknownValue.cs index a049ca8e8b3..0fcbbd28461 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/array/src/Generated/UnknownValue.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/array/src/Generated/UnknownValue.cs @@ -15,8 +15,6 @@ public partial class UnknownValue { protected UnknownValue() => throw null; - internal UnknownValue(ClientPipeline pipeline, Uri endpoint) => throw null; - public ClientPipeline Pipeline => throw null; public virtual ClientResult Get(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/dictionary/src/Generated/BooleanValue.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/dictionary/src/Generated/BooleanValue.cs index f4727e78b82..8e54e093f42 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/dictionary/src/Generated/BooleanValue.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/dictionary/src/Generated/BooleanValue.cs @@ -2,7 +2,6 @@ #nullable disable -using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Collections.Generic; @@ -15,8 +14,6 @@ public partial class BooleanValue { protected BooleanValue() => throw null; - internal BooleanValue(ClientPipeline pipeline, Uri endpoint) => throw null; - public ClientPipeline Pipeline => throw null; public virtual ClientResult Get(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/dictionary/src/Generated/DatetimeValue.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/dictionary/src/Generated/DatetimeValue.cs index 03241999bc4..1063eabc942 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/dictionary/src/Generated/DatetimeValue.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/dictionary/src/Generated/DatetimeValue.cs @@ -15,8 +15,6 @@ public partial class DatetimeValue { protected DatetimeValue() => throw null; - internal DatetimeValue(ClientPipeline pipeline, Uri endpoint) => throw null; - public ClientPipeline Pipeline => throw null; public virtual ClientResult Get(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/dictionary/src/Generated/DictionaryClient.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/dictionary/src/Generated/DictionaryClient.cs index 54d7b564602..954c86817af 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/dictionary/src/Generated/DictionaryClient.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/dictionary/src/Generated/DictionaryClient.cs @@ -10,14 +10,12 @@ namespace _Type.Dictionary { public partial class DictionaryClient { - public DictionaryClient() : this(new Uri("http://localhost:3000"), new DictionaryClientOptions()) => throw null; + public DictionaryClient() => throw null; - internal DictionaryClient(AuthenticationPolicy authenticationPolicy, Uri endpoint, DictionaryClientOptions options) => throw null; - - public DictionaryClient(Uri endpoint, DictionaryClientOptions options) : this(null, endpoint, options) => throw null; + public DictionaryClient(Uri endpoint, DictionaryClientOptions options) => throw null; [Experimental("SCME0002")] - public DictionaryClient(DictionaryClientSettings settings) : this(AuthenticationPolicy.Create(settings), settings?.Endpoint, settings?.Options) => throw null; + public DictionaryClient(DictionaryClientSettings settings) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/dictionary/src/Generated/DurationValue.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/dictionary/src/Generated/DurationValue.cs index 025fb9260d0..677f6e3c69f 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/dictionary/src/Generated/DurationValue.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/dictionary/src/Generated/DurationValue.cs @@ -15,8 +15,6 @@ public partial class DurationValue { protected DurationValue() => throw null; - internal DurationValue(ClientPipeline pipeline, Uri endpoint) => throw null; - public ClientPipeline Pipeline => throw null; public virtual ClientResult Get(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/dictionary/src/Generated/Float32Value.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/dictionary/src/Generated/Float32Value.cs index bb5152ac021..89e188a1dfa 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/dictionary/src/Generated/Float32Value.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/dictionary/src/Generated/Float32Value.cs @@ -2,7 +2,6 @@ #nullable disable -using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Collections.Generic; @@ -15,8 +14,6 @@ public partial class Float32Value { protected Float32Value() => throw null; - internal Float32Value(ClientPipeline pipeline, Uri endpoint) => throw null; - public ClientPipeline Pipeline => throw null; public virtual ClientResult Get(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/dictionary/src/Generated/Int32Value.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/dictionary/src/Generated/Int32Value.cs index 943b687f046..1746503b91b 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/dictionary/src/Generated/Int32Value.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/dictionary/src/Generated/Int32Value.cs @@ -2,7 +2,6 @@ #nullable disable -using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Collections.Generic; @@ -15,8 +14,6 @@ public partial class Int32Value { protected Int32Value() => throw null; - internal Int32Value(ClientPipeline pipeline, Uri endpoint) => throw null; - public ClientPipeline Pipeline => throw null; public virtual ClientResult Get(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/dictionary/src/Generated/Int64Value.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/dictionary/src/Generated/Int64Value.cs index 7963141ea14..a86d59c62e2 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/dictionary/src/Generated/Int64Value.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/dictionary/src/Generated/Int64Value.cs @@ -2,7 +2,6 @@ #nullable disable -using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Collections.Generic; @@ -15,8 +14,6 @@ public partial class Int64Value { protected Int64Value() => throw null; - internal Int64Value(ClientPipeline pipeline, Uri endpoint) => throw null; - public ClientPipeline Pipeline => throw null; public virtual ClientResult Get(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/dictionary/src/Generated/ModelValue.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/dictionary/src/Generated/ModelValue.cs index 58bd7395fb9..becd3b219d2 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/dictionary/src/Generated/ModelValue.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/dictionary/src/Generated/ModelValue.cs @@ -2,7 +2,6 @@ #nullable disable -using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Collections.Generic; @@ -15,8 +14,6 @@ public partial class ModelValue { protected ModelValue() => throw null; - internal ModelValue(ClientPipeline pipeline, Uri endpoint) => throw null; - public ClientPipeline Pipeline => throw null; public virtual ClientResult Get(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/dictionary/src/Generated/NullableFloatValue.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/dictionary/src/Generated/NullableFloatValue.cs index b1b16591b20..bf6a1626799 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/dictionary/src/Generated/NullableFloatValue.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/dictionary/src/Generated/NullableFloatValue.cs @@ -2,7 +2,6 @@ #nullable disable -using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Collections.Generic; @@ -15,8 +14,6 @@ public partial class NullableFloatValue { protected NullableFloatValue() => throw null; - internal NullableFloatValue(ClientPipeline pipeline, Uri endpoint) => throw null; - public ClientPipeline Pipeline => throw null; public virtual ClientResult Get(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/dictionary/src/Generated/RecursiveModelValue.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/dictionary/src/Generated/RecursiveModelValue.cs index eb4eac17013..83cced869b4 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/dictionary/src/Generated/RecursiveModelValue.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/dictionary/src/Generated/RecursiveModelValue.cs @@ -2,7 +2,6 @@ #nullable disable -using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Collections.Generic; @@ -15,8 +14,6 @@ public partial class RecursiveModelValue { protected RecursiveModelValue() => throw null; - internal RecursiveModelValue(ClientPipeline pipeline, Uri endpoint) => throw null; - public ClientPipeline Pipeline => throw null; public virtual ClientResult Get(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/dictionary/src/Generated/StringValue.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/dictionary/src/Generated/StringValue.cs index 7fe039c683c..66b9650148f 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/dictionary/src/Generated/StringValue.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/dictionary/src/Generated/StringValue.cs @@ -2,7 +2,6 @@ #nullable disable -using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Collections.Generic; @@ -15,8 +14,6 @@ public partial class StringValue { protected StringValue() => throw null; - internal StringValue(ClientPipeline pipeline, Uri endpoint) => throw null; - public ClientPipeline Pipeline => throw null; public virtual ClientResult Get(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/dictionary/src/Generated/UnknownValue.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/dictionary/src/Generated/UnknownValue.cs index f91e8911853..4106f860d0b 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/dictionary/src/Generated/UnknownValue.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/dictionary/src/Generated/UnknownValue.cs @@ -15,8 +15,6 @@ public partial class UnknownValue { protected UnknownValue() => throw null; - internal UnknownValue(ClientPipeline pipeline, Uri endpoint) => throw null; - public ClientPipeline Pipeline => throw null; public virtual ClientResult Get(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/enum/extensible/src/Generated/ExtensibleClient.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/enum/extensible/src/Generated/ExtensibleClient.cs index 25a7ff8aa60..de60ac0c773 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/enum/extensible/src/Generated/ExtensibleClient.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/enum/extensible/src/Generated/ExtensibleClient.cs @@ -10,14 +10,12 @@ namespace _Type._Enum.Extensible { public partial class ExtensibleClient { - public ExtensibleClient() : this(new Uri("http://localhost:3000"), new ExtensibleClientOptions()) => throw null; + public ExtensibleClient() => throw null; - internal ExtensibleClient(AuthenticationPolicy authenticationPolicy, Uri endpoint, ExtensibleClientOptions options) => throw null; - - public ExtensibleClient(Uri endpoint, ExtensibleClientOptions options) : this(null, endpoint, options) => throw null; + public ExtensibleClient(Uri endpoint, ExtensibleClientOptions options) => throw null; [Experimental("SCME0002")] - public ExtensibleClient(ExtensibleClientSettings settings) : this(AuthenticationPolicy.Create(settings), settings?.Endpoint, settings?.Options) => throw null; + public ExtensibleClient(ExtensibleClientSettings settings) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/enum/extensible/src/Generated/String.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/enum/extensible/src/Generated/String.cs index 30632b37530..c4aadc25dce 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/enum/extensible/src/Generated/String.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/enum/extensible/src/Generated/String.cs @@ -2,7 +2,6 @@ #nullable disable -using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -14,8 +13,6 @@ public partial class String { protected String() => throw null; - internal String(ClientPipeline pipeline, Uri endpoint) => throw null; - public ClientPipeline Pipeline => throw null; public virtual ClientResult GetKnownValue(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/enum/fixed/src/Generated/FixedClient.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/enum/fixed/src/Generated/FixedClient.cs index b111aa81947..dd46f30d35b 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/enum/fixed/src/Generated/FixedClient.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/enum/fixed/src/Generated/FixedClient.cs @@ -10,14 +10,12 @@ namespace _Type._Enum.Fixed { public partial class FixedClient { - public FixedClient() : this(new Uri("http://localhost:3000"), new FixedClientOptions()) => throw null; + public FixedClient() => throw null; - internal FixedClient(AuthenticationPolicy authenticationPolicy, Uri endpoint, FixedClientOptions options) => throw null; - - public FixedClient(Uri endpoint, FixedClientOptions options) : this(null, endpoint, options) => throw null; + public FixedClient(Uri endpoint, FixedClientOptions options) => throw null; [Experimental("SCME0002")] - public FixedClient(FixedClientSettings settings) : this(AuthenticationPolicy.Create(settings), settings?.Endpoint, settings?.Options) => throw null; + public FixedClient(FixedClientSettings settings) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/enum/fixed/src/Generated/String.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/enum/fixed/src/Generated/String.cs index 056c892aa72..65c6edb1c24 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/enum/fixed/src/Generated/String.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/enum/fixed/src/Generated/String.cs @@ -2,7 +2,6 @@ #nullable disable -using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -14,8 +13,6 @@ public partial class String { protected String() => throw null; - internal String(ClientPipeline pipeline, Uri endpoint) => throw null; - public ClientPipeline Pipeline => throw null; public virtual ClientResult GetKnownValue(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/empty/src/Generated/EmptyClient.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/empty/src/Generated/EmptyClient.cs index 00f7325cbd9..3f68d005ac9 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/empty/src/Generated/EmptyClient.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/empty/src/Generated/EmptyClient.cs @@ -13,14 +13,12 @@ namespace _Type.Model.Empty { public partial class EmptyClient { - public EmptyClient() : this(new Uri("http://localhost:3000"), new EmptyClientOptions()) => throw null; + public EmptyClient() => throw null; - internal EmptyClient(AuthenticationPolicy authenticationPolicy, Uri endpoint, EmptyClientOptions options) => throw null; - - public EmptyClient(Uri endpoint, EmptyClientOptions options) : this(null, endpoint, options) => throw null; + public EmptyClient(Uri endpoint, EmptyClientOptions options) => throw null; [Experimental("SCME0002")] - public EmptyClient(EmptyClientSettings settings) : this(AuthenticationPolicy.Create(settings), settings?.Endpoint, settings?.Options) => throw null; + public EmptyClient(EmptyClientSettings settings) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/inheritance/enum-discriminator/src/Generated/EnumDiscriminatorClient.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/inheritance/enum-discriminator/src/Generated/EnumDiscriminatorClient.cs index ca37716df88..dd43e92dd04 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/inheritance/enum-discriminator/src/Generated/EnumDiscriminatorClient.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/inheritance/enum-discriminator/src/Generated/EnumDiscriminatorClient.cs @@ -13,14 +13,12 @@ namespace _Type.Model.Inheritance.EnumDiscriminator { public partial class EnumDiscriminatorClient { - public EnumDiscriminatorClient() : this(new Uri("http://localhost:3000"), new EnumDiscriminatorClientOptions()) => throw null; + public EnumDiscriminatorClient() => throw null; - internal EnumDiscriminatorClient(AuthenticationPolicy authenticationPolicy, Uri endpoint, EnumDiscriminatorClientOptions options) => throw null; - - public EnumDiscriminatorClient(Uri endpoint, EnumDiscriminatorClientOptions options) : this(null, endpoint, options) => throw null; + public EnumDiscriminatorClient(Uri endpoint, EnumDiscriminatorClientOptions options) => throw null; [Experimental("SCME0002")] - public EnumDiscriminatorClient(EnumDiscriminatorClientSettings settings) : this(AuthenticationPolicy.Create(settings), settings?.Endpoint, settings?.Options) => throw null; + public EnumDiscriminatorClient(EnumDiscriminatorClientSettings settings) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/inheritance/nested-discriminator/src/Generated/NestedDiscriminatorClient.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/inheritance/nested-discriminator/src/Generated/NestedDiscriminatorClient.cs index 7e5536731ab..684d514011f 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/inheritance/nested-discriminator/src/Generated/NestedDiscriminatorClient.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/inheritance/nested-discriminator/src/Generated/NestedDiscriminatorClient.cs @@ -13,14 +13,12 @@ namespace _Type.Model.Inheritance.NestedDiscriminator { public partial class NestedDiscriminatorClient { - public NestedDiscriminatorClient() : this(new Uri("http://localhost:3000"), new NestedDiscriminatorClientOptions()) => throw null; + public NestedDiscriminatorClient() => throw null; - internal NestedDiscriminatorClient(AuthenticationPolicy authenticationPolicy, Uri endpoint, NestedDiscriminatorClientOptions options) => throw null; - - public NestedDiscriminatorClient(Uri endpoint, NestedDiscriminatorClientOptions options) : this(null, endpoint, options) => throw null; + public NestedDiscriminatorClient(Uri endpoint, NestedDiscriminatorClientOptions options) => throw null; [Experimental("SCME0002")] - public NestedDiscriminatorClient(NestedDiscriminatorClientSettings settings) : this(AuthenticationPolicy.Create(settings), settings?.Endpoint, settings?.Options) => throw null; + public NestedDiscriminatorClient(NestedDiscriminatorClientSettings settings) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/inheritance/not-discriminated/src/Generated/NotDiscriminatedClient.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/inheritance/not-discriminated/src/Generated/NotDiscriminatedClient.cs index 4a7e240071e..0bcc1f95dfb 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/inheritance/not-discriminated/src/Generated/NotDiscriminatedClient.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/inheritance/not-discriminated/src/Generated/NotDiscriminatedClient.cs @@ -13,14 +13,12 @@ namespace _Type.Model.Inheritance.NotDiscriminated { public partial class NotDiscriminatedClient { - public NotDiscriminatedClient() : this(new Uri("http://localhost:3000"), new NotDiscriminatedClientOptions()) => throw null; + public NotDiscriminatedClient() => throw null; - internal NotDiscriminatedClient(AuthenticationPolicy authenticationPolicy, Uri endpoint, NotDiscriminatedClientOptions options) => throw null; - - public NotDiscriminatedClient(Uri endpoint, NotDiscriminatedClientOptions options) : this(null, endpoint, options) => throw null; + public NotDiscriminatedClient(Uri endpoint, NotDiscriminatedClientOptions options) => throw null; [Experimental("SCME0002")] - public NotDiscriminatedClient(NotDiscriminatedClientSettings settings) : this(AuthenticationPolicy.Create(settings), settings?.Endpoint, settings?.Options) => throw null; + public NotDiscriminatedClient(NotDiscriminatedClientSettings settings) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/inheritance/recursive/src/Generated/RecursiveClient.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/inheritance/recursive/src/Generated/RecursiveClient.cs index 1f429a7f058..953628d0fd7 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/inheritance/recursive/src/Generated/RecursiveClient.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/inheritance/recursive/src/Generated/RecursiveClient.cs @@ -13,14 +13,12 @@ namespace _Type.Model.Inheritance.Recursive { public partial class RecursiveClient { - public RecursiveClient() : this(new Uri("http://localhost:3000"), new RecursiveClientOptions()) => throw null; + public RecursiveClient() => throw null; - internal RecursiveClient(AuthenticationPolicy authenticationPolicy, Uri endpoint, RecursiveClientOptions options) => throw null; - - public RecursiveClient(Uri endpoint, RecursiveClientOptions options) : this(null, endpoint, options) => throw null; + public RecursiveClient(Uri endpoint, RecursiveClientOptions options) => throw null; [Experimental("SCME0002")] - public RecursiveClient(RecursiveClientSettings settings) : this(AuthenticationPolicy.Create(settings), settings?.Endpoint, settings?.Options) => throw null; + public RecursiveClient(RecursiveClientSettings settings) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/inheritance/single-discriminator/src/Generated/SingleDiscriminatorClient.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/inheritance/single-discriminator/src/Generated/SingleDiscriminatorClient.cs index d6a1a0eb170..9a61f48c26c 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/inheritance/single-discriminator/src/Generated/SingleDiscriminatorClient.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/inheritance/single-discriminator/src/Generated/SingleDiscriminatorClient.cs @@ -13,14 +13,12 @@ namespace _Type.Model.Inheritance.SingleDiscriminator { public partial class SingleDiscriminatorClient { - public SingleDiscriminatorClient() : this(new Uri("http://localhost:3000"), new SingleDiscriminatorClientOptions()) => throw null; + public SingleDiscriminatorClient() => throw null; - internal SingleDiscriminatorClient(AuthenticationPolicy authenticationPolicy, Uri endpoint, SingleDiscriminatorClientOptions options) => throw null; - - public SingleDiscriminatorClient(Uri endpoint, SingleDiscriminatorClientOptions options) : this(null, endpoint, options) => throw null; + public SingleDiscriminatorClient(Uri endpoint, SingleDiscriminatorClientOptions options) => throw null; [Experimental("SCME0002")] - public SingleDiscriminatorClient(SingleDiscriminatorClientSettings settings) : this(AuthenticationPolicy.Create(settings), settings?.Endpoint, settings?.Options) => throw null; + public SingleDiscriminatorClient(SingleDiscriminatorClientSettings settings) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/usage/src/Generated/UsageClient.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/usage/src/Generated/UsageClient.cs index b1571ae1df5..bdf727d844f 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/usage/src/Generated/UsageClient.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/usage/src/Generated/UsageClient.cs @@ -13,14 +13,12 @@ namespace _Type.Model.Usage { public partial class UsageClient { - public UsageClient() : this(new Uri("http://localhost:3000"), new UsageClientOptions()) => throw null; + public UsageClient() => throw null; - internal UsageClient(AuthenticationPolicy authenticationPolicy, Uri endpoint, UsageClientOptions options) => throw null; - - public UsageClient(Uri endpoint, UsageClientOptions options) : this(null, endpoint, options) => throw null; + public UsageClient(Uri endpoint, UsageClientOptions options) => throw null; [Experimental("SCME0002")] - public UsageClient(UsageClientSettings settings) : this(AuthenticationPolicy.Create(settings), settings?.Endpoint, settings?.Options) => throw null; + public UsageClient(UsageClientSettings settings) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/visibility/src/Generated/VisibilityClient.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/visibility/src/Generated/VisibilityClient.cs index dfb167036d6..a087e048518 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/visibility/src/Generated/VisibilityClient.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/visibility/src/Generated/VisibilityClient.cs @@ -13,14 +13,12 @@ namespace _Type.Model.Visibility { public partial class VisibilityClient { - public VisibilityClient() : this(new Uri("http://localhost:3000"), new VisibilityClientOptions()) => throw null; + public VisibilityClient() => throw null; - internal VisibilityClient(AuthenticationPolicy authenticationPolicy, Uri endpoint, VisibilityClientOptions options) => throw null; - - public VisibilityClient(Uri endpoint, VisibilityClientOptions options) : this(null, endpoint, options) => throw null; + public VisibilityClient(Uri endpoint, VisibilityClientOptions options) => throw null; [Experimental("SCME0002")] - public VisibilityClient(VisibilityClientSettings settings) : this(AuthenticationPolicy.Create(settings), settings?.Endpoint, settings?.Options) => throw null; + public VisibilityClient(VisibilityClientSettings settings) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/AdditionalPropertiesClient.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/AdditionalPropertiesClient.cs index 237007e44d6..e9ff0b3e5de 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/AdditionalPropertiesClient.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/AdditionalPropertiesClient.cs @@ -10,14 +10,12 @@ namespace _Type.Property.AdditionalProperties { public partial class AdditionalPropertiesClient { - public AdditionalPropertiesClient() : this(new Uri("http://localhost:3000"), new AdditionalPropertiesClientOptions()) => throw null; + public AdditionalPropertiesClient() => throw null; - internal AdditionalPropertiesClient(AuthenticationPolicy authenticationPolicy, Uri endpoint, AdditionalPropertiesClientOptions options) => throw null; - - public AdditionalPropertiesClient(Uri endpoint, AdditionalPropertiesClientOptions options) : this(null, endpoint, options) => throw null; + public AdditionalPropertiesClient(Uri endpoint, AdditionalPropertiesClientOptions options) => throw null; [Experimental("SCME0002")] - public AdditionalPropertiesClient(AdditionalPropertiesClientSettings settings) : this(AuthenticationPolicy.Create(settings), settings?.Endpoint, settings?.Options) => throw null; + public AdditionalPropertiesClient(AdditionalPropertiesClientSettings settings) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/ExtendsDifferentSpreadFloat.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/ExtendsDifferentSpreadFloat.cs index aa298158cb9..3711caec903 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/ExtendsDifferentSpreadFloat.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/ExtendsDifferentSpreadFloat.cs @@ -2,7 +2,6 @@ #nullable disable -using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -14,8 +13,6 @@ public partial class ExtendsDifferentSpreadFloat { protected ExtendsDifferentSpreadFloat() => throw null; - internal ExtendsDifferentSpreadFloat(ClientPipeline pipeline, Uri endpoint) => throw null; - public ClientPipeline Pipeline => throw null; public virtual ClientResult Get(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/ExtendsDifferentSpreadModel.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/ExtendsDifferentSpreadModel.cs index eaf913f4276..16952422f03 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/ExtendsDifferentSpreadModel.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/ExtendsDifferentSpreadModel.cs @@ -2,7 +2,6 @@ #nullable disable -using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -14,8 +13,6 @@ public partial class ExtendsDifferentSpreadModel { protected ExtendsDifferentSpreadModel() => throw null; - internal ExtendsDifferentSpreadModel(ClientPipeline pipeline, Uri endpoint) => throw null; - public ClientPipeline Pipeline => throw null; public virtual ClientResult Get(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/ExtendsDifferentSpreadModelArray.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/ExtendsDifferentSpreadModelArray.cs index 2aacfeb2d02..cafdfaa177b 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/ExtendsDifferentSpreadModelArray.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/ExtendsDifferentSpreadModelArray.cs @@ -2,7 +2,6 @@ #nullable disable -using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -14,8 +13,6 @@ public partial class ExtendsDifferentSpreadModelArray { protected ExtendsDifferentSpreadModelArray() => throw null; - internal ExtendsDifferentSpreadModelArray(ClientPipeline pipeline, Uri endpoint) => throw null; - public ClientPipeline Pipeline => throw null; public virtual ClientResult Get(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/ExtendsDifferentSpreadString.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/ExtendsDifferentSpreadString.cs index 3ee0ddc45c5..14de43be0c4 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/ExtendsDifferentSpreadString.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/ExtendsDifferentSpreadString.cs @@ -2,7 +2,6 @@ #nullable disable -using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -14,8 +13,6 @@ public partial class ExtendsDifferentSpreadString { protected ExtendsDifferentSpreadString() => throw null; - internal ExtendsDifferentSpreadString(ClientPipeline pipeline, Uri endpoint) => throw null; - public ClientPipeline Pipeline => throw null; public virtual ClientResult Get(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/ExtendsFloat.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/ExtendsFloat.cs index 6f55bee1976..db8c90aa883 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/ExtendsFloat.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/ExtendsFloat.cs @@ -2,7 +2,6 @@ #nullable disable -using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -14,8 +13,6 @@ public partial class ExtendsFloat { protected ExtendsFloat() => throw null; - internal ExtendsFloat(ClientPipeline pipeline, Uri endpoint) => throw null; - public ClientPipeline Pipeline => throw null; public virtual ClientResult Get(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/ExtendsModel.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/ExtendsModel.cs index a3e6a49c40f..fc3605496dc 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/ExtendsModel.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/ExtendsModel.cs @@ -2,7 +2,6 @@ #nullable disable -using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -14,8 +13,6 @@ public partial class ExtendsModel { protected ExtendsModel() => throw null; - internal ExtendsModel(ClientPipeline pipeline, Uri endpoint) => throw null; - public ClientPipeline Pipeline => throw null; public virtual ClientResult Get(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/ExtendsModelArray.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/ExtendsModelArray.cs index 1da8aae31d1..9fac072dc49 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/ExtendsModelArray.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/ExtendsModelArray.cs @@ -2,7 +2,6 @@ #nullable disable -using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -14,8 +13,6 @@ public partial class ExtendsModelArray { protected ExtendsModelArray() => throw null; - internal ExtendsModelArray(ClientPipeline pipeline, Uri endpoint) => throw null; - public ClientPipeline Pipeline => throw null; public virtual ClientResult Get(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/ExtendsString.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/ExtendsString.cs index 13a5fbf8c13..25a8bce5e84 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/ExtendsString.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/ExtendsString.cs @@ -2,7 +2,6 @@ #nullable disable -using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -14,8 +13,6 @@ public partial class ExtendsString { protected ExtendsString() => throw null; - internal ExtendsString(ClientPipeline pipeline, Uri endpoint) => throw null; - public ClientPipeline Pipeline => throw null; public virtual ClientResult Get(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/ExtendsUnknown.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/ExtendsUnknown.cs index 6e539221d9b..3beb5baea3f 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/ExtendsUnknown.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/ExtendsUnknown.cs @@ -2,7 +2,6 @@ #nullable disable -using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -14,8 +13,6 @@ public partial class ExtendsUnknown { protected ExtendsUnknown() => throw null; - internal ExtendsUnknown(ClientPipeline pipeline, Uri endpoint) => throw null; - public ClientPipeline Pipeline => throw null; public virtual ClientResult Get(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/ExtendsUnknownDerived.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/ExtendsUnknownDerived.cs index f1636a68905..1ba9e2819a5 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/ExtendsUnknownDerived.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/ExtendsUnknownDerived.cs @@ -2,7 +2,6 @@ #nullable disable -using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -14,8 +13,6 @@ public partial class ExtendsUnknownDerived { protected ExtendsUnknownDerived() => throw null; - internal ExtendsUnknownDerived(ClientPipeline pipeline, Uri endpoint) => throw null; - public ClientPipeline Pipeline => throw null; public virtual ClientResult Get(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/ExtendsUnknownDiscriminated.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/ExtendsUnknownDiscriminated.cs index 261d9de0a04..dddd20125ee 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/ExtendsUnknownDiscriminated.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/ExtendsUnknownDiscriminated.cs @@ -2,7 +2,6 @@ #nullable disable -using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -14,8 +13,6 @@ public partial class ExtendsUnknownDiscriminated { protected ExtendsUnknownDiscriminated() => throw null; - internal ExtendsUnknownDiscriminated(ClientPipeline pipeline, Uri endpoint) => throw null; - public ClientPipeline Pipeline => throw null; public virtual ClientResult Get(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/IsFloat.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/IsFloat.cs index 8be79e2ef26..74284e4cd58 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/IsFloat.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/IsFloat.cs @@ -2,7 +2,6 @@ #nullable disable -using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -14,8 +13,6 @@ public partial class IsFloat { protected IsFloat() => throw null; - internal IsFloat(ClientPipeline pipeline, Uri endpoint) => throw null; - public ClientPipeline Pipeline => throw null; public virtual ClientResult Get(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/IsModel.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/IsModel.cs index 65a3fa72022..035ee852f98 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/IsModel.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/IsModel.cs @@ -2,7 +2,6 @@ #nullable disable -using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -14,8 +13,6 @@ public partial class IsModel { protected IsModel() => throw null; - internal IsModel(ClientPipeline pipeline, Uri endpoint) => throw null; - public ClientPipeline Pipeline => throw null; public virtual ClientResult Get(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/IsModelArray.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/IsModelArray.cs index a4a639ee799..cb2785116e5 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/IsModelArray.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/IsModelArray.cs @@ -2,7 +2,6 @@ #nullable disable -using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -14,8 +13,6 @@ public partial class IsModelArray { protected IsModelArray() => throw null; - internal IsModelArray(ClientPipeline pipeline, Uri endpoint) => throw null; - public ClientPipeline Pipeline => throw null; public virtual ClientResult Get(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/IsString.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/IsString.cs index 10718fca333..6281cebe5bc 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/IsString.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/IsString.cs @@ -2,7 +2,6 @@ #nullable disable -using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -14,8 +13,6 @@ public partial class IsString { protected IsString() => throw null; - internal IsString(ClientPipeline pipeline, Uri endpoint) => throw null; - public ClientPipeline Pipeline => throw null; public virtual ClientResult Get(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/IsUnknown.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/IsUnknown.cs index 19c46424094..756f70c38ba 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/IsUnknown.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/IsUnknown.cs @@ -2,7 +2,6 @@ #nullable disable -using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -14,8 +13,6 @@ public partial class IsUnknown { protected IsUnknown() => throw null; - internal IsUnknown(ClientPipeline pipeline, Uri endpoint) => throw null; - public ClientPipeline Pipeline => throw null; public virtual ClientResult Get(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/IsUnknownDerived.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/IsUnknownDerived.cs index 50e217613ef..c60981109bc 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/IsUnknownDerived.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/IsUnknownDerived.cs @@ -2,7 +2,6 @@ #nullable disable -using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -14,8 +13,6 @@ public partial class IsUnknownDerived { protected IsUnknownDerived() => throw null; - internal IsUnknownDerived(ClientPipeline pipeline, Uri endpoint) => throw null; - public ClientPipeline Pipeline => throw null; public virtual ClientResult Get(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/IsUnknownDiscriminated.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/IsUnknownDiscriminated.cs index f6470550016..3686c8c898c 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/IsUnknownDiscriminated.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/IsUnknownDiscriminated.cs @@ -2,7 +2,6 @@ #nullable disable -using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -14,8 +13,6 @@ public partial class IsUnknownDiscriminated { protected IsUnknownDiscriminated() => throw null; - internal IsUnknownDiscriminated(ClientPipeline pipeline, Uri endpoint) => throw null; - public ClientPipeline Pipeline => throw null; public virtual ClientResult Get(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/MultipleSpread.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/MultipleSpread.cs index 47355266fd2..9b081a1a362 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/MultipleSpread.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/MultipleSpread.cs @@ -2,7 +2,6 @@ #nullable disable -using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -14,8 +13,6 @@ public partial class MultipleSpread { protected MultipleSpread() => throw null; - internal MultipleSpread(ClientPipeline pipeline, Uri endpoint) => throw null; - public ClientPipeline Pipeline => throw null; public virtual ClientResult Get(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/SpreadDifferentFloat.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/SpreadDifferentFloat.cs index 33d2e052e33..f86ae0c3e6e 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/SpreadDifferentFloat.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/SpreadDifferentFloat.cs @@ -2,7 +2,6 @@ #nullable disable -using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -14,8 +13,6 @@ public partial class SpreadDifferentFloat { protected SpreadDifferentFloat() => throw null; - internal SpreadDifferentFloat(ClientPipeline pipeline, Uri endpoint) => throw null; - public ClientPipeline Pipeline => throw null; public virtual ClientResult Get(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/SpreadDifferentModel.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/SpreadDifferentModel.cs index a69132c7526..0ba5c6d4854 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/SpreadDifferentModel.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/SpreadDifferentModel.cs @@ -2,7 +2,6 @@ #nullable disable -using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -14,8 +13,6 @@ public partial class SpreadDifferentModel { protected SpreadDifferentModel() => throw null; - internal SpreadDifferentModel(ClientPipeline pipeline, Uri endpoint) => throw null; - public ClientPipeline Pipeline => throw null; public virtual ClientResult Get(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/SpreadDifferentModelArray.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/SpreadDifferentModelArray.cs index 5c6d809aa7c..0d1cd493e84 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/SpreadDifferentModelArray.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/SpreadDifferentModelArray.cs @@ -2,7 +2,6 @@ #nullable disable -using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -14,8 +13,6 @@ public partial class SpreadDifferentModelArray { protected SpreadDifferentModelArray() => throw null; - internal SpreadDifferentModelArray(ClientPipeline pipeline, Uri endpoint) => throw null; - public ClientPipeline Pipeline => throw null; public virtual ClientResult Get(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/SpreadDifferentString.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/SpreadDifferentString.cs index 4123898a1ec..d990d8ba2c3 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/SpreadDifferentString.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/SpreadDifferentString.cs @@ -2,7 +2,6 @@ #nullable disable -using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -14,8 +13,6 @@ public partial class SpreadDifferentString { protected SpreadDifferentString() => throw null; - internal SpreadDifferentString(ClientPipeline pipeline, Uri endpoint) => throw null; - public ClientPipeline Pipeline => throw null; public virtual ClientResult Get(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/SpreadFloat.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/SpreadFloat.cs index a529e2b406f..a97ea7ff831 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/SpreadFloat.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/SpreadFloat.cs @@ -2,7 +2,6 @@ #nullable disable -using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -14,8 +13,6 @@ public partial class SpreadFloat { protected SpreadFloat() => throw null; - internal SpreadFloat(ClientPipeline pipeline, Uri endpoint) => throw null; - public ClientPipeline Pipeline => throw null; public virtual ClientResult Get(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/SpreadModel.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/SpreadModel.cs index 002a15917bc..3db2515a716 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/SpreadModel.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/SpreadModel.cs @@ -2,7 +2,6 @@ #nullable disable -using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -14,8 +13,6 @@ public partial class SpreadModel { protected SpreadModel() => throw null; - internal SpreadModel(ClientPipeline pipeline, Uri endpoint) => throw null; - public ClientPipeline Pipeline => throw null; public virtual ClientResult Get(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/SpreadModelArray.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/SpreadModelArray.cs index bdc347b9941..aec0c659e11 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/SpreadModelArray.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/SpreadModelArray.cs @@ -2,7 +2,6 @@ #nullable disable -using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -14,8 +13,6 @@ public partial class SpreadModelArray { protected SpreadModelArray() => throw null; - internal SpreadModelArray(ClientPipeline pipeline, Uri endpoint) => throw null; - public ClientPipeline Pipeline => throw null; public virtual ClientResult Get(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/SpreadRecordNonDiscriminatedUnion.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/SpreadRecordNonDiscriminatedUnion.cs index dfd6786a0ab..89de049334c 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/SpreadRecordNonDiscriminatedUnion.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/SpreadRecordNonDiscriminatedUnion.cs @@ -2,7 +2,6 @@ #nullable disable -using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -14,8 +13,6 @@ public partial class SpreadRecordNonDiscriminatedUnion { protected SpreadRecordNonDiscriminatedUnion() => throw null; - internal SpreadRecordNonDiscriminatedUnion(ClientPipeline pipeline, Uri endpoint) => throw null; - public ClientPipeline Pipeline => throw null; public virtual ClientResult Get(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/SpreadRecordNonDiscriminatedUnion2.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/SpreadRecordNonDiscriminatedUnion2.cs index d33e1a547dc..e78b2929cd9 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/SpreadRecordNonDiscriminatedUnion2.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/SpreadRecordNonDiscriminatedUnion2.cs @@ -2,7 +2,6 @@ #nullable disable -using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -14,8 +13,6 @@ public partial class SpreadRecordNonDiscriminatedUnion2 { protected SpreadRecordNonDiscriminatedUnion2() => throw null; - internal SpreadRecordNonDiscriminatedUnion2(ClientPipeline pipeline, Uri endpoint) => throw null; - public ClientPipeline Pipeline => throw null; public virtual ClientResult Get(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/SpreadRecordNonDiscriminatedUnion3.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/SpreadRecordNonDiscriminatedUnion3.cs index 76b3cf8b1fe..ecb9285fa4e 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/SpreadRecordNonDiscriminatedUnion3.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/SpreadRecordNonDiscriminatedUnion3.cs @@ -2,7 +2,6 @@ #nullable disable -using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -14,8 +13,6 @@ public partial class SpreadRecordNonDiscriminatedUnion3 { protected SpreadRecordNonDiscriminatedUnion3() => throw null; - internal SpreadRecordNonDiscriminatedUnion3(ClientPipeline pipeline, Uri endpoint) => throw null; - public ClientPipeline Pipeline => throw null; public virtual ClientResult Get(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/SpreadRecordUnion.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/SpreadRecordUnion.cs index 97de92c85f4..7cc11db7439 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/SpreadRecordUnion.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/SpreadRecordUnion.cs @@ -2,7 +2,6 @@ #nullable disable -using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -14,8 +13,6 @@ public partial class SpreadRecordUnion { protected SpreadRecordUnion() => throw null; - internal SpreadRecordUnion(ClientPipeline pipeline, Uri endpoint) => throw null; - public ClientPipeline Pipeline => throw null; public virtual ClientResult Get(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/SpreadString.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/SpreadString.cs index 4864d532e5a..2c4d33288de 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/SpreadString.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/SpreadString.cs @@ -2,7 +2,6 @@ #nullable disable -using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -14,8 +13,6 @@ public partial class SpreadString { protected SpreadString() => throw null; - internal SpreadString(ClientPipeline pipeline, Uri endpoint) => throw null; - public ClientPipeline Pipeline => throw null; public virtual ClientResult Get(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/nullable/src/Generated/Bytes.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/nullable/src/Generated/Bytes.cs index 4e6ff0b6f10..eacf8814b15 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/nullable/src/Generated/Bytes.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/nullable/src/Generated/Bytes.cs @@ -2,7 +2,6 @@ #nullable disable -using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -14,8 +13,6 @@ public partial class Bytes { protected Bytes() => throw null; - internal Bytes(ClientPipeline pipeline, Uri endpoint) => throw null; - public ClientPipeline Pipeline => throw null; public virtual ClientResult GetNonNull(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/nullable/src/Generated/CollectionsByte.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/nullable/src/Generated/CollectionsByte.cs index 147ed22adef..ad2cd996943 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/nullable/src/Generated/CollectionsByte.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/nullable/src/Generated/CollectionsByte.cs @@ -2,7 +2,6 @@ #nullable disable -using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -14,8 +13,6 @@ public partial class CollectionsByte { protected CollectionsByte() => throw null; - internal CollectionsByte(ClientPipeline pipeline, Uri endpoint) => throw null; - public ClientPipeline Pipeline => throw null; public virtual ClientResult GetNonNull(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/nullable/src/Generated/CollectionsModel.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/nullable/src/Generated/CollectionsModel.cs index a2cb3752dd3..a424dcc6309 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/nullable/src/Generated/CollectionsModel.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/nullable/src/Generated/CollectionsModel.cs @@ -2,7 +2,6 @@ #nullable disable -using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -14,8 +13,6 @@ public partial class CollectionsModel { protected CollectionsModel() => throw null; - internal CollectionsModel(ClientPipeline pipeline, Uri endpoint) => throw null; - public ClientPipeline Pipeline => throw null; public virtual ClientResult GetNonNull(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/nullable/src/Generated/CollectionsString.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/nullable/src/Generated/CollectionsString.cs index 9ebdb4ed447..3481b5221d5 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/nullable/src/Generated/CollectionsString.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/nullable/src/Generated/CollectionsString.cs @@ -2,7 +2,6 @@ #nullable disable -using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -14,8 +13,6 @@ public partial class CollectionsString { protected CollectionsString() => throw null; - internal CollectionsString(ClientPipeline pipeline, Uri endpoint) => throw null; - public ClientPipeline Pipeline => throw null; public virtual ClientResult GetNonNull(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/nullable/src/Generated/Datetime.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/nullable/src/Generated/Datetime.cs index 65fd66ab449..2d316f989b4 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/nullable/src/Generated/Datetime.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/nullable/src/Generated/Datetime.cs @@ -2,7 +2,6 @@ #nullable disable -using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -14,8 +13,6 @@ public partial class Datetime { protected Datetime() => throw null; - internal Datetime(ClientPipeline pipeline, Uri endpoint) => throw null; - public ClientPipeline Pipeline => throw null; public virtual ClientResult GetNonNull(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/nullable/src/Generated/Duration.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/nullable/src/Generated/Duration.cs index d1091acfe3d..5436a4fda27 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/nullable/src/Generated/Duration.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/nullable/src/Generated/Duration.cs @@ -2,7 +2,6 @@ #nullable disable -using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -14,8 +13,6 @@ public partial class Duration { protected Duration() => throw null; - internal Duration(ClientPipeline pipeline, Uri endpoint) => throw null; - public ClientPipeline Pipeline => throw null; public virtual ClientResult GetNonNull(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/nullable/src/Generated/NullableClient.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/nullable/src/Generated/NullableClient.cs index af9921af400..f99a66ed7c2 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/nullable/src/Generated/NullableClient.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/nullable/src/Generated/NullableClient.cs @@ -10,14 +10,12 @@ namespace _Type.Property.Nullable { public partial class NullableClient { - public NullableClient() : this(new Uri("http://localhost:3000"), new NullableClientOptions()) => throw null; + public NullableClient() => throw null; - internal NullableClient(AuthenticationPolicy authenticationPolicy, Uri endpoint, NullableClientOptions options) => throw null; - - public NullableClient(Uri endpoint, NullableClientOptions options) : this(null, endpoint, options) => throw null; + public NullableClient(Uri endpoint, NullableClientOptions options) => throw null; [Experimental("SCME0002")] - public NullableClient(NullableClientSettings settings) : this(AuthenticationPolicy.Create(settings), settings?.Endpoint, settings?.Options) => throw null; + public NullableClient(NullableClientSettings settings) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/nullable/src/Generated/String.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/nullable/src/Generated/String.cs index 786c381fb0b..461ad9d615b 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/nullable/src/Generated/String.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/nullable/src/Generated/String.cs @@ -2,7 +2,6 @@ #nullable disable -using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -14,8 +13,6 @@ public partial class String { protected String() => throw null; - internal String(ClientPipeline pipeline, Uri endpoint) => throw null; - public ClientPipeline Pipeline => throw null; public virtual ClientResult GetNonNull(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/optionality/src/Generated/BooleanLiteral.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/optionality/src/Generated/BooleanLiteral.cs index 6dca0711f46..593e92d4244 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/optionality/src/Generated/BooleanLiteral.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/optionality/src/Generated/BooleanLiteral.cs @@ -2,7 +2,6 @@ #nullable disable -using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -14,8 +13,6 @@ public partial class BooleanLiteral { protected BooleanLiteral() => throw null; - internal BooleanLiteral(ClientPipeline pipeline, Uri endpoint) => throw null; - public ClientPipeline Pipeline => throw null; public virtual ClientResult GetAll(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/optionality/src/Generated/Bytes.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/optionality/src/Generated/Bytes.cs index 44c535cc253..b4d7e3788e8 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/optionality/src/Generated/Bytes.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/optionality/src/Generated/Bytes.cs @@ -2,7 +2,6 @@ #nullable disable -using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -14,8 +13,6 @@ public partial class Bytes { protected Bytes() => throw null; - internal Bytes(ClientPipeline pipeline, Uri endpoint) => throw null; - public ClientPipeline Pipeline => throw null; public virtual ClientResult GetAll(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/optionality/src/Generated/CollectionsByte.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/optionality/src/Generated/CollectionsByte.cs index 808a6ca8b49..706f6515fc5 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/optionality/src/Generated/CollectionsByte.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/optionality/src/Generated/CollectionsByte.cs @@ -2,7 +2,6 @@ #nullable disable -using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -14,8 +13,6 @@ public partial class CollectionsByte { protected CollectionsByte() => throw null; - internal CollectionsByte(ClientPipeline pipeline, Uri endpoint) => throw null; - public ClientPipeline Pipeline => throw null; public virtual ClientResult GetAll(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/optionality/src/Generated/CollectionsModel.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/optionality/src/Generated/CollectionsModel.cs index 00be1dcec43..dfe28feac96 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/optionality/src/Generated/CollectionsModel.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/optionality/src/Generated/CollectionsModel.cs @@ -2,7 +2,6 @@ #nullable disable -using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -14,8 +13,6 @@ public partial class CollectionsModel { protected CollectionsModel() => throw null; - internal CollectionsModel(ClientPipeline pipeline, Uri endpoint) => throw null; - public ClientPipeline Pipeline => throw null; public virtual ClientResult GetAll(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/optionality/src/Generated/Datetime.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/optionality/src/Generated/Datetime.cs index 3b2e4f0017b..5e578c2da19 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/optionality/src/Generated/Datetime.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/optionality/src/Generated/Datetime.cs @@ -2,7 +2,6 @@ #nullable disable -using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -14,8 +13,6 @@ public partial class Datetime { protected Datetime() => throw null; - internal Datetime(ClientPipeline pipeline, Uri endpoint) => throw null; - public ClientPipeline Pipeline => throw null; public virtual ClientResult GetAll(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/optionality/src/Generated/Duration.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/optionality/src/Generated/Duration.cs index 9a9c63ae762..03d2758ff8a 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/optionality/src/Generated/Duration.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/optionality/src/Generated/Duration.cs @@ -2,7 +2,6 @@ #nullable disable -using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -14,8 +13,6 @@ public partial class Duration { protected Duration() => throw null; - internal Duration(ClientPipeline pipeline, Uri endpoint) => throw null; - public ClientPipeline Pipeline => throw null; public virtual ClientResult GetAll(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/optionality/src/Generated/FloatLiteral.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/optionality/src/Generated/FloatLiteral.cs index f7504a61cf2..7d71a102cd8 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/optionality/src/Generated/FloatLiteral.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/optionality/src/Generated/FloatLiteral.cs @@ -2,7 +2,6 @@ #nullable disable -using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -14,8 +13,6 @@ public partial class FloatLiteral { protected FloatLiteral() => throw null; - internal FloatLiteral(ClientPipeline pipeline, Uri endpoint) => throw null; - public ClientPipeline Pipeline => throw null; public virtual ClientResult GetAll(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/optionality/src/Generated/IntLiteral.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/optionality/src/Generated/IntLiteral.cs index 3309e35bfe2..5f5db298391 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/optionality/src/Generated/IntLiteral.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/optionality/src/Generated/IntLiteral.cs @@ -2,7 +2,6 @@ #nullable disable -using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -14,8 +13,6 @@ public partial class IntLiteral { protected IntLiteral() => throw null; - internal IntLiteral(ClientPipeline pipeline, Uri endpoint) => throw null; - public ClientPipeline Pipeline => throw null; public virtual ClientResult GetAll(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/optionality/src/Generated/OptionalClient.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/optionality/src/Generated/OptionalClient.cs index 359640c4a3f..e8c62cd3c3b 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/optionality/src/Generated/OptionalClient.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/optionality/src/Generated/OptionalClient.cs @@ -10,14 +10,12 @@ namespace _Type.Property.Optional { public partial class OptionalClient { - public OptionalClient() : this(new Uri("http://localhost:3000"), new OptionalClientOptions()) => throw null; + public OptionalClient() => throw null; - internal OptionalClient(AuthenticationPolicy authenticationPolicy, Uri endpoint, OptionalClientOptions options) => throw null; - - public OptionalClient(Uri endpoint, OptionalClientOptions options) : this(null, endpoint, options) => throw null; + public OptionalClient(Uri endpoint, OptionalClientOptions options) => throw null; [Experimental("SCME0002")] - public OptionalClient(OptionalClientSettings settings) : this(AuthenticationPolicy.Create(settings), settings?.Endpoint, settings?.Options) => throw null; + public OptionalClient(OptionalClientSettings settings) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/optionality/src/Generated/PlainDate.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/optionality/src/Generated/PlainDate.cs index f95ec369404..27c9d8c861b 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/optionality/src/Generated/PlainDate.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/optionality/src/Generated/PlainDate.cs @@ -2,7 +2,6 @@ #nullable disable -using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -14,8 +13,6 @@ public partial class PlainDate { protected PlainDate() => throw null; - internal PlainDate(ClientPipeline pipeline, Uri endpoint) => throw null; - public ClientPipeline Pipeline => throw null; public virtual ClientResult GetAll(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/optionality/src/Generated/PlainTime.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/optionality/src/Generated/PlainTime.cs index 91c30419caf..733f618e280 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/optionality/src/Generated/PlainTime.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/optionality/src/Generated/PlainTime.cs @@ -2,7 +2,6 @@ #nullable disable -using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -14,8 +13,6 @@ public partial class PlainTime { protected PlainTime() => throw null; - internal PlainTime(ClientPipeline pipeline, Uri endpoint) => throw null; - public ClientPipeline Pipeline => throw null; public virtual ClientResult GetAll(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/optionality/src/Generated/RequiredAndOptional.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/optionality/src/Generated/RequiredAndOptional.cs index 3253e5b109d..94bf40cd0f3 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/optionality/src/Generated/RequiredAndOptional.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/optionality/src/Generated/RequiredAndOptional.cs @@ -2,7 +2,6 @@ #nullable disable -using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -14,8 +13,6 @@ public partial class RequiredAndOptional { protected RequiredAndOptional() => throw null; - internal RequiredAndOptional(ClientPipeline pipeline, Uri endpoint) => throw null; - public ClientPipeline Pipeline => throw null; public virtual ClientResult GetAll(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/optionality/src/Generated/String.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/optionality/src/Generated/String.cs index def30985883..223187bfb1e 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/optionality/src/Generated/String.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/optionality/src/Generated/String.cs @@ -2,7 +2,6 @@ #nullable disable -using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -14,8 +13,6 @@ public partial class String { protected String() => throw null; - internal String(ClientPipeline pipeline, Uri endpoint) => throw null; - public ClientPipeline Pipeline => throw null; public virtual ClientResult GetAll(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/optionality/src/Generated/StringLiteral.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/optionality/src/Generated/StringLiteral.cs index a60ba46a07e..d6fca1040c1 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/optionality/src/Generated/StringLiteral.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/optionality/src/Generated/StringLiteral.cs @@ -2,7 +2,6 @@ #nullable disable -using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -14,8 +13,6 @@ public partial class StringLiteral { protected StringLiteral() => throw null; - internal StringLiteral(ClientPipeline pipeline, Uri endpoint) => throw null; - public ClientPipeline Pipeline => throw null; public virtual ClientResult GetAll(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/optionality/src/Generated/UnionFloatLiteral.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/optionality/src/Generated/UnionFloatLiteral.cs index 9471446beff..aa088f014e9 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/optionality/src/Generated/UnionFloatLiteral.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/optionality/src/Generated/UnionFloatLiteral.cs @@ -2,7 +2,6 @@ #nullable disable -using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -14,8 +13,6 @@ public partial class UnionFloatLiteral { protected UnionFloatLiteral() => throw null; - internal UnionFloatLiteral(ClientPipeline pipeline, Uri endpoint) => throw null; - public ClientPipeline Pipeline => throw null; public virtual ClientResult GetAll(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/optionality/src/Generated/UnionIntLiteral.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/optionality/src/Generated/UnionIntLiteral.cs index 45324fc4c4d..65a65dc54ce 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/optionality/src/Generated/UnionIntLiteral.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/optionality/src/Generated/UnionIntLiteral.cs @@ -2,7 +2,6 @@ #nullable disable -using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -14,8 +13,6 @@ public partial class UnionIntLiteral { protected UnionIntLiteral() => throw null; - internal UnionIntLiteral(ClientPipeline pipeline, Uri endpoint) => throw null; - public ClientPipeline Pipeline => throw null; public virtual ClientResult GetAll(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/optionality/src/Generated/UnionStringLiteral.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/optionality/src/Generated/UnionStringLiteral.cs index 4a44db8c460..1041ae1cf99 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/optionality/src/Generated/UnionStringLiteral.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/optionality/src/Generated/UnionStringLiteral.cs @@ -2,7 +2,6 @@ #nullable disable -using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -14,8 +13,6 @@ public partial class UnionStringLiteral { protected UnionStringLiteral() => throw null; - internal UnionStringLiteral(ClientPipeline pipeline, Uri endpoint) => throw null; - public ClientPipeline Pipeline => throw null; public virtual ClientResult GetAll(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/Boolean.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/Boolean.cs index f4e93d97aa5..3f6b9d2df7c 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/Boolean.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/Boolean.cs @@ -2,7 +2,6 @@ #nullable disable -using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -14,8 +13,6 @@ public partial class Boolean { protected Boolean() => throw null; - internal Boolean(ClientPipeline pipeline, Uri endpoint) => throw null; - public ClientPipeline Pipeline => throw null; public virtual ClientResult Get(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/BooleanLiteral.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/BooleanLiteral.cs index e2bdc72c983..679f7a738e3 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/BooleanLiteral.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/BooleanLiteral.cs @@ -2,7 +2,6 @@ #nullable disable -using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -14,8 +13,6 @@ public partial class BooleanLiteral { protected BooleanLiteral() => throw null; - internal BooleanLiteral(ClientPipeline pipeline, Uri endpoint) => throw null; - public ClientPipeline Pipeline => throw null; public virtual ClientResult Get(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/Bytes.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/Bytes.cs index 428e3397974..b0a807a9c6d 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/Bytes.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/Bytes.cs @@ -2,7 +2,6 @@ #nullable disable -using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -14,8 +13,6 @@ public partial class Bytes { protected Bytes() => throw null; - internal Bytes(ClientPipeline pipeline, Uri endpoint) => throw null; - public ClientPipeline Pipeline => throw null; public virtual ClientResult Get(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/CollectionsInt.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/CollectionsInt.cs index f49bb79df44..3e6cc227cf5 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/CollectionsInt.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/CollectionsInt.cs @@ -2,7 +2,6 @@ #nullable disable -using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -14,8 +13,6 @@ public partial class CollectionsInt { protected CollectionsInt() => throw null; - internal CollectionsInt(ClientPipeline pipeline, Uri endpoint) => throw null; - public ClientPipeline Pipeline => throw null; public virtual ClientResult Get(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/CollectionsModel.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/CollectionsModel.cs index e40359c230c..2a9ffb958a8 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/CollectionsModel.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/CollectionsModel.cs @@ -2,7 +2,6 @@ #nullable disable -using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -14,8 +13,6 @@ public partial class CollectionsModel { protected CollectionsModel() => throw null; - internal CollectionsModel(ClientPipeline pipeline, Uri endpoint) => throw null; - public ClientPipeline Pipeline => throw null; public virtual ClientResult Get(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/CollectionsString.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/CollectionsString.cs index 18a7083e450..c1dd5d23c45 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/CollectionsString.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/CollectionsString.cs @@ -2,7 +2,6 @@ #nullable disable -using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -14,8 +13,6 @@ public partial class CollectionsString { protected CollectionsString() => throw null; - internal CollectionsString(ClientPipeline pipeline, Uri endpoint) => throw null; - public ClientPipeline Pipeline => throw null; public virtual ClientResult Get(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/Datetime.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/Datetime.cs index 9b6385a11da..b8f6983712b 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/Datetime.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/Datetime.cs @@ -2,7 +2,6 @@ #nullable disable -using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -14,8 +13,6 @@ public partial class Datetime { protected Datetime() => throw null; - internal Datetime(ClientPipeline pipeline, Uri endpoint) => throw null; - public ClientPipeline Pipeline => throw null; public virtual ClientResult Get(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/Decimal.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/Decimal.cs index 90ac68ab77b..cfc5fa3fc48 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/Decimal.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/Decimal.cs @@ -2,7 +2,6 @@ #nullable disable -using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -14,8 +13,6 @@ public partial class Decimal { protected Decimal() => throw null; - internal Decimal(ClientPipeline pipeline, Uri endpoint) => throw null; - public ClientPipeline Pipeline => throw null; public virtual ClientResult Get(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/Decimal128.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/Decimal128.cs index 06b87e33722..553501b9bdd 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/Decimal128.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/Decimal128.cs @@ -2,7 +2,6 @@ #nullable disable -using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -14,8 +13,6 @@ public partial class Decimal128 { protected Decimal128() => throw null; - internal Decimal128(ClientPipeline pipeline, Uri endpoint) => throw null; - public ClientPipeline Pipeline => throw null; public virtual ClientResult Get(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/DictionaryString.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/DictionaryString.cs index d1d5dc8e06e..0da288b589b 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/DictionaryString.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/DictionaryString.cs @@ -2,7 +2,6 @@ #nullable disable -using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -14,8 +13,6 @@ public partial class DictionaryString { protected DictionaryString() => throw null; - internal DictionaryString(ClientPipeline pipeline, Uri endpoint) => throw null; - public ClientPipeline Pipeline => throw null; public virtual ClientResult Get(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/Duration.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/Duration.cs index 304ea7ce05e..fb81d1ff2de 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/Duration.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/Duration.cs @@ -2,7 +2,6 @@ #nullable disable -using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -14,8 +13,6 @@ public partial class Duration { protected Duration() => throw null; - internal Duration(ClientPipeline pipeline, Uri endpoint) => throw null; - public ClientPipeline Pipeline => throw null; public virtual ClientResult Get(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/Enum.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/Enum.cs index 6ee002b6a38..082585a6b1b 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/Enum.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/Enum.cs @@ -2,7 +2,6 @@ #nullable disable -using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -14,8 +13,6 @@ public partial class Enum { protected Enum() => throw null; - internal Enum(ClientPipeline pipeline, Uri endpoint) => throw null; - public ClientPipeline Pipeline => throw null; public virtual ClientResult Get(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/ExtensibleEnum.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/ExtensibleEnum.cs index 05e0b19b4c5..1d39d6232b2 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/ExtensibleEnum.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/ExtensibleEnum.cs @@ -2,7 +2,6 @@ #nullable disable -using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -14,8 +13,6 @@ public partial class ExtensibleEnum { protected ExtensibleEnum() => throw null; - internal ExtensibleEnum(ClientPipeline pipeline, Uri endpoint) => throw null; - public ClientPipeline Pipeline => throw null; public virtual ClientResult Get(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/Float.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/Float.cs index 31ca39d2378..89917bd0d67 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/Float.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/Float.cs @@ -2,7 +2,6 @@ #nullable disable -using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -14,8 +13,6 @@ public partial class Float { protected Float() => throw null; - internal Float(ClientPipeline pipeline, Uri endpoint) => throw null; - public ClientPipeline Pipeline => throw null; public virtual ClientResult Get(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/FloatLiteral.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/FloatLiteral.cs index 272147c3f79..89f86508d9d 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/FloatLiteral.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/FloatLiteral.cs @@ -2,7 +2,6 @@ #nullable disable -using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -14,8 +13,6 @@ public partial class FloatLiteral { protected FloatLiteral() => throw null; - internal FloatLiteral(ClientPipeline pipeline, Uri endpoint) => throw null; - public ClientPipeline Pipeline => throw null; public virtual ClientResult Get(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/Int.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/Int.cs index 42d5cab9109..e4e359014ea 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/Int.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/Int.cs @@ -2,7 +2,6 @@ #nullable disable -using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -14,8 +13,6 @@ public partial class Int { protected Int() => throw null; - internal Int(ClientPipeline pipeline, Uri endpoint) => throw null; - public ClientPipeline Pipeline => throw null; public virtual ClientResult Get(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/IntLiteral.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/IntLiteral.cs index 1504957189f..75851545805 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/IntLiteral.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/IntLiteral.cs @@ -2,7 +2,6 @@ #nullable disable -using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -14,8 +13,6 @@ public partial class IntLiteral { protected IntLiteral() => throw null; - internal IntLiteral(ClientPipeline pipeline, Uri endpoint) => throw null; - public ClientPipeline Pipeline => throw null; public virtual ClientResult Get(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/Model.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/Model.cs index 1c306e46d07..83467e85608 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/Model.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/Model.cs @@ -2,7 +2,6 @@ #nullable disable -using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -14,8 +13,6 @@ public partial class Model { protected Model() => throw null; - internal Model(ClientPipeline pipeline, Uri endpoint) => throw null; - public ClientPipeline Pipeline => throw null; public virtual ClientResult Get(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/Never.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/Never.cs index 8e08e0fa31e..92ff671d14a 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/Never.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/Never.cs @@ -2,7 +2,6 @@ #nullable disable -using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -14,8 +13,6 @@ public partial class Never { protected Never() => throw null; - internal Never(ClientPipeline pipeline, Uri endpoint) => throw null; - public ClientPipeline Pipeline => throw null; public virtual ClientResult Get(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/String.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/String.cs index c49f8856b95..750373bbcfc 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/String.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/String.cs @@ -2,7 +2,6 @@ #nullable disable -using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -14,8 +13,6 @@ public partial class String { protected String() => throw null; - internal String(ClientPipeline pipeline, Uri endpoint) => throw null; - public ClientPipeline Pipeline => throw null; public virtual ClientResult Get(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/StringLiteral.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/StringLiteral.cs index 4e4108e032f..d02b76d3dd6 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/StringLiteral.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/StringLiteral.cs @@ -2,7 +2,6 @@ #nullable disable -using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -14,8 +13,6 @@ public partial class StringLiteral { protected StringLiteral() => throw null; - internal StringLiteral(ClientPipeline pipeline, Uri endpoint) => throw null; - public ClientPipeline Pipeline => throw null; public virtual ClientResult Get(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/UnionEnumValue.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/UnionEnumValue.cs index bc5592782ce..69962b5cd3f 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/UnionEnumValue.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/UnionEnumValue.cs @@ -2,7 +2,6 @@ #nullable disable -using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -14,8 +13,6 @@ public partial class UnionEnumValue { protected UnionEnumValue() => throw null; - internal UnionEnumValue(ClientPipeline pipeline, Uri endpoint) => throw null; - public ClientPipeline Pipeline => throw null; public virtual ClientResult Get(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/UnionFloatLiteral.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/UnionFloatLiteral.cs index b722ec14e86..620ccef7d9d 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/UnionFloatLiteral.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/UnionFloatLiteral.cs @@ -2,7 +2,6 @@ #nullable disable -using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -14,8 +13,6 @@ public partial class UnionFloatLiteral { protected UnionFloatLiteral() => throw null; - internal UnionFloatLiteral(ClientPipeline pipeline, Uri endpoint) => throw null; - public ClientPipeline Pipeline => throw null; public virtual ClientResult Get(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/UnionIntLiteral.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/UnionIntLiteral.cs index 32e42a85f40..64b2d1651f8 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/UnionIntLiteral.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/UnionIntLiteral.cs @@ -2,7 +2,6 @@ #nullable disable -using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -14,8 +13,6 @@ public partial class UnionIntLiteral { protected UnionIntLiteral() => throw null; - internal UnionIntLiteral(ClientPipeline pipeline, Uri endpoint) => throw null; - public ClientPipeline Pipeline => throw null; public virtual ClientResult Get(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/UnionStringLiteral.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/UnionStringLiteral.cs index fde1c748c4d..8dbaa7dec43 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/UnionStringLiteral.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/UnionStringLiteral.cs @@ -2,7 +2,6 @@ #nullable disable -using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -14,8 +13,6 @@ public partial class UnionStringLiteral { protected UnionStringLiteral() => throw null; - internal UnionStringLiteral(ClientPipeline pipeline, Uri endpoint) => throw null; - public ClientPipeline Pipeline => throw null; public virtual ClientResult Get(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/UnknownArray.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/UnknownArray.cs index f40c76b820a..b8e85f2c700 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/UnknownArray.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/UnknownArray.cs @@ -2,7 +2,6 @@ #nullable disable -using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -14,8 +13,6 @@ public partial class UnknownArray { protected UnknownArray() => throw null; - internal UnknownArray(ClientPipeline pipeline, Uri endpoint) => throw null; - public ClientPipeline Pipeline => throw null; public virtual ClientResult Get(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/UnknownDict.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/UnknownDict.cs index 81fdff22645..6c050d94eff 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/UnknownDict.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/UnknownDict.cs @@ -2,7 +2,6 @@ #nullable disable -using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -14,8 +13,6 @@ public partial class UnknownDict { protected UnknownDict() => throw null; - internal UnknownDict(ClientPipeline pipeline, Uri endpoint) => throw null; - public ClientPipeline Pipeline => throw null; public virtual ClientResult Get(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/UnknownInt.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/UnknownInt.cs index fb2f59c1cc5..222c28277e7 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/UnknownInt.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/UnknownInt.cs @@ -2,7 +2,6 @@ #nullable disable -using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -14,8 +13,6 @@ public partial class UnknownInt { protected UnknownInt() => throw null; - internal UnknownInt(ClientPipeline pipeline, Uri endpoint) => throw null; - public ClientPipeline Pipeline => throw null; public virtual ClientResult Get(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/UnknownString.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/UnknownString.cs index bb587ae7036..2af9c5e7276 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/UnknownString.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/UnknownString.cs @@ -2,7 +2,6 @@ #nullable disable -using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -14,8 +13,6 @@ public partial class UnknownString { protected UnknownString() => throw null; - internal UnknownString(ClientPipeline pipeline, Uri endpoint) => throw null; - public ClientPipeline Pipeline => throw null; public virtual ClientResult Get(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/ValueTypesClient.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/ValueTypesClient.cs index f0d9d59fb35..200181ea7f9 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/ValueTypesClient.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/ValueTypesClient.cs @@ -10,14 +10,12 @@ namespace _Type.Property.ValueTypes { public partial class ValueTypesClient { - public ValueTypesClient() : this(new Uri("http://localhost:3000"), new ValueTypesClientOptions()) => throw null; + public ValueTypesClient() => throw null; - internal ValueTypesClient(AuthenticationPolicy authenticationPolicy, Uri endpoint, ValueTypesClientOptions options) => throw null; - - public ValueTypesClient(Uri endpoint, ValueTypesClientOptions options) : this(null, endpoint, options) => throw null; + public ValueTypesClient(Uri endpoint, ValueTypesClientOptions options) => throw null; [Experimental("SCME0002")] - public ValueTypesClient(ValueTypesClientSettings settings) : this(AuthenticationPolicy.Create(settings), settings?.Endpoint, settings?.Options) => throw null; + public ValueTypesClient(ValueTypesClientSettings settings) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/scalar/src/Generated/Boolean.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/scalar/src/Generated/Boolean.cs index f3a074a4c57..12a173aba7d 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/scalar/src/Generated/Boolean.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/scalar/src/Generated/Boolean.cs @@ -2,7 +2,6 @@ #nullable disable -using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -14,8 +13,6 @@ public partial class Boolean { protected Boolean() => throw null; - internal Boolean(ClientPipeline pipeline, Uri endpoint) => throw null; - public ClientPipeline Pipeline => throw null; public virtual ClientResult Get(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/scalar/src/Generated/Decimal128Type.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/scalar/src/Generated/Decimal128Type.cs index 6e3566ea66a..941ee7e41dc 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/scalar/src/Generated/Decimal128Type.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/scalar/src/Generated/Decimal128Type.cs @@ -2,7 +2,6 @@ #nullable disable -using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -14,8 +13,6 @@ public partial class Decimal128Type { protected Decimal128Type() => throw null; - internal Decimal128Type(ClientPipeline pipeline, Uri endpoint) => throw null; - public ClientPipeline Pipeline => throw null; public virtual ClientResult ResponseBody(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/scalar/src/Generated/Decimal128Verify.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/scalar/src/Generated/Decimal128Verify.cs index 11e138c5ac3..01200f453d3 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/scalar/src/Generated/Decimal128Verify.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/scalar/src/Generated/Decimal128Verify.cs @@ -2,7 +2,6 @@ #nullable disable -using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Collections.Generic; @@ -15,8 +14,6 @@ public partial class Decimal128Verify { protected Decimal128Verify() => throw null; - internal Decimal128Verify(ClientPipeline pipeline, Uri endpoint) => throw null; - public ClientPipeline Pipeline => throw null; public virtual ClientResult PrepareVerify(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/scalar/src/Generated/DecimalType.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/scalar/src/Generated/DecimalType.cs index c225451e654..281338de6ca 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/scalar/src/Generated/DecimalType.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/scalar/src/Generated/DecimalType.cs @@ -2,7 +2,6 @@ #nullable disable -using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -14,8 +13,6 @@ public partial class DecimalType { protected DecimalType() => throw null; - internal DecimalType(ClientPipeline pipeline, Uri endpoint) => throw null; - public ClientPipeline Pipeline => throw null; public virtual ClientResult ResponseBody(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/scalar/src/Generated/DecimalVerify.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/scalar/src/Generated/DecimalVerify.cs index 6b00b6964ac..3c38a946f65 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/scalar/src/Generated/DecimalVerify.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/scalar/src/Generated/DecimalVerify.cs @@ -2,7 +2,6 @@ #nullable disable -using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Collections.Generic; @@ -15,8 +14,6 @@ public partial class DecimalVerify { protected DecimalVerify() => throw null; - internal DecimalVerify(ClientPipeline pipeline, Uri endpoint) => throw null; - public ClientPipeline Pipeline => throw null; public virtual ClientResult PrepareVerify(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/scalar/src/Generated/ScalarClient.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/scalar/src/Generated/ScalarClient.cs index c446fb20afc..5c0e973bec4 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/scalar/src/Generated/ScalarClient.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/scalar/src/Generated/ScalarClient.cs @@ -10,14 +10,12 @@ namespace _Type.Scalar { public partial class ScalarClient { - public ScalarClient() : this(new Uri("http://localhost:3000"), new ScalarClientOptions()) => throw null; + public ScalarClient() => throw null; - internal ScalarClient(AuthenticationPolicy authenticationPolicy, Uri endpoint, ScalarClientOptions options) => throw null; - - public ScalarClient(Uri endpoint, ScalarClientOptions options) : this(null, endpoint, options) => throw null; + public ScalarClient(Uri endpoint, ScalarClientOptions options) => throw null; [Experimental("SCME0002")] - public ScalarClient(ScalarClientSettings settings) : this(AuthenticationPolicy.Create(settings), settings?.Endpoint, settings?.Options) => throw null; + public ScalarClient(ScalarClientSettings settings) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/scalar/src/Generated/String.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/scalar/src/Generated/String.cs index e58e6a99949..b1b7388d369 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/scalar/src/Generated/String.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/scalar/src/Generated/String.cs @@ -2,7 +2,6 @@ #nullable disable -using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -14,8 +13,6 @@ public partial class String { protected String() => throw null; - internal String(ClientPipeline pipeline, Uri endpoint) => throw null; - public ClientPipeline Pipeline => throw null; public virtual ClientResult Get(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/scalar/src/Generated/Unknown.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/scalar/src/Generated/Unknown.cs index ad255b77e27..39e08fd7025 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/scalar/src/Generated/Unknown.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/scalar/src/Generated/Unknown.cs @@ -14,8 +14,6 @@ public partial class Unknown { protected Unknown() => throw null; - internal Unknown(ClientPipeline pipeline, Uri endpoint) => throw null; - public ClientPipeline Pipeline => throw null; public virtual ClientResult Get(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/union/src/Generated/EnumsOnly.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/union/src/Generated/EnumsOnly.cs index 326e87184ee..5ea24aef091 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/union/src/Generated/EnumsOnly.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/union/src/Generated/EnumsOnly.cs @@ -2,7 +2,6 @@ #nullable disable -using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -14,8 +13,6 @@ public partial class EnumsOnly { protected EnumsOnly() => throw null; - internal EnumsOnly(ClientPipeline pipeline, Uri endpoint) => throw null; - public ClientPipeline Pipeline => throw null; public virtual ClientResult Get(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/union/src/Generated/FloatsOnly.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/union/src/Generated/FloatsOnly.cs index 687ca26b9d4..6165e15eb36 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/union/src/Generated/FloatsOnly.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/union/src/Generated/FloatsOnly.cs @@ -2,7 +2,6 @@ #nullable disable -using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -14,8 +13,6 @@ public partial class FloatsOnly { protected FloatsOnly() => throw null; - internal FloatsOnly(ClientPipeline pipeline, Uri endpoint) => throw null; - public ClientPipeline Pipeline => throw null; public virtual ClientResult Get(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/union/src/Generated/IntsOnly.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/union/src/Generated/IntsOnly.cs index d9e64843d11..abb9c25fba4 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/union/src/Generated/IntsOnly.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/union/src/Generated/IntsOnly.cs @@ -2,7 +2,6 @@ #nullable disable -using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -14,8 +13,6 @@ public partial class IntsOnly { protected IntsOnly() => throw null; - internal IntsOnly(ClientPipeline pipeline, Uri endpoint) => throw null; - public ClientPipeline Pipeline => throw null; public virtual ClientResult Get(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/union/src/Generated/MixedLiterals.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/union/src/Generated/MixedLiterals.cs index 7ee7a6ee49c..dc60eb0f3ab 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/union/src/Generated/MixedLiterals.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/union/src/Generated/MixedLiterals.cs @@ -2,7 +2,6 @@ #nullable disable -using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -14,8 +13,6 @@ public partial class MixedLiterals { protected MixedLiterals() => throw null; - internal MixedLiterals(ClientPipeline pipeline, Uri endpoint) => throw null; - public ClientPipeline Pipeline => throw null; public virtual ClientResult Get(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/union/src/Generated/MixedTypes.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/union/src/Generated/MixedTypes.cs index b7ae1cff2e4..72608045240 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/union/src/Generated/MixedTypes.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/union/src/Generated/MixedTypes.cs @@ -2,7 +2,6 @@ #nullable disable -using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -14,8 +13,6 @@ public partial class MixedTypes { protected MixedTypes() => throw null; - internal MixedTypes(ClientPipeline pipeline, Uri endpoint) => throw null; - public ClientPipeline Pipeline => throw null; public virtual ClientResult Get(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/union/src/Generated/ModelsOnly.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/union/src/Generated/ModelsOnly.cs index ebb37812dc0..9d638303f32 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/union/src/Generated/ModelsOnly.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/union/src/Generated/ModelsOnly.cs @@ -14,8 +14,6 @@ public partial class ModelsOnly { protected ModelsOnly() => throw null; - internal ModelsOnly(ClientPipeline pipeline, Uri endpoint) => throw null; - public ClientPipeline Pipeline => throw null; public virtual ClientResult Get(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/union/src/Generated/StringAndArray.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/union/src/Generated/StringAndArray.cs index 0a470dd358d..914985be3eb 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/union/src/Generated/StringAndArray.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/union/src/Generated/StringAndArray.cs @@ -2,7 +2,6 @@ #nullable disable -using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -14,8 +13,6 @@ public partial class StringAndArray { protected StringAndArray() => throw null; - internal StringAndArray(ClientPipeline pipeline, Uri endpoint) => throw null; - public ClientPipeline Pipeline => throw null; public virtual ClientResult Get(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/union/src/Generated/StringExtensible.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/union/src/Generated/StringExtensible.cs index c6d886ad068..04035a679a9 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/union/src/Generated/StringExtensible.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/union/src/Generated/StringExtensible.cs @@ -2,7 +2,6 @@ #nullable disable -using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -14,8 +13,6 @@ public partial class StringExtensible { protected StringExtensible() => throw null; - internal StringExtensible(ClientPipeline pipeline, Uri endpoint) => throw null; - public ClientPipeline Pipeline => throw null; public virtual ClientResult Get(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/union/src/Generated/StringExtensibleNamed.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/union/src/Generated/StringExtensibleNamed.cs index 85a4d399263..e4299a80a88 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/union/src/Generated/StringExtensibleNamed.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/union/src/Generated/StringExtensibleNamed.cs @@ -2,7 +2,6 @@ #nullable disable -using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -14,8 +13,6 @@ public partial class StringExtensibleNamed { protected StringExtensibleNamed() => throw null; - internal StringExtensibleNamed(ClientPipeline pipeline, Uri endpoint) => throw null; - public ClientPipeline Pipeline => throw null; public virtual ClientResult Get(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/union/src/Generated/StringsOnly.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/union/src/Generated/StringsOnly.cs index fb8ec122f24..e94cb73e42f 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/union/src/Generated/StringsOnly.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/union/src/Generated/StringsOnly.cs @@ -2,7 +2,6 @@ #nullable disable -using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -14,8 +13,6 @@ public partial class StringsOnly { protected StringsOnly() => throw null; - internal StringsOnly(ClientPipeline pipeline, Uri endpoint) => throw null; - public ClientPipeline Pipeline => throw null; public virtual ClientResult Get(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/union/src/Generated/UnionClient.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/union/src/Generated/UnionClient.cs index 48df18bf7cc..683766a96c1 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/union/src/Generated/UnionClient.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/union/src/Generated/UnionClient.cs @@ -10,14 +10,12 @@ namespace _Type.Union { public partial class UnionClient { - public UnionClient() : this(new Uri("http://localhost:3000"), new UnionClientOptions()) => throw null; + public UnionClient() => throw null; - internal UnionClient(AuthenticationPolicy authenticationPolicy, Uri endpoint, UnionClientOptions options) => throw null; - - public UnionClient(Uri endpoint, UnionClientOptions options) : this(null, endpoint, options) => throw null; + public UnionClient(Uri endpoint, UnionClientOptions options) => throw null; [Experimental("SCME0002")] - public UnionClient(UnionClientSettings settings) : this(AuthenticationPolicy.Create(settings), settings?.Endpoint, settings?.Options) => throw null; + public UnionClient(UnionClientSettings settings) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/added/v1/src/Generated/AddedClient.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/added/v1/src/Generated/AddedClient.cs index d3cfcb5aa70..feb0007feaa 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/added/v1/src/Generated/AddedClient.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/added/v1/src/Generated/AddedClient.cs @@ -15,14 +15,12 @@ public partial class AddedClient { protected AddedClient() => throw null; - public AddedClient(Uri endpoint) : this(endpoint, new AddedClientOptions()) => throw null; + public AddedClient(Uri endpoint) => throw null; - internal AddedClient(AuthenticationPolicy authenticationPolicy, Uri endpoint, AddedClientOptions options) => throw null; - - public AddedClient(Uri endpoint, AddedClientOptions options) : this(null, endpoint, options) => throw null; + public AddedClient(Uri endpoint, AddedClientOptions options) => throw null; [Experimental("SCME0002")] - public AddedClient(AddedClientSettings settings) : this(AuthenticationPolicy.Create(settings), settings?.Endpoint, settings?.Options) => throw null; + public AddedClient(AddedClientSettings settings) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/added/v2/src/Generated/AddedClient.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/added/v2/src/Generated/AddedClient.cs index 6f27070b32e..68a95455006 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/added/v2/src/Generated/AddedClient.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/added/v2/src/Generated/AddedClient.cs @@ -15,14 +15,12 @@ public partial class AddedClient { protected AddedClient() => throw null; - public AddedClient(Uri endpoint) : this(endpoint, new AddedClientOptions()) => throw null; + public AddedClient(Uri endpoint) => throw null; - internal AddedClient(AuthenticationPolicy authenticationPolicy, Uri endpoint, AddedClientOptions options) => throw null; - - public AddedClient(Uri endpoint, AddedClientOptions options) : this(null, endpoint, options) => throw null; + public AddedClient(Uri endpoint, AddedClientOptions options) => throw null; [Experimental("SCME0002")] - public AddedClient(AddedClientSettings settings) : this(AuthenticationPolicy.Create(settings), settings?.Endpoint, settings?.Options) => throw null; + public AddedClient(AddedClientSettings settings) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/added/v2/src/Generated/InterfaceV2.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/added/v2/src/Generated/InterfaceV2.cs index 09e38898e24..cef6e78f45d 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/added/v2/src/Generated/InterfaceV2.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/added/v2/src/Generated/InterfaceV2.cs @@ -2,7 +2,6 @@ #nullable disable -using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -14,8 +13,6 @@ public partial class InterfaceV2 { protected InterfaceV2() => throw null; - internal InterfaceV2(ClientPipeline pipeline, Uri endpoint, string version) => throw null; - public ClientPipeline Pipeline => throw null; public virtual ClientResult V2InInterface(BinaryContent content, RequestOptions options = null) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/madeOptional/v1/src/Generated/MadeOptionalClient.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/madeOptional/v1/src/Generated/MadeOptionalClient.cs index d78e1fe494b..93178fd9cfa 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/madeOptional/v1/src/Generated/MadeOptionalClient.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/madeOptional/v1/src/Generated/MadeOptionalClient.cs @@ -15,14 +15,12 @@ public partial class MadeOptionalClient { protected MadeOptionalClient() => throw null; - public MadeOptionalClient(Uri endpoint) : this(endpoint, new MadeOptionalClientOptions()) => throw null; + public MadeOptionalClient(Uri endpoint) => throw null; - internal MadeOptionalClient(AuthenticationPolicy authenticationPolicy, Uri endpoint, MadeOptionalClientOptions options) => throw null; - - public MadeOptionalClient(Uri endpoint, MadeOptionalClientOptions options) : this(null, endpoint, options) => throw null; + public MadeOptionalClient(Uri endpoint, MadeOptionalClientOptions options) => throw null; [Experimental("SCME0002")] - public MadeOptionalClient(MadeOptionalClientSettings settings) : this(AuthenticationPolicy.Create(settings), settings?.Endpoint, settings?.Options) => throw null; + public MadeOptionalClient(MadeOptionalClientSettings settings) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/madeOptional/v2/src/Generated/MadeOptionalClient.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/madeOptional/v2/src/Generated/MadeOptionalClient.cs index a7c5df86c22..5a112a2e15c 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/madeOptional/v2/src/Generated/MadeOptionalClient.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/madeOptional/v2/src/Generated/MadeOptionalClient.cs @@ -15,14 +15,12 @@ public partial class MadeOptionalClient { protected MadeOptionalClient() => throw null; - public MadeOptionalClient(Uri endpoint) : this(endpoint, new MadeOptionalClientOptions()) => throw null; + public MadeOptionalClient(Uri endpoint) => throw null; - internal MadeOptionalClient(AuthenticationPolicy authenticationPolicy, Uri endpoint, MadeOptionalClientOptions options) => throw null; - - public MadeOptionalClient(Uri endpoint, MadeOptionalClientOptions options) : this(null, endpoint, options) => throw null; + public MadeOptionalClient(Uri endpoint, MadeOptionalClientOptions options) => throw null; [Experimental("SCME0002")] - public MadeOptionalClient(MadeOptionalClientSettings settings) : this(AuthenticationPolicy.Create(settings), settings?.Endpoint, settings?.Options) => throw null; + public MadeOptionalClient(MadeOptionalClientSettings settings) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/removed/v1/src/Generated/InterfaceV1.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/removed/v1/src/Generated/InterfaceV1.cs index 65f7690e6d9..d3656e7c8d6 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/removed/v1/src/Generated/InterfaceV1.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/removed/v1/src/Generated/InterfaceV1.cs @@ -2,7 +2,6 @@ #nullable disable -using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -14,8 +13,6 @@ public partial class InterfaceV1 { protected InterfaceV1() => throw null; - internal InterfaceV1(ClientPipeline pipeline, Uri endpoint, string version) => throw null; - public ClientPipeline Pipeline => throw null; public virtual ClientResult V1InInterface(BinaryContent content, RequestOptions options = null) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/removed/v1/src/Generated/RemovedClient.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/removed/v1/src/Generated/RemovedClient.cs index 3dfd35529a9..d5997ec0e7a 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/removed/v1/src/Generated/RemovedClient.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/removed/v1/src/Generated/RemovedClient.cs @@ -15,14 +15,12 @@ public partial class RemovedClient { protected RemovedClient() => throw null; - public RemovedClient(Uri endpoint) : this(endpoint, new RemovedClientOptions()) => throw null; + public RemovedClient(Uri endpoint) => throw null; - internal RemovedClient(AuthenticationPolicy authenticationPolicy, Uri endpoint, RemovedClientOptions options) => throw null; - - public RemovedClient(Uri endpoint, RemovedClientOptions options) : this(null, endpoint, options) => throw null; + public RemovedClient(Uri endpoint, RemovedClientOptions options) => throw null; [Experimental("SCME0002")] - public RemovedClient(RemovedClientSettings settings) : this(AuthenticationPolicy.Create(settings), settings?.Endpoint, settings?.Options) => throw null; + public RemovedClient(RemovedClientSettings settings) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/removed/v2/src/Generated/RemovedClient.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/removed/v2/src/Generated/RemovedClient.cs index d07a44fd254..fcbbf6f3ae9 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/removed/v2/src/Generated/RemovedClient.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/removed/v2/src/Generated/RemovedClient.cs @@ -15,14 +15,12 @@ public partial class RemovedClient { protected RemovedClient() => throw null; - public RemovedClient(Uri endpoint) : this(endpoint, new RemovedClientOptions()) => throw null; + public RemovedClient(Uri endpoint) => throw null; - internal RemovedClient(AuthenticationPolicy authenticationPolicy, Uri endpoint, RemovedClientOptions options) => throw null; - - public RemovedClient(Uri endpoint, RemovedClientOptions options) : this(null, endpoint, options) => throw null; + public RemovedClient(Uri endpoint, RemovedClientOptions options) => throw null; [Experimental("SCME0002")] - public RemovedClient(RemovedClientSettings settings) : this(AuthenticationPolicy.Create(settings), settings?.Endpoint, settings?.Options) => throw null; + public RemovedClient(RemovedClientSettings settings) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/removed/v2Preview/src/Generated/InterfaceV1.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/removed/v2Preview/src/Generated/InterfaceV1.cs index 65f7690e6d9..d3656e7c8d6 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/removed/v2Preview/src/Generated/InterfaceV1.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/removed/v2Preview/src/Generated/InterfaceV1.cs @@ -2,7 +2,6 @@ #nullable disable -using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -14,8 +13,6 @@ public partial class InterfaceV1 { protected InterfaceV1() => throw null; - internal InterfaceV1(ClientPipeline pipeline, Uri endpoint, string version) => throw null; - public ClientPipeline Pipeline => throw null; public virtual ClientResult V1InInterface(BinaryContent content, RequestOptions options = null) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/removed/v2Preview/src/Generated/RemovedClient.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/removed/v2Preview/src/Generated/RemovedClient.cs index 3dfd35529a9..d5997ec0e7a 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/removed/v2Preview/src/Generated/RemovedClient.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/removed/v2Preview/src/Generated/RemovedClient.cs @@ -15,14 +15,12 @@ public partial class RemovedClient { protected RemovedClient() => throw null; - public RemovedClient(Uri endpoint) : this(endpoint, new RemovedClientOptions()) => throw null; + public RemovedClient(Uri endpoint) => throw null; - internal RemovedClient(AuthenticationPolicy authenticationPolicy, Uri endpoint, RemovedClientOptions options) => throw null; - - public RemovedClient(Uri endpoint, RemovedClientOptions options) : this(null, endpoint, options) => throw null; + public RemovedClient(Uri endpoint, RemovedClientOptions options) => throw null; [Experimental("SCME0002")] - public RemovedClient(RemovedClientSettings settings) : this(AuthenticationPolicy.Create(settings), settings?.Endpoint, settings?.Options) => throw null; + public RemovedClient(RemovedClientSettings settings) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/renamedFrom/v1/src/Generated/OldInterface.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/renamedFrom/v1/src/Generated/OldInterface.cs index 165af44a376..27d6fdcc629 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/renamedFrom/v1/src/Generated/OldInterface.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/renamedFrom/v1/src/Generated/OldInterface.cs @@ -2,7 +2,6 @@ #nullable disable -using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -14,8 +13,6 @@ public partial class OldInterface { protected OldInterface() => throw null; - internal OldInterface(ClientPipeline pipeline, Uri endpoint, string version) => throw null; - public ClientPipeline Pipeline => throw null; public virtual ClientResult NewOpInNewInterface(BinaryContent content, RequestOptions options = null) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/renamedFrom/v1/src/Generated/RenamedFromClient.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/renamedFrom/v1/src/Generated/RenamedFromClient.cs index 936e395e08f..b8d95317eab 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/renamedFrom/v1/src/Generated/RenamedFromClient.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/renamedFrom/v1/src/Generated/RenamedFromClient.cs @@ -15,14 +15,12 @@ public partial class RenamedFromClient { protected RenamedFromClient() => throw null; - public RenamedFromClient(Uri endpoint) : this(endpoint, new RenamedFromClientOptions()) => throw null; + public RenamedFromClient(Uri endpoint) => throw null; - internal RenamedFromClient(AuthenticationPolicy authenticationPolicy, Uri endpoint, RenamedFromClientOptions options) => throw null; - - public RenamedFromClient(Uri endpoint, RenamedFromClientOptions options) : this(null, endpoint, options) => throw null; + public RenamedFromClient(Uri endpoint, RenamedFromClientOptions options) => throw null; [Experimental("SCME0002")] - public RenamedFromClient(RenamedFromClientSettings settings) : this(AuthenticationPolicy.Create(settings), settings?.Endpoint, settings?.Options) => throw null; + public RenamedFromClient(RenamedFromClientSettings settings) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/renamedFrom/v2/src/Generated/NewInterface.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/renamedFrom/v2/src/Generated/NewInterface.cs index 5a2e1c3333e..959c7a48106 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/renamedFrom/v2/src/Generated/NewInterface.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/renamedFrom/v2/src/Generated/NewInterface.cs @@ -2,7 +2,6 @@ #nullable disable -using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -14,8 +13,6 @@ public partial class NewInterface { protected NewInterface() => throw null; - internal NewInterface(ClientPipeline pipeline, Uri endpoint, string version) => throw null; - public ClientPipeline Pipeline => throw null; public virtual ClientResult NewOpInNewInterface(BinaryContent content, RequestOptions options = null) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/renamedFrom/v2/src/Generated/RenamedFromClient.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/renamedFrom/v2/src/Generated/RenamedFromClient.cs index 18dab03d399..f5573f5d524 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/renamedFrom/v2/src/Generated/RenamedFromClient.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/renamedFrom/v2/src/Generated/RenamedFromClient.cs @@ -15,14 +15,12 @@ public partial class RenamedFromClient { protected RenamedFromClient() => throw null; - public RenamedFromClient(Uri endpoint) : this(endpoint, new RenamedFromClientOptions()) => throw null; + public RenamedFromClient(Uri endpoint) => throw null; - internal RenamedFromClient(AuthenticationPolicy authenticationPolicy, Uri endpoint, RenamedFromClientOptions options) => throw null; - - public RenamedFromClient(Uri endpoint, RenamedFromClientOptions options) : this(null, endpoint, options) => throw null; + public RenamedFromClient(Uri endpoint, RenamedFromClientOptions options) => throw null; [Experimental("SCME0002")] - public RenamedFromClient(RenamedFromClientSettings settings) : this(AuthenticationPolicy.Create(settings), settings?.Endpoint, settings?.Options) => throw null; + public RenamedFromClient(RenamedFromClientSettings settings) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/returnTypeChangedFrom/v1/src/Generated/ReturnTypeChangedFromClient.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/returnTypeChangedFrom/v1/src/Generated/ReturnTypeChangedFromClient.cs index 60b54b0ab97..4f81dd6e61e 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/returnTypeChangedFrom/v1/src/Generated/ReturnTypeChangedFromClient.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/returnTypeChangedFrom/v1/src/Generated/ReturnTypeChangedFromClient.cs @@ -15,14 +15,12 @@ public partial class ReturnTypeChangedFromClient { protected ReturnTypeChangedFromClient() => throw null; - public ReturnTypeChangedFromClient(Uri endpoint) : this(endpoint, new ReturnTypeChangedFromClientOptions()) => throw null; + public ReturnTypeChangedFromClient(Uri endpoint) => throw null; - internal ReturnTypeChangedFromClient(AuthenticationPolicy authenticationPolicy, Uri endpoint, ReturnTypeChangedFromClientOptions options) => throw null; - - public ReturnTypeChangedFromClient(Uri endpoint, ReturnTypeChangedFromClientOptions options) : this(null, endpoint, options) => throw null; + public ReturnTypeChangedFromClient(Uri endpoint, ReturnTypeChangedFromClientOptions options) => throw null; [Experimental("SCME0002")] - public ReturnTypeChangedFromClient(ReturnTypeChangedFromClientSettings settings) : this(AuthenticationPolicy.Create(settings), settings?.Endpoint, settings?.Options) => throw null; + public ReturnTypeChangedFromClient(ReturnTypeChangedFromClientSettings settings) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/returnTypeChangedFrom/v2/src/Generated/ReturnTypeChangedFromClient.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/returnTypeChangedFrom/v2/src/Generated/ReturnTypeChangedFromClient.cs index 5a20ae37bc3..6d5f8a4f8bb 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/returnTypeChangedFrom/v2/src/Generated/ReturnTypeChangedFromClient.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/returnTypeChangedFrom/v2/src/Generated/ReturnTypeChangedFromClient.cs @@ -15,14 +15,12 @@ public partial class ReturnTypeChangedFromClient { protected ReturnTypeChangedFromClient() => throw null; - public ReturnTypeChangedFromClient(Uri endpoint) : this(endpoint, new ReturnTypeChangedFromClientOptions()) => throw null; + public ReturnTypeChangedFromClient(Uri endpoint) => throw null; - internal ReturnTypeChangedFromClient(AuthenticationPolicy authenticationPolicy, Uri endpoint, ReturnTypeChangedFromClientOptions options) => throw null; - - public ReturnTypeChangedFromClient(Uri endpoint, ReturnTypeChangedFromClientOptions options) : this(null, endpoint, options) => throw null; + public ReturnTypeChangedFromClient(Uri endpoint, ReturnTypeChangedFromClientOptions options) => throw null; [Experimental("SCME0002")] - public ReturnTypeChangedFromClient(ReturnTypeChangedFromClientSettings settings) : this(AuthenticationPolicy.Create(settings), settings?.Endpoint, settings?.Options) => throw null; + public ReturnTypeChangedFromClient(ReturnTypeChangedFromClientSettings settings) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/typeChangedFrom/v1/src/Generated/TypeChangedFromClient.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/typeChangedFrom/v1/src/Generated/TypeChangedFromClient.cs index fc0dde04309..8357ba551ed 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/typeChangedFrom/v1/src/Generated/TypeChangedFromClient.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/typeChangedFrom/v1/src/Generated/TypeChangedFromClient.cs @@ -15,14 +15,12 @@ public partial class TypeChangedFromClient { protected TypeChangedFromClient() => throw null; - public TypeChangedFromClient(Uri endpoint) : this(endpoint, new TypeChangedFromClientOptions()) => throw null; + public TypeChangedFromClient(Uri endpoint) => throw null; - internal TypeChangedFromClient(AuthenticationPolicy authenticationPolicy, Uri endpoint, TypeChangedFromClientOptions options) => throw null; - - public TypeChangedFromClient(Uri endpoint, TypeChangedFromClientOptions options) : this(null, endpoint, options) => throw null; + public TypeChangedFromClient(Uri endpoint, TypeChangedFromClientOptions options) => throw null; [Experimental("SCME0002")] - public TypeChangedFromClient(TypeChangedFromClientSettings settings) : this(AuthenticationPolicy.Create(settings), settings?.Endpoint, settings?.Options) => throw null; + public TypeChangedFromClient(TypeChangedFromClientSettings settings) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/typeChangedFrom/v2/src/Generated/TypeChangedFromClient.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/typeChangedFrom/v2/src/Generated/TypeChangedFromClient.cs index bbb62a54e1a..fffac602195 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/typeChangedFrom/v2/src/Generated/TypeChangedFromClient.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/typeChangedFrom/v2/src/Generated/TypeChangedFromClient.cs @@ -15,14 +15,12 @@ public partial class TypeChangedFromClient { protected TypeChangedFromClient() => throw null; - public TypeChangedFromClient(Uri endpoint) : this(endpoint, new TypeChangedFromClientOptions()) => throw null; + public TypeChangedFromClient(Uri endpoint) => throw null; - internal TypeChangedFromClient(AuthenticationPolicy authenticationPolicy, Uri endpoint, TypeChangedFromClientOptions options) => throw null; - - public TypeChangedFromClient(Uri endpoint, TypeChangedFromClientOptions options) : this(null, endpoint, options) => throw null; + public TypeChangedFromClient(Uri endpoint, TypeChangedFromClientOptions options) => throw null; [Experimental("SCME0002")] - public TypeChangedFromClient(TypeChangedFromClientSettings settings) : this(AuthenticationPolicy.Create(settings), settings?.Endpoint, settings?.Options) => throw null; + public TypeChangedFromClient(TypeChangedFromClientSettings settings) => throw null; public ClientPipeline Pipeline => throw null; From 80a9b8db3d5431788bc161a687a14652a56e2c79 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 11 Mar 2026 16:37:43 +0000 Subject: [PATCH 14/38] fix(http-client-csharp): revert StubLibraryVisitor to keep internal ctors; fix _flows reflection test for static field Co-authored-by: JoshLove-msft <54595583+JoshLove-msft@users.noreply.github.com> --- .../src/StubLibraryVisitor.cs | 44 ++- .../Authentication/Union/UnionAuthTests.cs | 6 +- .../api-key/src/Generated/ApiKeyClient.cs | 12 +- .../http/custom/src/Generated/CustomClient.cs | 13 +- .../oauth2/src/Generated/OAuth2Client.cs | 21 +- .../union/src/Generated/UnionClient.cs | 28 +- .../src/Generated/FirstClient.cs | 8 +- .../src/Generated/Group3.cs | 4 + .../src/Generated/Group4.cs | 4 + .../src/Generated/Group5.cs | 4 + .../src/Generated/SubNamespaceSecondClient.cs | 8 +- .../structure/default/src/Generated/Bar.cs | 3 + .../structure/default/src/Generated/Baz.cs | 4 + .../structure/default/src/Generated/BazFoo.cs | 4 + .../structure/default/src/Generated/Foo.cs | 3 + .../structure/default/src/Generated/Qux.cs | 4 + .../structure/default/src/Generated/QuxBar.cs | 4 + .../default/src/Generated/ServiceClient.cs | 8 +- .../src/Generated/ClientAClient.cs | 8 +- .../src/Generated/ClientBClient.cs | 8 +- .../renamed-operation/src/Generated/Group.cs | 4 + .../src/Generated/RenamedOperationClient.cs | 8 +- .../src/Generated/Group1.cs | 4 + .../src/Generated/Group2.cs | 4 + .../src/Generated/TwoOperationGroupClient.cs | 8 +- .../src/Generated/DocumentationClient.cs | 8 +- .../http/documentation/src/Generated/Lists.cs | 3 + .../src/Generated/TextFormatting.cs | 3 + .../encode/array/src/Generated/ArrayClient.cs | 8 +- .../encode/array/src/Generated/Property.cs | 3 + .../encode/bytes/src/Generated/BytesClient.cs | 8 +- .../http/encode/bytes/src/Generated/Header.cs | 2 + .../encode/bytes/src/Generated/Property.cs | 3 + .../http/encode/bytes/src/Generated/Query.cs | 2 + .../encode/bytes/src/Generated/RequestBody.cs | 2 + .../bytes/src/Generated/ResponseBody.cs | 2 + .../datetime/src/Generated/DatetimeClient.cs | 8 +- .../encode/datetime/src/Generated/Header.cs | 2 + .../encode/datetime/src/Generated/Property.cs | 3 + .../encode/datetime/src/Generated/Query.cs | 2 + .../datetime/src/Generated/ResponseHeader.cs | 3 + .../duration/src/Generated/DurationClient.cs | 8 +- .../encode/duration/src/Generated/Header.cs | 2 + .../encode/duration/src/Generated/Property.cs | 3 + .../encode/duration/src/Generated/Query.cs | 2 + .../numeric/src/Generated/NumericClient.cs | 8 +- .../encode/numeric/src/Generated/Property.cs | 3 + .../basic/src/Generated/BasicClient.cs | 8 +- .../basic/src/Generated/ExplicitBody.cs | 3 + .../basic/src/Generated/ImplicitBody.cs | 3 + .../src/Generated/BodyOptionalityClient.cs | 8 +- .../src/Generated/OptionalExplicit.cs | 3 + .../CollectionFormatClient.RestClient.cs | 11 + .../src/Generated/CollectionFormatClient.cs | 52 +++- .../CollectionFormatClientOptions.cs | 16 +- .../CollectionFormatClientSettings.cs | 28 +- .../src/Generated/Header.RestClient.cs | 33 ++ .../collection-format/src/Generated/Header.cs | 88 +++++- .../src/Generated/Internal/Argument.cs | 110 +++++++ .../Internal/CancellationTokenExtensions.cs | 14 + .../Generated/Internal/ChangeTrackingList.cs | 165 ++++++++++ .../Internal/ClientPipelineExtensions.cs | 67 ++++ .../Generated/Internal/ClientUriBuilder.cs | 181 +++++++++++ .../Internal/CodeGenMemberAttribute.cs | 17 ++ .../Internal/CodeGenSerializationAttribute.cs | 45 +++ .../Internal/CodeGenSuppressAttribute.cs | 26 ++ .../Internal/CodeGenTypeAttribute.cs | 21 ++ .../src/Generated/Internal/ErrorResult.cs | 24 ++ .../PipelineRequestHeadersExtensions.cs | 45 +++ .../Generated/Internal/SerializationFormat.cs | 46 +++ .../src/Generated/Internal/TypeFormatters.cs | 178 +++++++++++ .../ParametersCollectionFormatContext.cs | 4 + .../src/Generated/Query.RestClient.cs | 81 +++++ .../collection-format/src/Generated/Query.cs | 286 ++++++++++++++++-- .../path/src/Generated/PathClient.cs | 8 +- .../query/src/Generated/Constant.cs | 3 + .../query/src/Generated/QueryClient.cs | 8 +- .../parameters/spread/src/Generated/Alias.cs | 3 + .../parameters/spread/src/Generated/Model.cs | 3 + .../spread/src/Generated/SpreadClient.cs | 8 +- .../src/Generated/ContentNegotiationClient.cs | 8 +- .../src/Generated/DifferentBody.cs | 2 + .../src/Generated/SameBody.cs | 2 + .../src/Generated/JsonMergePatchClient.cs | 8 +- .../src/Generated/MediaTypeClient.cs | 8 +- .../media-type/src/Generated/StringBody.cs | 3 + .../multipart/src/Generated/FormData.cs | 3 + .../multipart/src/Generated/FormDataFile.cs | 3 + .../src/Generated/FormDataHttpParts.cs | 3 + .../Generated/FormDataHttpPartsContentType.cs | 3 + .../Generated/FormDataHttpPartsNonString.cs | 3 + .../src/Generated/MultiPartClient.cs | 8 +- .../pageable/src/Generated/PageSize.cs | 3 + .../pageable/src/Generated/PageableClient.cs | 8 +- .../src/Generated/ServerDrivenPagination.cs | 3 + ...ServerDrivenPaginationContinuationToken.cs | 3 + .../pageable/src/Generated/XmlPagination.cs | 3 + .../Generated/ModelWithArrayOfModelValue.cs | 3 + .../src/Generated/ModelWithAttributesValue.cs | 3 + .../src/Generated/ModelWithDictionaryValue.cs | 3 + .../src/Generated/ModelWithEmptyArrayValue.cs | 3 + .../Generated/ModelWithEncodedNamesValue.cs | 3 + .../Generated/ModelWithOptionalFieldValue.cs | 3 + .../Generated/ModelWithRenamedArraysValue.cs | 3 + .../Generated/ModelWithRenamedFieldsValue.cs | 3 + .../Generated/ModelWithSimpleArraysValue.cs | 3 + .../xml/src/Generated/ModelWithTextValue.cs | 3 + .../Generated/ModelWithUnwrappedArrayValue.cs | 3 + .../xml/src/Generated/SimpleModelValue.cs | 3 + .../payload/xml/src/Generated/XmlClient.cs | 8 +- .../xml/src/Generated/XmlErrorValue.cs | 3 + .../ResiliencyServiceDrivenClient.cs | 8 +- .../ResiliencyServiceDrivenClient.cs | 8 +- .../src/Generated/StatusCodeRangeClient.cs | 8 +- .../http/routes/src/Generated/InInterface.cs | 3 + .../routes/src/Generated/PathParameters.cs | 3 + .../Generated/PathParametersLabelExpansion.cs | 3 + .../PathParametersLabelExpansionExplode.cs | 3 + .../PathParametersLabelExpansionStandard.cs | 3 + .../PathParametersMatrixExpansion.cs | 3 + .../PathParametersMatrixExpansionExplode.cs | 3 + .../PathParametersMatrixExpansionStandard.cs | 3 + .../Generated/PathParametersPathExpansion.cs | 3 + .../PathParametersPathExpansionExplode.cs | 3 + .../PathParametersPathExpansionStandard.cs | 3 + .../PathParametersReservedExpansion.cs | 3 + .../PathParametersSimpleExpansion.cs | 3 + .../PathParametersSimpleExpansionExplode.cs | 3 + .../PathParametersSimpleExpansionStandard.cs | 3 + .../routes/src/Generated/QueryParameters.cs | 3 + .../QueryParametersQueryContinuation.cs | 3 + ...QueryParametersQueryContinuationExplode.cs | 3 + ...ueryParametersQueryContinuationStandard.cs | 3 + .../QueryParametersQueryExpansion.cs | 3 + .../QueryParametersQueryExpansionExplode.cs | 3 + .../QueryParametersQueryExpansionStandard.cs | 3 + .../http/routes/src/Generated/RoutesClient.cs | 8 +- .../json/src/Generated/JsonClient.cs | 8 +- .../json/src/Generated/Property.cs | 3 + .../src/Generated/NotDefinedClient.cs | 8 +- .../multiple/src/Generated/MultipleClient.cs | 8 +- .../path/single/src/Generated/SingleClient.cs | 8 +- .../src/Generated/NotVersionedClient.cs | 8 +- .../src/Generated/VersionedClient.cs | 8 +- .../src/Generated/ConditionalRequestClient.cs | 8 +- .../src/Generated/RepeatabilityClient.cs | 8 +- .../src/Generated/ModelProperties.cs | 3 + .../special-words/src/Generated/Models.cs | 3 + .../special-words/src/Generated/Operations.cs | 3 + .../special-words/src/Generated/Parameters.cs | 3 + .../src/Generated/SpecialWordsClient.cs | 8 +- .../type/array/src/Generated/ArrayClient.cs | 8 +- .../type/array/src/Generated/BooleanValue.cs | 3 + .../type/array/src/Generated/DatetimeValue.cs | 2 + .../type/array/src/Generated/DurationValue.cs | 2 + .../type/array/src/Generated/Float32Value.cs | 3 + .../type/array/src/Generated/Int32Value.cs | 3 + .../type/array/src/Generated/Int64Value.cs | 3 + .../type/array/src/Generated/ModelValue.cs | 3 + .../src/Generated/NullableBooleanValue.cs | 3 + .../array/src/Generated/NullableFloatValue.cs | 3 + .../array/src/Generated/NullableInt32Value.cs | 3 + .../array/src/Generated/NullableModelValue.cs | 3 + .../src/Generated/NullableStringValue.cs | 3 + .../type/array/src/Generated/StringValue.cs | 3 + .../type/array/src/Generated/UnknownValue.cs | 2 + .../dictionary/src/Generated/BooleanValue.cs | 3 + .../dictionary/src/Generated/DatetimeValue.cs | 2 + .../src/Generated/DictionaryClient.cs | 8 +- .../dictionary/src/Generated/DurationValue.cs | 2 + .../dictionary/src/Generated/Float32Value.cs | 3 + .../dictionary/src/Generated/Int32Value.cs | 3 + .../dictionary/src/Generated/Int64Value.cs | 3 + .../dictionary/src/Generated/ModelValue.cs | 3 + .../src/Generated/NullableFloatValue.cs | 3 + .../src/Generated/RecursiveModelValue.cs | 3 + .../dictionary/src/Generated/StringValue.cs | 3 + .../dictionary/src/Generated/UnknownValue.cs | 2 + .../src/Generated/ExtensibleClient.cs | 8 +- .../enum/extensible/src/Generated/String.cs | 3 + .../enum/fixed/src/Generated/FixedClient.cs | 8 +- .../type/enum/fixed/src/Generated/String.cs | 3 + .../model/empty/src/Generated/EmptyClient.cs | 8 +- .../src/Generated/EnumDiscriminatorClient.cs | 8 +- .../Generated/NestedDiscriminatorClient.cs | 8 +- .../src/Generated/NotDiscriminatedClient.cs | 8 +- .../src/Generated/RecursiveClient.cs | 8 +- .../Generated/SingleDiscriminatorClient.cs | 8 +- .../usage/src/Generated/Internal/Argument.cs | 110 +++++++ .../Internal/CancellationTokenExtensions.cs | 14 + .../Internal/ChangeTrackingDictionary.cs | 186 ++++++++++++ .../Internal/ClientPipelineExtensions.cs | 67 ++++ .../Generated/Internal/ClientUriBuilder.cs | 181 +++++++++++ .../Internal/CodeGenMemberAttribute.cs | 17 ++ .../Internal/CodeGenSerializationAttribute.cs | 45 +++ .../Internal/CodeGenSuppressAttribute.cs | 26 ++ .../Internal/CodeGenTypeAttribute.cs | 21 ++ .../src/Generated/Internal/ErrorResult.cs | 24 ++ .../Internal/ModelSerializationExtensions.cs | 265 ++++++++++++++++ .../Generated/Internal/SerializationFormat.cs | 46 +++ .../src/Generated/Internal/TypeFormatters.cs | 178 +++++++++++ .../Models/InputOutputRecord.Serialization.cs | 144 ++++++++- .../src/Generated/Models/InputOutputRecord.cs | 29 +- .../Models/InputRecord.Serialization.cs | 136 ++++++++- .../usage/src/Generated/Models/InputRecord.cs | 29 +- .../Models/OutputRecord.Serialization.cs | 134 +++++++- .../src/Generated/Models/OutputRecord.cs | 26 +- .../Models/_TypeModelUsageContext.cs | 4 + .../Generated/TypeModelUsageModelFactory.cs | 25 +- .../src/Generated/UsageClient.RestClient.cs | 59 ++++ .../model/usage/src/Generated/UsageClient.cs | 253 ++++++++++++++-- .../usage/src/Generated/UsageClientOptions.cs | 16 +- .../src/Generated/UsageClientSettings.cs | 28 +- .../src/Generated/VisibilityClient.cs | 8 +- .../Generated/AdditionalPropertiesClient.cs | 8 +- .../Generated/ExtendsDifferentSpreadFloat.cs | 3 + .../Generated/ExtendsDifferentSpreadModel.cs | 3 + .../ExtendsDifferentSpreadModelArray.cs | 3 + .../Generated/ExtendsDifferentSpreadString.cs | 3 + .../src/Generated/ExtendsFloat.cs | 3 + .../src/Generated/ExtendsModel.cs | 3 + .../src/Generated/ExtendsModelArray.cs | 3 + .../src/Generated/ExtendsString.cs | 3 + .../src/Generated/ExtendsUnknown.cs | 3 + .../src/Generated/ExtendsUnknownDerived.cs | 3 + .../Generated/ExtendsUnknownDiscriminated.cs | 3 + .../src/Generated/IsFloat.cs | 3 + .../src/Generated/IsModel.cs | 3 + .../src/Generated/IsModelArray.cs | 3 + .../src/Generated/IsString.cs | 3 + .../src/Generated/IsUnknown.cs | 3 + .../src/Generated/IsUnknownDerived.cs | 3 + .../src/Generated/IsUnknownDiscriminated.cs | 3 + .../src/Generated/MultipleSpread.cs | 3 + .../src/Generated/SpreadDifferentFloat.cs | 3 + .../src/Generated/SpreadDifferentModel.cs | 3 + .../Generated/SpreadDifferentModelArray.cs | 3 + .../src/Generated/SpreadDifferentString.cs | 3 + .../src/Generated/SpreadFloat.cs | 3 + .../src/Generated/SpreadModel.cs | 3 + .../src/Generated/SpreadModelArray.cs | 3 + .../SpreadRecordNonDiscriminatedUnion.cs | 3 + .../SpreadRecordNonDiscriminatedUnion2.cs | 3 + .../SpreadRecordNonDiscriminatedUnion3.cs | 3 + .../src/Generated/SpreadRecordUnion.cs | 3 + .../src/Generated/SpreadString.cs | 3 + .../property/nullable/src/Generated/Bytes.cs | 3 + .../nullable/src/Generated/CollectionsByte.cs | 3 + .../src/Generated/CollectionsModel.cs | 3 + .../src/Generated/CollectionsString.cs | 3 + .../nullable/src/Generated/Datetime.cs | 3 + .../nullable/src/Generated/Duration.cs | 3 + .../nullable/src/Generated/NullableClient.cs | 8 +- .../property/nullable/src/Generated/String.cs | 3 + .../src/Generated/BooleanLiteral.cs | 3 + .../optionality/src/Generated/Bytes.cs | 3 + .../src/Generated/CollectionsByte.cs | 3 + .../src/Generated/CollectionsModel.cs | 3 + .../optionality/src/Generated/Datetime.cs | 3 + .../optionality/src/Generated/Duration.cs | 3 + .../optionality/src/Generated/FloatLiteral.cs | 3 + .../optionality/src/Generated/IntLiteral.cs | 3 + .../src/Generated/OptionalClient.cs | 8 +- .../optionality/src/Generated/PlainDate.cs | 3 + .../optionality/src/Generated/PlainTime.cs | 3 + .../src/Generated/RequiredAndOptional.cs | 3 + .../optionality/src/Generated/String.cs | 3 + .../src/Generated/StringLiteral.cs | 3 + .../src/Generated/UnionFloatLiteral.cs | 3 + .../src/Generated/UnionIntLiteral.cs | 3 + .../src/Generated/UnionStringLiteral.cs | 3 + .../value-types/src/Generated/Boolean.cs | 3 + .../src/Generated/BooleanLiteral.cs | 3 + .../value-types/src/Generated/Bytes.cs | 3 + .../src/Generated/CollectionsInt.cs | 3 + .../src/Generated/CollectionsModel.cs | 3 + .../src/Generated/CollectionsString.cs | 3 + .../value-types/src/Generated/Datetime.cs | 3 + .../value-types/src/Generated/Decimal.cs | 3 + .../value-types/src/Generated/Decimal128.cs | 3 + .../src/Generated/DictionaryString.cs | 3 + .../value-types/src/Generated/Duration.cs | 3 + .../value-types/src/Generated/Enum.cs | 3 + .../src/Generated/ExtensibleEnum.cs | 3 + .../value-types/src/Generated/Float.cs | 3 + .../value-types/src/Generated/FloatLiteral.cs | 3 + .../property/value-types/src/Generated/Int.cs | 3 + .../value-types/src/Generated/IntLiteral.cs | 3 + .../value-types/src/Generated/Model.cs | 3 + .../value-types/src/Generated/Never.cs | 3 + .../value-types/src/Generated/String.cs | 3 + .../src/Generated/StringLiteral.cs | 3 + .../src/Generated/UnionEnumValue.cs | 3 + .../src/Generated/UnionFloatLiteral.cs | 3 + .../src/Generated/UnionIntLiteral.cs | 3 + .../src/Generated/UnionStringLiteral.cs | 3 + .../value-types/src/Generated/UnknownArray.cs | 3 + .../value-types/src/Generated/UnknownDict.cs | 3 + .../value-types/src/Generated/UnknownInt.cs | 3 + .../src/Generated/UnknownString.cs | 3 + .../src/Generated/ValueTypesClient.cs | 8 +- .../http/type/scalar/src/Generated/Boolean.cs | 3 + .../scalar/src/Generated/Decimal128Type.cs | 3 + .../scalar/src/Generated/Decimal128Verify.cs | 3 + .../type/scalar/src/Generated/DecimalType.cs | 3 + .../scalar/src/Generated/DecimalVerify.cs | 3 + .../type/scalar/src/Generated/ScalarClient.cs | 8 +- .../http/type/scalar/src/Generated/String.cs | 3 + .../http/type/scalar/src/Generated/Unknown.cs | 2 + .../type/union/src/Generated/EnumsOnly.cs | 3 + .../type/union/src/Generated/FloatsOnly.cs | 3 + .../http/type/union/src/Generated/IntsOnly.cs | 3 + .../type/union/src/Generated/MixedLiterals.cs | 3 + .../type/union/src/Generated/MixedTypes.cs | 3 + .../type/union/src/Generated/ModelsOnly.cs | 2 + .../union/src/Generated/StringAndArray.cs | 3 + .../union/src/Generated/StringExtensible.cs | 3 + .../src/Generated/StringExtensibleNamed.cs | 3 + .../type/union/src/Generated/StringsOnly.cs | 3 + .../type/union/src/Generated/UnionClient.cs | 8 +- .../added/v1/src/Generated/AddedClient.cs | 8 +- .../added/v2/src/Generated/AddedClient.cs | 8 +- .../added/v2/src/Generated/InterfaceV2.cs | 3 + .../v1/src/Generated/MadeOptionalClient.cs | 8 +- .../v2/src/Generated/MadeOptionalClient.cs | 8 +- .../removed/v1/src/Generated/InterfaceV1.cs | 3 + .../removed/v1/src/Generated/RemovedClient.cs | 8 +- .../removed/v2/src/Generated/RemovedClient.cs | 8 +- .../v2Preview/src/Generated/InterfaceV1.cs | 3 + .../v2Preview/src/Generated/RemovedClient.cs | 8 +- .../v1/src/Generated/OldInterface.cs | 3 + .../v1/src/Generated/RenamedFromClient.cs | 8 +- .../v2/src/Generated/NewInterface.cs | 3 + .../v2/src/Generated/RenamedFromClient.cs | 8 +- .../Generated/ReturnTypeChangedFromClient.cs | 8 +- .../Generated/ReturnTypeChangedFromClient.cs | 8 +- .../v1/src/Generated/TypeChangedFromClient.cs | 8 +- .../v2/src/Generated/TypeChangedFromClient.cs | 8 +- 338 files changed, 4531 insertions(+), 376 deletions(-) create mode 100644 packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/collection-format/src/Generated/CollectionFormatClient.RestClient.cs create mode 100644 packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/collection-format/src/Generated/Header.RestClient.cs create mode 100644 packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/collection-format/src/Generated/Internal/Argument.cs create mode 100644 packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/collection-format/src/Generated/Internal/CancellationTokenExtensions.cs create mode 100644 packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/collection-format/src/Generated/Internal/ChangeTrackingList.cs create mode 100644 packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/collection-format/src/Generated/Internal/ClientPipelineExtensions.cs create mode 100644 packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/collection-format/src/Generated/Internal/ClientUriBuilder.cs create mode 100644 packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/collection-format/src/Generated/Internal/CodeGenMemberAttribute.cs create mode 100644 packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/collection-format/src/Generated/Internal/CodeGenSerializationAttribute.cs create mode 100644 packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/collection-format/src/Generated/Internal/CodeGenSuppressAttribute.cs create mode 100644 packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/collection-format/src/Generated/Internal/CodeGenTypeAttribute.cs create mode 100644 packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/collection-format/src/Generated/Internal/ErrorResult.cs create mode 100644 packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/collection-format/src/Generated/Internal/PipelineRequestHeadersExtensions.cs create mode 100644 packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/collection-format/src/Generated/Internal/SerializationFormat.cs create mode 100644 packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/collection-format/src/Generated/Internal/TypeFormatters.cs create mode 100644 packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/collection-format/src/Generated/Query.RestClient.cs create mode 100644 packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/usage/src/Generated/Internal/Argument.cs create mode 100644 packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/usage/src/Generated/Internal/CancellationTokenExtensions.cs create mode 100644 packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/usage/src/Generated/Internal/ChangeTrackingDictionary.cs create mode 100644 packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/usage/src/Generated/Internal/ClientPipelineExtensions.cs create mode 100644 packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/usage/src/Generated/Internal/ClientUriBuilder.cs create mode 100644 packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/usage/src/Generated/Internal/CodeGenMemberAttribute.cs create mode 100644 packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/usage/src/Generated/Internal/CodeGenSerializationAttribute.cs create mode 100644 packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/usage/src/Generated/Internal/CodeGenSuppressAttribute.cs create mode 100644 packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/usage/src/Generated/Internal/CodeGenTypeAttribute.cs create mode 100644 packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/usage/src/Generated/Internal/ErrorResult.cs create mode 100644 packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/usage/src/Generated/Internal/ModelSerializationExtensions.cs create mode 100644 packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/usage/src/Generated/Internal/SerializationFormat.cs create mode 100644 packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/usage/src/Generated/Internal/TypeFormatters.cs create mode 100644 packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/usage/src/Generated/UsageClient.RestClient.cs diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel.StubLibrary/src/StubLibraryVisitor.cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel.StubLibrary/src/StubLibraryVisitor.cs index b440332c224..a24a1b21c42 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel.StubLibrary/src/StubLibraryVisitor.cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel.StubLibrary/src/StubLibraryVisitor.cs @@ -3,6 +3,7 @@ using System; using System.ClientModel.Primitives; +using System.Linq; using Microsoft.TypeSpec.Generator.ClientModel.Providers; using Microsoft.TypeSpec.Generator.Expressions; using Microsoft.TypeSpec.Generator.Primitives; @@ -45,36 +46,26 @@ internal class StubLibraryVisitor : ScmLibraryVisitor if (!IsCallingBaseCtor(constructor) && !IsEffectivelyPublic(constructor.Signature.Modifiers) && !IsParameterlessInternalCtorOnMrwSerializationType(constructor) && + !IsInternalClientConstructor(constructor) && (constructor.EnclosingType is not ModelProvider model || model.DerivedModels.Count == 0)) return null; - // Strip this() initializers from stubs — only base() initializers are preserved. - // The stub body is just `=> throw null!` so this() delegation is unnecessary. - if (constructor.Signature.Initializer is { IsBase: false }) - { - constructor.Update( - signature: new ConstructorSignature( - constructor.Signature.Type, - constructor.Signature.Description, - constructor.Signature.Modifiers, - constructor.Signature.Parameters, - constructor.Signature.Attributes, - initializer: null), - bodyStatements: null, - bodyExpression: _throwNull, - xmlDocs: XmlDocProvider.Empty); - } - else - { - constructor.Update( - bodyStatements: null, - bodyExpression: _throwNull, - xmlDocs: XmlDocProvider.Empty); - } + constructor.Update( + bodyStatements: null, + bodyExpression: _throwNull, + xmlDocs: XmlDocProvider.Empty); return constructor; } + private static bool IsInternalClientConstructor(ConstructorProvider constructor) + { + if (!constructor.Signature.Modifiers.HasFlag(MethodSignatureModifiers.Internal)) + return false; + + return constructor.EnclosingType is ClientProvider; + } + private static bool IsParameterlessInternalCtorOnMrwSerializationType(ConstructorProvider constructor) { if (constructor.Signature.Parameters.Count != 0) @@ -96,8 +87,13 @@ private static bool IsCallingBaseCtor(ConstructorProvider constructor) protected override FieldProvider? VisitField(FieldProvider field) { // For ClientOptions, keep the non-public field as this currently represents the latest service version for a client. + // For ClientProvider, keep const and static fields as they are referenced by stub constructor initializers + // (e.g. AuthorizationHeader const used in this() API key ctor, _flows static used in this() OAuth2 ctor). return (field.Modifiers.HasFlag(FieldModifiers.Public) - || field.EnclosingType.BaseType?.Equals(typeof(ClientPipelineOptions)) == true) + || field.EnclosingType.BaseType?.Equals(typeof(ClientPipelineOptions)) == true + || (field.EnclosingType is ClientProvider + && (field.Modifiers.HasFlag(FieldModifiers.Const) + || field.Modifiers.HasFlag(FieldModifiers.Static)))) ? field : null; } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector.Tests/Http/Authentication/Union/UnionAuthTests.cs b/packages/http-client-csharp/generator/TestProjects/Spector.Tests/Http/Authentication/Union/UnionAuthTests.cs index e95d981e829..00084d6ed77 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector.Tests/Http/Authentication/Union/UnionAuthTests.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector.Tests/Http/Authentication/Union/UnionAuthTests.cs @@ -29,12 +29,12 @@ public Task AuthenticationUnionValidToken() => Test(async (host) => // create a test client to access the private field "_flows". This will be used to pass to the test token provider. var tokenProvider = new ClientCredentialTokenProvider("myClientId", "myClientSecret"); var testClient = new UnionClient(tokenProvider); - var flowsField = testClient.GetType().GetField("_flows", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance); + var flowsField = testClient.GetType().GetField("_flows", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Static); Assert.IsNotNull(flowsField, "Flows field should not be null"); - Assert.IsInstanceOf[]>(flowsField!.GetValue(testClient), "Flows field should be of type Dictionary[]"); + Assert.IsInstanceOf[]>(flowsField!.GetValue(null), "Flows field should be of type Dictionary[]"); // Retrieve the value of the field and cast it to the expected type. - var flows = flowsField!.GetValue(testClient) as Dictionary[]; + var flows = flowsField!.GetValue(null) as Dictionary[]; Assert.IsNotNull(flows, "Flows field should be of type Dictionary[]"); // Parse the generated scope to use in the test. diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/authentication/api-key/src/Generated/ApiKeyClient.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/authentication/api-key/src/Generated/ApiKeyClient.cs index 16a22cda47c..bb90d193964 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/authentication/api-key/src/Generated/ApiKeyClient.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/authentication/api-key/src/Generated/ApiKeyClient.cs @@ -13,16 +13,20 @@ namespace Authentication.ApiKey { public partial class ApiKeyClient { + private const string AuthorizationHeader = "x-ms-api-key"; + protected ApiKeyClient() => throw null; - public ApiKeyClient(ApiKeyCredential credential) => throw null; + public ApiKeyClient(ApiKeyCredential credential) : this(new Uri("http://localhost:3000"), credential, new ApiKeyClientOptions()) => throw null; + + public ApiKeyClient(ApiKeyCredential credential, ApiKeyClientOptions options) : this(new Uri("http://localhost:3000"), credential, options) => throw null; - public ApiKeyClient(ApiKeyCredential credential, ApiKeyClientOptions options) => throw null; + internal ApiKeyClient(AuthenticationPolicy authenticationPolicy, Uri endpoint, ApiKeyClientOptions options) => throw null; - public ApiKeyClient(Uri endpoint, ApiKeyCredential credential, ApiKeyClientOptions options) => throw null; + public ApiKeyClient(Uri endpoint, ApiKeyCredential credential, ApiKeyClientOptions options) : this(ApiKeyAuthenticationPolicy.CreateHeaderApiKeyPolicy(credential, AuthorizationHeader), endpoint, options) => throw null; [Experimental("SCME0002")] - public ApiKeyClient(ApiKeyClientSettings settings) => throw null; + public ApiKeyClient(ApiKeyClientSettings settings) : this(AuthenticationPolicy.Create(settings), settings?.Endpoint, settings?.Options) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/authentication/http/custom/src/Generated/CustomClient.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/authentication/http/custom/src/Generated/CustomClient.cs index f4afaefada7..25ff19d43b1 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/authentication/http/custom/src/Generated/CustomClient.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/authentication/http/custom/src/Generated/CustomClient.cs @@ -13,16 +13,21 @@ namespace Authentication.Http.Custom { public partial class CustomClient { + private const string AuthorizationHeader = "Authorization"; + private const string AuthorizationApiKeyPrefix = "SharedAccessKey"; + protected CustomClient() => throw null; - public CustomClient(ApiKeyCredential credential) => throw null; + public CustomClient(ApiKeyCredential credential) : this(new Uri("http://localhost:3000"), credential, new CustomClientOptions()) => throw null; + + public CustomClient(ApiKeyCredential credential, CustomClientOptions options) : this(new Uri("http://localhost:3000"), credential, options) => throw null; - public CustomClient(ApiKeyCredential credential, CustomClientOptions options) => throw null; + internal CustomClient(AuthenticationPolicy authenticationPolicy, Uri endpoint, CustomClientOptions options) => throw null; - public CustomClient(Uri endpoint, ApiKeyCredential credential, CustomClientOptions options) => throw null; + public CustomClient(Uri endpoint, ApiKeyCredential credential, CustomClientOptions options) : this(ApiKeyAuthenticationPolicy.CreateHeaderApiKeyPolicy(credential, AuthorizationHeader, AuthorizationApiKeyPrefix), endpoint, options) => throw null; [Experimental("SCME0002")] - public CustomClient(CustomClientSettings settings) => throw null; + public CustomClient(CustomClientSettings settings) : this(AuthenticationPolicy.Create(settings), settings?.Endpoint, settings?.Options) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/authentication/oauth2/src/Generated/OAuth2Client.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/authentication/oauth2/src/Generated/OAuth2Client.cs index 93db86e7cf5..0b34d500610 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/authentication/oauth2/src/Generated/OAuth2Client.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/authentication/oauth2/src/Generated/OAuth2Client.cs @@ -5,6 +5,7 @@ using System; using System.ClientModel; using System.ClientModel.Primitives; +using System.Collections.Generic; using System.Diagnostics.CodeAnalysis; using System.Threading; using System.Threading.Tasks; @@ -13,16 +14,28 @@ namespace Authentication.OAuth2 { public partial class OAuth2Client { + /// The OAuth2 flows supported by the service. + private static readonly Dictionary[] _flows = new Dictionary[] + { + new Dictionary + { + { GetTokenOptions.ScopesPropertyName, new string[] { "https://security.microsoft.com/.default" } }, + { GetTokenOptions.AuthorizationUrlPropertyName, "https://login.microsoftonline.com/common/oauth2/authorize" } + } + }; + protected OAuth2Client() => throw null; - public OAuth2Client(AuthenticationTokenProvider tokenProvider) => throw null; + public OAuth2Client(AuthenticationTokenProvider tokenProvider) : this(new Uri("http://localhost:3000"), tokenProvider, new OAuth2ClientOptions()) => throw null; + + public OAuth2Client(AuthenticationTokenProvider tokenProvider, OAuth2ClientOptions options) : this(new Uri("http://localhost:3000"), tokenProvider, options) => throw null; - public OAuth2Client(AuthenticationTokenProvider tokenProvider, OAuth2ClientOptions options) => throw null; + internal OAuth2Client(AuthenticationPolicy authenticationPolicy, Uri endpoint, OAuth2ClientOptions options) => throw null; - public OAuth2Client(Uri endpoint, AuthenticationTokenProvider tokenProvider, OAuth2ClientOptions options) => throw null; + public OAuth2Client(Uri endpoint, AuthenticationTokenProvider tokenProvider, OAuth2ClientOptions options) : this(new BearerTokenPolicy(tokenProvider, _flows), endpoint, options) => throw null; [Experimental("SCME0002")] - public OAuth2Client(OAuth2ClientSettings settings) => throw null; + public OAuth2Client(OAuth2ClientSettings settings) : this(AuthenticationPolicy.Create(settings), settings?.Endpoint, settings?.Options) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/authentication/union/src/Generated/UnionClient.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/authentication/union/src/Generated/UnionClient.cs index dad80c4f39b..cf14844ba08 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/authentication/union/src/Generated/UnionClient.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/authentication/union/src/Generated/UnionClient.cs @@ -5,6 +5,7 @@ using System; using System.ClientModel; using System.ClientModel.Primitives; +using System.Collections.Generic; using System.Diagnostics.CodeAnalysis; using System.Threading; using System.Threading.Tasks; @@ -13,22 +14,35 @@ namespace Authentication.Union { public partial class UnionClient { + private const string AuthorizationHeader = "x-ms-api-key"; + /// The OAuth2 flows supported by the service. + private static readonly Dictionary[] _flows = new Dictionary[] + { + new Dictionary + { + { GetTokenOptions.ScopesPropertyName, new string[] { "https://security.microsoft.com/.default" } }, + { GetTokenOptions.AuthorizationUrlPropertyName, "https://login.microsoftonline.com/common/oauth2/authorize" } + } + }; + protected UnionClient() => throw null; - public UnionClient(ApiKeyCredential credential) => throw null; + public UnionClient(ApiKeyCredential credential) : this(new Uri("http://localhost:3000"), credential, new UnionClientOptions()) => throw null; + + public UnionClient(ApiKeyCredential credential, UnionClientOptions options) : this(new Uri("http://localhost:3000"), credential, options) => throw null; - public UnionClient(ApiKeyCredential credential, UnionClientOptions options) => throw null; + public UnionClient(AuthenticationTokenProvider tokenProvider) : this(new Uri("http://localhost:3000"), tokenProvider, new UnionClientOptions()) => throw null; - public UnionClient(AuthenticationTokenProvider tokenProvider) => throw null; + public UnionClient(AuthenticationTokenProvider tokenProvider, UnionClientOptions options) : this(new Uri("http://localhost:3000"), tokenProvider, options) => throw null; - public UnionClient(AuthenticationTokenProvider tokenProvider, UnionClientOptions options) => throw null; + internal UnionClient(AuthenticationPolicy authenticationPolicy, Uri endpoint, UnionClientOptions options) => throw null; - public UnionClient(Uri endpoint, ApiKeyCredential credential, UnionClientOptions options) => throw null; + public UnionClient(Uri endpoint, ApiKeyCredential credential, UnionClientOptions options) : this(ApiKeyAuthenticationPolicy.CreateHeaderApiKeyPolicy(credential, AuthorizationHeader), endpoint, options) => throw null; - public UnionClient(Uri endpoint, AuthenticationTokenProvider tokenProvider, UnionClientOptions options) => throw null; + public UnionClient(Uri endpoint, AuthenticationTokenProvider tokenProvider, UnionClientOptions options) : this(new BearerTokenPolicy(tokenProvider, _flows), endpoint, options) => throw null; [Experimental("SCME0002")] - public UnionClient(UnionClientSettings settings) => throw null; + public UnionClient(UnionClientSettings settings) : this(AuthenticationPolicy.Create(settings), settings?.Endpoint, settings?.Options) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/client-operation-group/src/Generated/FirstClient.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/client-operation-group/src/Generated/FirstClient.cs index e8843114291..0ae16d068ff 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/client-operation-group/src/Generated/FirstClient.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/client-operation-group/src/Generated/FirstClient.cs @@ -16,12 +16,14 @@ public partial class FirstClient { protected FirstClient() => throw null; - public FirstClient(Uri endpoint, ClientType client) => throw null; + public FirstClient(Uri endpoint, ClientType client) : this(endpoint, client, new FirstClientOptions()) => throw null; - public FirstClient(Uri endpoint, ClientType client, FirstClientOptions options) => throw null; + internal FirstClient(AuthenticationPolicy authenticationPolicy, Uri endpoint, ClientType client, FirstClientOptions options) => throw null; + + public FirstClient(Uri endpoint, ClientType client, FirstClientOptions options) : this(null, endpoint, client, options) => throw null; [Experimental("SCME0002")] - public FirstClient(FirstClientSettings settings) => throw null; + public FirstClient(FirstClientSettings settings) : this(AuthenticationPolicy.Create(settings), settings?.Endpoint, settings?.Client ?? default, settings?.Options) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/client-operation-group/src/Generated/Group3.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/client-operation-group/src/Generated/Group3.cs index 36f592b901d..424b1f729bd 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/client-operation-group/src/Generated/Group3.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/client-operation-group/src/Generated/Group3.cs @@ -2,10 +2,12 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; using System.Threading.Tasks; +using Client.Structure.Service; namespace Client.Structure.ClientOperationGroup { @@ -13,6 +15,8 @@ public partial class Group3 { protected Group3() => throw null; + internal Group3(ClientPipeline pipeline, Uri endpoint, ClientType client) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult Two(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/client-operation-group/src/Generated/Group4.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/client-operation-group/src/Generated/Group4.cs index 5470b3bbc52..6f372e14c53 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/client-operation-group/src/Generated/Group4.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/client-operation-group/src/Generated/Group4.cs @@ -2,10 +2,12 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; using System.Threading.Tasks; +using Client.Structure.Service; namespace Client.Structure.ClientOperationGroup { @@ -13,6 +15,8 @@ public partial class Group4 { protected Group4() => throw null; + internal Group4(ClientPipeline pipeline, Uri endpoint, ClientType client) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult Four(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/client-operation-group/src/Generated/Group5.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/client-operation-group/src/Generated/Group5.cs index eb10cff56a7..16a035048f3 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/client-operation-group/src/Generated/Group5.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/client-operation-group/src/Generated/Group5.cs @@ -2,10 +2,12 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; using System.Threading.Tasks; +using Client.Structure.Service; namespace Client.Structure.AnotherClientOperationGroup { @@ -13,6 +15,8 @@ public partial class Group5 { protected Group5() => throw null; + internal Group5(ClientPipeline pipeline, Uri endpoint, ClientType client) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult Six(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/client-operation-group/src/Generated/SubNamespaceSecondClient.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/client-operation-group/src/Generated/SubNamespaceSecondClient.cs index 008771e23e5..693eca9df30 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/client-operation-group/src/Generated/SubNamespaceSecondClient.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/client-operation-group/src/Generated/SubNamespaceSecondClient.cs @@ -16,12 +16,14 @@ public partial class SubNamespaceSecondClient { protected SubNamespaceSecondClient() => throw null; - public SubNamespaceSecondClient(Uri endpoint, ClientType client) => throw null; + public SubNamespaceSecondClient(Uri endpoint, ClientType client) : this(endpoint, client, new SubNamespaceSecondClientOptions()) => throw null; - public SubNamespaceSecondClient(Uri endpoint, ClientType client, SubNamespaceSecondClientOptions options) => throw null; + internal SubNamespaceSecondClient(AuthenticationPolicy authenticationPolicy, Uri endpoint, ClientType client, SubNamespaceSecondClientOptions options) => throw null; + + public SubNamespaceSecondClient(Uri endpoint, ClientType client, SubNamespaceSecondClientOptions options) : this(null, endpoint, client, options) => throw null; [Experimental("SCME0002")] - public SubNamespaceSecondClient(SubNamespaceSecondClientSettings settings) => throw null; + public SubNamespaceSecondClient(SubNamespaceSecondClientSettings settings) : this(AuthenticationPolicy.Create(settings), settings?.Endpoint, settings?.Client ?? default, settings?.Options) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/default/src/Generated/Bar.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/default/src/Generated/Bar.cs index b477c997e2f..ecb520de880 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/default/src/Generated/Bar.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/default/src/Generated/Bar.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -13,6 +14,8 @@ public partial class Bar { protected Bar() => throw null; + internal Bar(ClientPipeline pipeline, Uri endpoint, ClientType client) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult Five(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/default/src/Generated/Baz.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/default/src/Generated/Baz.cs index c13fd297ec5..9846828d6a2 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/default/src/Generated/Baz.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/default/src/Generated/Baz.cs @@ -2,7 +2,9 @@ #nullable disable +using System; using System.ClientModel.Primitives; +using Client.Structure.Service; namespace Client.Structure.Service._Baz { @@ -10,6 +12,8 @@ public partial class Baz { protected Baz() => throw null; + internal Baz(ClientPipeline pipeline, Uri endpoint, ClientType client) => throw null; + public ClientPipeline Pipeline => throw null; public virtual BazFoo GetBazFooClient() => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/default/src/Generated/BazFoo.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/default/src/Generated/BazFoo.cs index 6ed62d51d4e..4b8d81d5939 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/default/src/Generated/BazFoo.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/default/src/Generated/BazFoo.cs @@ -2,10 +2,12 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; using System.Threading.Tasks; +using Client.Structure.Service; namespace Client.Structure.Service._Baz { @@ -13,6 +15,8 @@ public partial class BazFoo { protected BazFoo() => throw null; + internal BazFoo(ClientPipeline pipeline, Uri endpoint, ClientType client) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult Seven(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/default/src/Generated/Foo.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/default/src/Generated/Foo.cs index 4989e29298c..40c3caa537f 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/default/src/Generated/Foo.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/default/src/Generated/Foo.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -13,6 +14,8 @@ public partial class Foo { protected Foo() => throw null; + internal Foo(ClientPipeline pipeline, Uri endpoint, ClientType client) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult Three(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/default/src/Generated/Qux.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/default/src/Generated/Qux.cs index e94b919e17f..886bf284df7 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/default/src/Generated/Qux.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/default/src/Generated/Qux.cs @@ -2,10 +2,12 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; using System.Threading.Tasks; +using Client.Structure.Service; namespace Client.Structure.Service._Qux { @@ -13,6 +15,8 @@ public partial class Qux { protected Qux() => throw null; + internal Qux(ClientPipeline pipeline, Uri endpoint, ClientType client) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult Eight(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/default/src/Generated/QuxBar.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/default/src/Generated/QuxBar.cs index 1cf32f91487..5b7bc794ae7 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/default/src/Generated/QuxBar.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/default/src/Generated/QuxBar.cs @@ -2,10 +2,12 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; using System.Threading.Tasks; +using Client.Structure.Service; namespace Client.Structure.Service._Qux { @@ -13,6 +15,8 @@ public partial class QuxBar { protected QuxBar() => throw null; + internal QuxBar(ClientPipeline pipeline, Uri endpoint, ClientType client) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult Nine(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/default/src/Generated/ServiceClient.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/default/src/Generated/ServiceClient.cs index 002f116b958..7dd25ed35c3 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/default/src/Generated/ServiceClient.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/default/src/Generated/ServiceClient.cs @@ -17,12 +17,14 @@ public partial class ServiceClient { protected ServiceClient() => throw null; - public ServiceClient(Uri endpoint, ClientType client) => throw null; + public ServiceClient(Uri endpoint, ClientType client) : this(endpoint, client, new ServiceClientOptions()) => throw null; - public ServiceClient(Uri endpoint, ClientType client, ServiceClientOptions options) => throw null; + internal ServiceClient(AuthenticationPolicy authenticationPolicy, Uri endpoint, ClientType client, ServiceClientOptions options) => throw null; + + public ServiceClient(Uri endpoint, ClientType client, ServiceClientOptions options) : this(null, endpoint, client, options) => throw null; [Experimental("SCME0002")] - public ServiceClient(ServiceClientSettings settings) => throw null; + public ServiceClient(ServiceClientSettings settings) : this(AuthenticationPolicy.Create(settings), settings?.Endpoint, settings?.Client ?? default, settings?.Options) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/multi-client/src/Generated/ClientAClient.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/multi-client/src/Generated/ClientAClient.cs index ad8883a48e0..8c586cc178c 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/multi-client/src/Generated/ClientAClient.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/multi-client/src/Generated/ClientAClient.cs @@ -16,12 +16,14 @@ public partial class ClientAClient { protected ClientAClient() => throw null; - public ClientAClient(Uri endpoint, ClientType client) => throw null; + public ClientAClient(Uri endpoint, ClientType client) : this(endpoint, client, new ClientAClientOptions()) => throw null; - public ClientAClient(Uri endpoint, ClientType client, ClientAClientOptions options) => throw null; + internal ClientAClient(AuthenticationPolicy authenticationPolicy, Uri endpoint, ClientType client, ClientAClientOptions options) => throw null; + + public ClientAClient(Uri endpoint, ClientType client, ClientAClientOptions options) : this(null, endpoint, client, options) => throw null; [Experimental("SCME0002")] - public ClientAClient(ClientAClientSettings settings) => throw null; + public ClientAClient(ClientAClientSettings settings) : this(AuthenticationPolicy.Create(settings), settings?.Endpoint, settings?.Client ?? default, settings?.Options) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/multi-client/src/Generated/ClientBClient.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/multi-client/src/Generated/ClientBClient.cs index cea7a426dbd..603a41b38b0 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/multi-client/src/Generated/ClientBClient.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/multi-client/src/Generated/ClientBClient.cs @@ -16,12 +16,14 @@ public partial class ClientBClient { protected ClientBClient() => throw null; - public ClientBClient(Uri endpoint, ClientType client) => throw null; + public ClientBClient(Uri endpoint, ClientType client) : this(endpoint, client, new ClientBClientOptions()) => throw null; - public ClientBClient(Uri endpoint, ClientType client, ClientBClientOptions options) => throw null; + internal ClientBClient(AuthenticationPolicy authenticationPolicy, Uri endpoint, ClientType client, ClientBClientOptions options) => throw null; + + public ClientBClient(Uri endpoint, ClientType client, ClientBClientOptions options) : this(null, endpoint, client, options) => throw null; [Experimental("SCME0002")] - public ClientBClient(ClientBClientSettings settings) => throw null; + public ClientBClient(ClientBClientSettings settings) : this(AuthenticationPolicy.Create(settings), settings?.Endpoint, settings?.Client ?? default, settings?.Options) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/renamed-operation/src/Generated/Group.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/renamed-operation/src/Generated/Group.cs index 43d04d3edb0..f9ce619bfe6 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/renamed-operation/src/Generated/Group.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/renamed-operation/src/Generated/Group.cs @@ -2,10 +2,12 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; using System.Threading.Tasks; +using Client.Structure.Service; namespace Client.Structure.RenamedOperation { @@ -13,6 +15,8 @@ public partial class Group { protected Group() => throw null; + internal Group(ClientPipeline pipeline, Uri endpoint, ClientType client) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult RenamedTwo(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/renamed-operation/src/Generated/RenamedOperationClient.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/renamed-operation/src/Generated/RenamedOperationClient.cs index 7c7ae48d485..a3aa6ae6103 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/renamed-operation/src/Generated/RenamedOperationClient.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/renamed-operation/src/Generated/RenamedOperationClient.cs @@ -16,12 +16,14 @@ public partial class RenamedOperationClient { protected RenamedOperationClient() => throw null; - public RenamedOperationClient(Uri endpoint, ClientType client) => throw null; + public RenamedOperationClient(Uri endpoint, ClientType client) : this(endpoint, client, new RenamedOperationClientOptions()) => throw null; - public RenamedOperationClient(Uri endpoint, ClientType client, RenamedOperationClientOptions options) => throw null; + internal RenamedOperationClient(AuthenticationPolicy authenticationPolicy, Uri endpoint, ClientType client, RenamedOperationClientOptions options) => throw null; + + public RenamedOperationClient(Uri endpoint, ClientType client, RenamedOperationClientOptions options) : this(null, endpoint, client, options) => throw null; [Experimental("SCME0002")] - public RenamedOperationClient(RenamedOperationClientSettings settings) => throw null; + public RenamedOperationClient(RenamedOperationClientSettings settings) : this(AuthenticationPolicy.Create(settings), settings?.Endpoint, settings?.Client ?? default, settings?.Options) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/two-operation-group/src/Generated/Group1.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/two-operation-group/src/Generated/Group1.cs index 4657d169616..292fd14c3c6 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/two-operation-group/src/Generated/Group1.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/two-operation-group/src/Generated/Group1.cs @@ -2,10 +2,12 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; using System.Threading.Tasks; +using Client.Structure.Service; namespace Client.Structure.TwoOperationGroup { @@ -13,6 +15,8 @@ public partial class Group1 { protected Group1() => throw null; + internal Group1(ClientPipeline pipeline, Uri endpoint, ClientType client) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult One(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/two-operation-group/src/Generated/Group2.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/two-operation-group/src/Generated/Group2.cs index 783310627ed..9b04ac2eba9 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/two-operation-group/src/Generated/Group2.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/two-operation-group/src/Generated/Group2.cs @@ -2,10 +2,12 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; using System.Threading.Tasks; +using Client.Structure.Service; namespace Client.Structure.TwoOperationGroup { @@ -13,6 +15,8 @@ public partial class Group2 { protected Group2() => throw null; + internal Group2(ClientPipeline pipeline, Uri endpoint, ClientType client) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult Two(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/two-operation-group/src/Generated/TwoOperationGroupClient.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/two-operation-group/src/Generated/TwoOperationGroupClient.cs index 026c4a176f1..a5ae0dae401 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/two-operation-group/src/Generated/TwoOperationGroupClient.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/two-operation-group/src/Generated/TwoOperationGroupClient.cs @@ -13,12 +13,14 @@ public partial class TwoOperationGroupClient { protected TwoOperationGroupClient() => throw null; - public TwoOperationGroupClient(Uri endpoint, ClientType client) => throw null; + public TwoOperationGroupClient(Uri endpoint, ClientType client) : this(endpoint, client, new TwoOperationGroupClientOptions()) => throw null; - public TwoOperationGroupClient(Uri endpoint, ClientType client, TwoOperationGroupClientOptions options) => throw null; + internal TwoOperationGroupClient(AuthenticationPolicy authenticationPolicy, Uri endpoint, ClientType client, TwoOperationGroupClientOptions options) => throw null; + + public TwoOperationGroupClient(Uri endpoint, ClientType client, TwoOperationGroupClientOptions options) : this(null, endpoint, client, options) => throw null; [Experimental("SCME0002")] - public TwoOperationGroupClient(TwoOperationGroupClientSettings settings) => throw null; + public TwoOperationGroupClient(TwoOperationGroupClientSettings settings) : this(AuthenticationPolicy.Create(settings), settings?.Endpoint, settings?.Client ?? default, settings?.Options) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/documentation/src/Generated/DocumentationClient.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/documentation/src/Generated/DocumentationClient.cs index ab3274eb4ba..a666718a60c 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/documentation/src/Generated/DocumentationClient.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/documentation/src/Generated/DocumentationClient.cs @@ -12,12 +12,14 @@ namespace Documentation { public partial class DocumentationClient { - public DocumentationClient() => throw null; + public DocumentationClient() : this(new Uri("http://localhost:3000"), new DocumentationClientOptions()) => throw null; - public DocumentationClient(Uri endpoint, DocumentationClientOptions options) => throw null; + internal DocumentationClient(AuthenticationPolicy authenticationPolicy, Uri endpoint, DocumentationClientOptions options) => throw null; + + public DocumentationClient(Uri endpoint, DocumentationClientOptions options) : this(null, endpoint, options) => throw null; [Experimental("SCME0002")] - public DocumentationClient(DocumentationClientSettings settings) => throw null; + public DocumentationClient(DocumentationClientSettings settings) : this(AuthenticationPolicy.Create(settings), settings?.Endpoint, settings?.Options) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/documentation/src/Generated/Lists.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/documentation/src/Generated/Lists.cs index 34bf1c4e427..448bdd8c7c6 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/documentation/src/Generated/Lists.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/documentation/src/Generated/Lists.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -13,6 +14,8 @@ public partial class Lists { protected Lists() => throw null; + internal Lists(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult BulletPointsOp(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/documentation/src/Generated/TextFormatting.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/documentation/src/Generated/TextFormatting.cs index 6fb8a1e8646..d2190f98461 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/documentation/src/Generated/TextFormatting.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/documentation/src/Generated/TextFormatting.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -13,6 +14,8 @@ public partial class TextFormatting { protected TextFormatting() => throw null; + internal TextFormatting(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult BoldText(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/array/src/Generated/ArrayClient.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/array/src/Generated/ArrayClient.cs index a00e84e8e78..be13cf124dd 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/array/src/Generated/ArrayClient.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/array/src/Generated/ArrayClient.cs @@ -11,12 +11,14 @@ namespace Encode._Array { public partial class ArrayClient { - public ArrayClient() => throw null; + public ArrayClient() : this(new Uri("http://localhost:3000"), new ArrayClientOptions()) => throw null; - public ArrayClient(Uri endpoint, ArrayClientOptions options) => throw null; + internal ArrayClient(AuthenticationPolicy authenticationPolicy, Uri endpoint, ArrayClientOptions options) => throw null; + + public ArrayClient(Uri endpoint, ArrayClientOptions options) : this(null, endpoint, options) => throw null; [Experimental("SCME0002")] - public ArrayClient(ArrayClientSettings settings) => throw null; + public ArrayClient(ArrayClientSettings settings) : this(AuthenticationPolicy.Create(settings), settings?.Endpoint, settings?.Options) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/array/src/Generated/Property.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/array/src/Generated/Property.cs index 11ac1e8bde6..cca72b3496d 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/array/src/Generated/Property.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/array/src/Generated/Property.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -14,6 +15,8 @@ public partial class Property { protected Property() => throw null; + internal Property(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult CommaDelimited(BinaryContent content, RequestOptions options = null) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/bytes/src/Generated/BytesClient.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/bytes/src/Generated/BytesClient.cs index 175395c97b7..66889ea19e6 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/bytes/src/Generated/BytesClient.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/bytes/src/Generated/BytesClient.cs @@ -15,12 +15,14 @@ namespace Encode.Bytes { public partial class BytesClient { - public BytesClient() => throw null; + public BytesClient() : this(new Uri("http://localhost:3000"), new BytesClientOptions()) => throw null; - public BytesClient(Uri endpoint, BytesClientOptions options) => throw null; + internal BytesClient(AuthenticationPolicy authenticationPolicy, Uri endpoint, BytesClientOptions options) => throw null; + + public BytesClient(Uri endpoint, BytesClientOptions options) : this(null, endpoint, options) => throw null; [Experimental("SCME0002")] - public BytesClient(BytesClientSettings settings) => throw null; + public BytesClient(BytesClientSettings settings) : this(AuthenticationPolicy.Create(settings), settings?.Endpoint, settings?.Options) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/bytes/src/Generated/Header.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/bytes/src/Generated/Header.cs index 04f54e9db06..fd23134b48c 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/bytes/src/Generated/Header.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/bytes/src/Generated/Header.cs @@ -15,6 +15,8 @@ public partial class Header { protected Header() => throw null; + internal Header(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult Default(BinaryData value, RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/bytes/src/Generated/Property.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/bytes/src/Generated/Property.cs index cd447f162f2..98856cd5b6c 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/bytes/src/Generated/Property.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/bytes/src/Generated/Property.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -14,6 +15,8 @@ public partial class Property { protected Property() => throw null; + internal Property(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult Default(BinaryContent content, RequestOptions options = null) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/bytes/src/Generated/Query.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/bytes/src/Generated/Query.cs index e833cb0b334..a4bdf915ccf 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/bytes/src/Generated/Query.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/bytes/src/Generated/Query.cs @@ -15,6 +15,8 @@ public partial class Query { protected Query() => throw null; + internal Query(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult Default(BinaryData value, RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/bytes/src/Generated/RequestBody.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/bytes/src/Generated/RequestBody.cs index 8f2b981bd11..11350490a12 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/bytes/src/Generated/RequestBody.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/bytes/src/Generated/RequestBody.cs @@ -14,6 +14,8 @@ public partial class RequestBody { protected RequestBody() => throw null; + internal RequestBody(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult Default(BinaryContent content, RequestOptions options = null) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/bytes/src/Generated/ResponseBody.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/bytes/src/Generated/ResponseBody.cs index d61d52ae44f..2ccbb28aadf 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/bytes/src/Generated/ResponseBody.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/bytes/src/Generated/ResponseBody.cs @@ -14,6 +14,8 @@ public partial class ResponseBody { protected ResponseBody() => throw null; + internal ResponseBody(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult Default(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/datetime/src/Generated/DatetimeClient.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/datetime/src/Generated/DatetimeClient.cs index 0b9e20658cc..52989bc8104 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/datetime/src/Generated/DatetimeClient.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/datetime/src/Generated/DatetimeClient.cs @@ -14,12 +14,14 @@ namespace Encode.Datetime { public partial class DatetimeClient { - public DatetimeClient() => throw null; + public DatetimeClient() : this(new Uri("http://localhost:3000"), new DatetimeClientOptions()) => throw null; - public DatetimeClient(Uri endpoint, DatetimeClientOptions options) => throw null; + internal DatetimeClient(AuthenticationPolicy authenticationPolicy, Uri endpoint, DatetimeClientOptions options) => throw null; + + public DatetimeClient(Uri endpoint, DatetimeClientOptions options) : this(null, endpoint, options) => throw null; [Experimental("SCME0002")] - public DatetimeClient(DatetimeClientSettings settings) => throw null; + public DatetimeClient(DatetimeClientSettings settings) : this(AuthenticationPolicy.Create(settings), settings?.Endpoint, settings?.Options) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/datetime/src/Generated/Header.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/datetime/src/Generated/Header.cs index 5fb8d90bc90..73e83a93a8d 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/datetime/src/Generated/Header.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/datetime/src/Generated/Header.cs @@ -15,6 +15,8 @@ public partial class Header { protected Header() => throw null; + internal Header(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult Default(DateTimeOffset value, RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/datetime/src/Generated/Property.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/datetime/src/Generated/Property.cs index 2a05e4eb487..178a86cf0b2 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/datetime/src/Generated/Property.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/datetime/src/Generated/Property.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -14,6 +15,8 @@ public partial class Property { protected Property() => throw null; + internal Property(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult Default(BinaryContent content, RequestOptions options = null) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/datetime/src/Generated/Query.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/datetime/src/Generated/Query.cs index 797db67529f..2e39c63316f 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/datetime/src/Generated/Query.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/datetime/src/Generated/Query.cs @@ -15,6 +15,8 @@ public partial class Query { protected Query() => throw null; + internal Query(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult Default(DateTimeOffset value, RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/datetime/src/Generated/ResponseHeader.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/datetime/src/Generated/ResponseHeader.cs index 01d39032c85..0f6c15d6f9e 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/datetime/src/Generated/ResponseHeader.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/datetime/src/Generated/ResponseHeader.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -13,6 +14,8 @@ public partial class ResponseHeader { protected ResponseHeader() => throw null; + internal ResponseHeader(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult Default(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/duration/src/Generated/DurationClient.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/duration/src/Generated/DurationClient.cs index 445f0e3aabb..efdd9208ab4 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/duration/src/Generated/DurationClient.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/duration/src/Generated/DurationClient.cs @@ -13,12 +13,14 @@ namespace Encode.Duration { public partial class DurationClient { - public DurationClient() => throw null; + public DurationClient() : this(new Uri("http://localhost:3000"), new DurationClientOptions()) => throw null; - public DurationClient(Uri endpoint, DurationClientOptions options) => throw null; + internal DurationClient(AuthenticationPolicy authenticationPolicy, Uri endpoint, DurationClientOptions options) => throw null; + + public DurationClient(Uri endpoint, DurationClientOptions options) : this(null, endpoint, options) => throw null; [Experimental("SCME0002")] - public DurationClient(DurationClientSettings settings) => throw null; + public DurationClient(DurationClientSettings settings) : this(AuthenticationPolicy.Create(settings), settings?.Endpoint, settings?.Options) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/duration/src/Generated/Header.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/duration/src/Generated/Header.cs index f8b13ad6053..60aaa9d639d 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/duration/src/Generated/Header.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/duration/src/Generated/Header.cs @@ -15,6 +15,8 @@ public partial class Header { protected Header() => throw null; + internal Header(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult Default(TimeSpan duration, RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/duration/src/Generated/Property.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/duration/src/Generated/Property.cs index 68a98785695..5932c8916b1 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/duration/src/Generated/Property.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/duration/src/Generated/Property.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -13,6 +14,8 @@ public partial class Property { protected Property() => throw null; + internal Property(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult Default(BinaryContent content, RequestOptions options = null) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/duration/src/Generated/Query.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/duration/src/Generated/Query.cs index ab8d0db30f9..3389d4bc03c 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/duration/src/Generated/Query.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/duration/src/Generated/Query.cs @@ -15,6 +15,8 @@ public partial class Query { protected Query() => throw null; + internal Query(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult Default(TimeSpan input, RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/numeric/src/Generated/NumericClient.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/numeric/src/Generated/NumericClient.cs index e4ada4e9e93..62c37a7e84d 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/numeric/src/Generated/NumericClient.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/numeric/src/Generated/NumericClient.cs @@ -11,12 +11,14 @@ namespace Encode.Numeric { public partial class NumericClient { - public NumericClient() => throw null; + public NumericClient() : this(new Uri("http://localhost:3000"), new NumericClientOptions()) => throw null; - public NumericClient(Uri endpoint, NumericClientOptions options) => throw null; + internal NumericClient(AuthenticationPolicy authenticationPolicy, Uri endpoint, NumericClientOptions options) => throw null; + + public NumericClient(Uri endpoint, NumericClientOptions options) : this(null, endpoint, options) => throw null; [Experimental("SCME0002")] - public NumericClient(NumericClientSettings settings) => throw null; + public NumericClient(NumericClientSettings settings) : this(AuthenticationPolicy.Create(settings), settings?.Endpoint, settings?.Options) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/numeric/src/Generated/Property.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/numeric/src/Generated/Property.cs index 49349a4add9..a24512ae6df 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/numeric/src/Generated/Property.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/numeric/src/Generated/Property.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -13,6 +14,8 @@ public partial class Property { protected Property() => throw null; + internal Property(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult SafeintAsString(BinaryContent content, RequestOptions options = null) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/basic/src/Generated/BasicClient.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/basic/src/Generated/BasicClient.cs index 05b19fd618c..14502febffd 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/basic/src/Generated/BasicClient.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/basic/src/Generated/BasicClient.cs @@ -12,12 +12,14 @@ namespace Parameters.Basic { public partial class BasicClient { - public BasicClient() => throw null; + public BasicClient() : this(new Uri("http://localhost:3000"), new BasicClientOptions()) => throw null; - public BasicClient(Uri endpoint, BasicClientOptions options) => throw null; + internal BasicClient(AuthenticationPolicy authenticationPolicy, Uri endpoint, BasicClientOptions options) => throw null; + + public BasicClient(Uri endpoint, BasicClientOptions options) : this(null, endpoint, options) => throw null; [Experimental("SCME0002")] - public BasicClient(BasicClientSettings settings) => throw null; + public BasicClient(BasicClientSettings settings) : this(AuthenticationPolicy.Create(settings), settings?.Endpoint, settings?.Options) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/basic/src/Generated/ExplicitBody.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/basic/src/Generated/ExplicitBody.cs index 383030dc1bf..d9157b03926 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/basic/src/Generated/ExplicitBody.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/basic/src/Generated/ExplicitBody.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -13,6 +14,8 @@ public partial class ExplicitBody { protected ExplicitBody() => throw null; + internal ExplicitBody(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult Simple(BinaryContent content, RequestOptions options = null) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/basic/src/Generated/ImplicitBody.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/basic/src/Generated/ImplicitBody.cs index 478ec3b4e2e..8d46cf80d63 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/basic/src/Generated/ImplicitBody.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/basic/src/Generated/ImplicitBody.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -13,6 +14,8 @@ public partial class ImplicitBody { protected ImplicitBody() => throw null; + internal ImplicitBody(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult Simple(BinaryContent content, RequestOptions options = null) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/body-optionality/src/Generated/BodyOptionalityClient.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/body-optionality/src/Generated/BodyOptionalityClient.cs index 6e4e705df6a..457b49eac2f 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/body-optionality/src/Generated/BodyOptionalityClient.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/body-optionality/src/Generated/BodyOptionalityClient.cs @@ -14,12 +14,14 @@ namespace Parameters.BodyOptionality { public partial class BodyOptionalityClient { - public BodyOptionalityClient() => throw null; + public BodyOptionalityClient() : this(new Uri("http://localhost:3000"), new BodyOptionalityClientOptions()) => throw null; - public BodyOptionalityClient(Uri endpoint, BodyOptionalityClientOptions options) => throw null; + internal BodyOptionalityClient(AuthenticationPolicy authenticationPolicy, Uri endpoint, BodyOptionalityClientOptions options) => throw null; + + public BodyOptionalityClient(Uri endpoint, BodyOptionalityClientOptions options) : this(null, endpoint, options) => throw null; [Experimental("SCME0002")] - public BodyOptionalityClient(BodyOptionalityClientSettings settings) => throw null; + public BodyOptionalityClient(BodyOptionalityClientSettings settings) : this(AuthenticationPolicy.Create(settings), settings?.Endpoint, settings?.Options) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/body-optionality/src/Generated/OptionalExplicit.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/body-optionality/src/Generated/OptionalExplicit.cs index ffa4809571b..5d4de240634 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/body-optionality/src/Generated/OptionalExplicit.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/body-optionality/src/Generated/OptionalExplicit.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -14,6 +15,8 @@ public partial class OptionalExplicit { protected OptionalExplicit() => throw null; + internal OptionalExplicit(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult Set(BinaryContent content, RequestOptions options = null) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/collection-format/src/Generated/CollectionFormatClient.RestClient.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/collection-format/src/Generated/CollectionFormatClient.RestClient.cs new file mode 100644 index 00000000000..f8bc1c1579a --- /dev/null +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/collection-format/src/Generated/CollectionFormatClient.RestClient.cs @@ -0,0 +1,11 @@ +// + +#nullable disable + +namespace Parameters.CollectionFormat +{ + /// + public partial class CollectionFormatClient + { + } +} diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/collection-format/src/Generated/CollectionFormatClient.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/collection-format/src/Generated/CollectionFormatClient.cs index ecbb80dad60..59a7b5a2fef 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/collection-format/src/Generated/CollectionFormatClient.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/collection-format/src/Generated/CollectionFormatClient.cs @@ -5,24 +5,64 @@ using System; using System.ClientModel.Primitives; using System.Diagnostics.CodeAnalysis; +using System.Threading; using Parameters.CollectionFormat._Header; using Parameters.CollectionFormat._Query; namespace Parameters.CollectionFormat { + /// Test for collectionFormat. public partial class CollectionFormatClient { - public CollectionFormatClient() => throw null; + private readonly Uri _endpoint; + private Query _cachedQuery; + private Header _cachedHeader; - public CollectionFormatClient(Uri endpoint, CollectionFormatClientOptions options) => throw null; + /// Initializes a new instance of CollectionFormatClient. + public CollectionFormatClient() : this(new Uri("http://localhost:3000"), new CollectionFormatClientOptions()) + { + } + /// Initializes a new instance of CollectionFormatClient. + /// The authentication policy to use for pipeline creation. + /// Service endpoint. + /// The options for configuring the client. + internal CollectionFormatClient(AuthenticationPolicy authenticationPolicy, Uri endpoint, CollectionFormatClientOptions options) + { + options ??= new CollectionFormatClientOptions(); + + _endpoint = endpoint; + Pipeline = ClientPipeline.Create(options, Array.Empty(), new PipelinePolicy[] { new UserAgentPolicy(typeof(CollectionFormatClient).Assembly) }, Array.Empty()); + } + + /// Initializes a new instance of CollectionFormatClient. + /// Service endpoint. + /// The options for configuring the client. + /// is null. + public CollectionFormatClient(Uri endpoint, CollectionFormatClientOptions options) : this(null, endpoint, options) + { + } + + /// Initializes a new instance of CollectionFormatClient from settings. + /// The settings for CollectionFormatClient. [Experimental("SCME0002")] - public CollectionFormatClient(CollectionFormatClientSettings settings) => throw null; + public CollectionFormatClient(CollectionFormatClientSettings settings) : this(AuthenticationPolicy.Create(settings), settings?.Endpoint, settings?.Options) + { + } - public ClientPipeline Pipeline => throw null; + /// The HTTP pipeline for sending and receiving REST requests and responses. + public ClientPipeline Pipeline { get; } - public virtual Query GetQueryClient() => throw null; + /// Initializes a new instance of Query. + public virtual Query GetQueryClient() + { + return Volatile.Read(ref _cachedQuery) ?? Interlocked.CompareExchange(ref _cachedQuery, new Query(Pipeline, _endpoint), null) ?? _cachedQuery; + } - public virtual Header GetHeaderClient() => throw null; + /// Initializes a new instance of Header. + public virtual Header GetHeaderClient() + { + return Volatile.Read(ref _cachedHeader) ?? Interlocked.CompareExchange(ref _cachedHeader, new Header(Pipeline, _endpoint), null) ?? _cachedHeader; + } } } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/collection-format/src/Generated/CollectionFormatClientOptions.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/collection-format/src/Generated/CollectionFormatClientOptions.cs index 227d9ffd344..bdf3fd004d8 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/collection-format/src/Generated/CollectionFormatClientOptions.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/collection-format/src/Generated/CollectionFormatClientOptions.cs @@ -8,11 +8,23 @@ namespace Parameters.CollectionFormat { + /// Client options for . public partial class CollectionFormatClientOptions : ClientPipelineOptions { - public CollectionFormatClientOptions() => throw null; + /// Initializes a new instance of CollectionFormatClientOptions. + public CollectionFormatClientOptions() + { + } + /// Initializes a new instance of CollectionFormatClientOptions from configuration. + /// The configuration section. [Experimental("SCME0002")] - internal CollectionFormatClientOptions(IConfigurationSection section) : base(section) => throw null; + internal CollectionFormatClientOptions(IConfigurationSection section) : base(section) + { + if (section is null || !section.Exists()) + { + return; + } + } } } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/collection-format/src/Generated/CollectionFormatClientSettings.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/collection-format/src/Generated/CollectionFormatClientSettings.cs index ae7b80aa260..774ade49d99 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/collection-format/src/Generated/CollectionFormatClientSettings.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/collection-format/src/Generated/CollectionFormatClientSettings.cs @@ -9,21 +9,29 @@ namespace Parameters.CollectionFormat { + /// [Experimental("SCME0002")] public partial class CollectionFormatClientSettings : ClientSettings { - public Uri Endpoint - { - get => throw null; - set => throw null; - } + /// Gets or sets the Endpoint. + public Uri Endpoint { get; set; } - public CollectionFormatClientOptions Options + /// Gets or sets the Options. + public CollectionFormatClientOptions Options { get; set; } + + /// Binds configuration values from the given section. + /// The configuration section. + protected override void BindCore(IConfigurationSection section) { - get => throw null; - set => throw null; + if (Uri.TryCreate(section["Endpoint"], UriKind.Absolute, out Uri endpoint)) + { + Endpoint = endpoint; + } + IConfigurationSection optionsSection = section.GetSection("Options"); + if (optionsSection.Exists()) + { + Options = new CollectionFormatClientOptions(optionsSection); + } } - - protected override void BindCore(IConfigurationSection section) => throw null; } } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/collection-format/src/Generated/Header.RestClient.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/collection-format/src/Generated/Header.RestClient.cs new file mode 100644 index 00000000000..76128f9bb8f --- /dev/null +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/collection-format/src/Generated/Header.RestClient.cs @@ -0,0 +1,33 @@ +// + +#nullable disable + +using System.ClientModel.Primitives; +using System.Collections.Generic; +using Parameters.CollectionFormat; + +namespace Parameters.CollectionFormat._Header +{ + /// + public partial class Header + { + private static PipelineMessageClassifier _pipelineMessageClassifier204; + + private static PipelineMessageClassifier PipelineMessageClassifier204 => _pipelineMessageClassifier204 ??= PipelineMessageClassifier.Create(stackalloc ushort[] { 204 }); + + internal PipelineMessage CreateCsvRequest(IEnumerable colors, RequestOptions options) + { + ClientUriBuilder uri = new ClientUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/parameters/collection-format/header/csv", false); + PipelineMessage message = Pipeline.CreateMessage(uri.ToUri(), "GET", PipelineMessageClassifier204); + PipelineRequest request = message.Request; + if (colors != null && !(colors is ChangeTrackingList changeTrackingList && changeTrackingList.IsUndefined)) + { + request.Headers.SetDelimited("colors", colors, ","); + } + message.Apply(options); + return message; + } + } +} diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/collection-format/src/Generated/Header.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/collection-format/src/Generated/Header.cs index 6188a2785ea..7ca7fd04f98 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/collection-format/src/Generated/Header.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/collection-format/src/Generated/Header.cs @@ -2,26 +2,102 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Collections.Generic; using System.Threading; using System.Threading.Tasks; +using Parameters.CollectionFormat; namespace Parameters.CollectionFormat._Header { + /// The Header sub-client. public partial class Header { - protected Header() => throw null; + private readonly Uri _endpoint; - public ClientPipeline Pipeline => throw null; + /// Initializes a new instance of Header for mocking. + protected Header() + { + } - public virtual ClientResult Csv(IEnumerable colors, RequestOptions options) => throw null; + /// Initializes a new instance of Header. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// Service endpoint. + internal Header(ClientPipeline pipeline, Uri endpoint) + { + _endpoint = endpoint; + Pipeline = pipeline; + } - public virtual Task CsvAsync(IEnumerable colors, RequestOptions options) => throw null; + /// The HTTP pipeline for sending and receiving REST requests and responses. + public ClientPipeline Pipeline { get; } - public virtual ClientResult Csv(IEnumerable colors, CancellationToken cancellationToken = default) => throw null; + /// + /// [Protocol Method] Csv + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// Possible values for colors are [blue,red,green]. + /// The request options, which can override default behaviors of the client pipeline on a per-call basis. + /// is null. + /// Service returned a non-success status code. + /// The response returned from the service. + public virtual ClientResult Csv(IEnumerable colors, RequestOptions options) + { + Argument.AssertNotNull(colors, nameof(colors)); - public virtual Task CsvAsync(IEnumerable colors, CancellationToken cancellationToken = default) => throw null; + using PipelineMessage message = CreateCsvRequest(colors, options); + return ClientResult.FromResponse(Pipeline.ProcessMessage(message, options)); + } + + /// + /// [Protocol Method] Csv + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// Possible values for colors are [blue,red,green]. + /// The request options, which can override default behaviors of the client pipeline on a per-call basis. + /// is null. + /// Service returned a non-success status code. + /// The response returned from the service. + public virtual async Task CsvAsync(IEnumerable colors, RequestOptions options) + { + Argument.AssertNotNull(colors, nameof(colors)); + + using PipelineMessage message = CreateCsvRequest(colors, options); + return ClientResult.FromResponse(await Pipeline.ProcessMessageAsync(message, options).ConfigureAwait(false)); + } + + /// Csv. + /// Possible values for colors are [blue,red,green]. + /// The cancellation token that can be used to cancel the operation. + /// is null. + /// Service returned a non-success status code. + public virtual ClientResult Csv(IEnumerable colors, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(colors, nameof(colors)); + + return Csv(colors, cancellationToken.ToRequestOptions()); + } + + /// Csv. + /// Possible values for colors are [blue,red,green]. + /// The cancellation token that can be used to cancel the operation. + /// is null. + /// Service returned a non-success status code. + public virtual async Task CsvAsync(IEnumerable colors, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(colors, nameof(colors)); + + return await CsvAsync(colors, cancellationToken.ToRequestOptions()).ConfigureAwait(false); + } } } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/collection-format/src/Generated/Internal/Argument.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/collection-format/src/Generated/Internal/Argument.cs new file mode 100644 index 00000000000..372041ef3bb --- /dev/null +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/collection-format/src/Generated/Internal/Argument.cs @@ -0,0 +1,110 @@ +// + +#nullable disable + +using System; +using System.Collections; +using System.Collections.Generic; + +namespace Parameters.CollectionFormat +{ + internal static partial class Argument + { + /// The value. + /// The name. + public static void AssertNotNull(T value, string name) + { + if (value is null) + { + throw new ArgumentNullException(name); + } + } + + /// The value. + /// The name. + public static void AssertNotNull(T? value, string name) + where T : struct + { + if (!value.HasValue) + { + throw new ArgumentNullException(name); + } + } + + /// The value. + /// The name. + public static void AssertNotNullOrEmpty(IEnumerable value, string name) + { + if (value is null) + { + throw new ArgumentNullException(name); + } + if (value is ICollection collectionOfT && collectionOfT.Count == 0) + { + throw new ArgumentException("Value cannot be an empty collection.", name); + } + if (value is ICollection collection && collection.Count == 0) + { + throw new ArgumentException("Value cannot be an empty collection.", name); + } + using IEnumerator e = value.GetEnumerator(); + if (!e.MoveNext()) + { + throw new ArgumentException("Value cannot be an empty collection.", name); + } + } + + /// The value. + /// The name. + public static void AssertNotNullOrEmpty(string value, string name) + { + if (value is null) + { + throw new ArgumentNullException(name); + } + if (value.Length == 0) + { + throw new ArgumentException("Value cannot be an empty string.", name); + } + } + + /// The value. + /// The name. + public static void AssertNotNullOrWhiteSpace(string value, string name) + { + if (value is null) + { + throw new ArgumentNullException(name); + } + if (string.IsNullOrWhiteSpace(value)) + { + throw new ArgumentException("Value cannot be empty or contain only white-space characters.", name); + } + } + + /// The value. + /// The minimum value. + /// The maximum value. + /// The name. + public static void AssertInRange(T value, T minimum, T maximum, string name) + where T : notnull, IComparable + { + if (minimum.CompareTo(value) > 0) + { + throw new ArgumentOutOfRangeException(name, "Value is less than the minimum allowed."); + } + if (maximum.CompareTo(value) < 0) + { + throw new ArgumentOutOfRangeException(name, "Value is greater than the maximum allowed."); + } + } + + /// The value. + /// The name. + public static string CheckNotNullOrEmpty(string value, string name) + { + AssertNotNullOrEmpty(value, name); + return value; + } + } +} diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/collection-format/src/Generated/Internal/CancellationTokenExtensions.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/collection-format/src/Generated/Internal/CancellationTokenExtensions.cs new file mode 100644 index 00000000000..61fe9a65092 --- /dev/null +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/collection-format/src/Generated/Internal/CancellationTokenExtensions.cs @@ -0,0 +1,14 @@ +// + +#nullable disable + +using System.ClientModel.Primitives; +using System.Threading; + +namespace Parameters.CollectionFormat +{ + internal static partial class CancellationTokenExtensions + { + public static RequestOptions ToRequestOptions(this CancellationToken cancellationToken) => cancellationToken.CanBeCanceled ? new RequestOptions { CancellationToken = cancellationToken } : null; + } +} diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/collection-format/src/Generated/Internal/ChangeTrackingList.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/collection-format/src/Generated/Internal/ChangeTrackingList.cs new file mode 100644 index 00000000000..cb476372d09 --- /dev/null +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/collection-format/src/Generated/Internal/ChangeTrackingList.cs @@ -0,0 +1,165 @@ +// + +#nullable disable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Linq; + +namespace Parameters.CollectionFormat +{ + internal partial class ChangeTrackingList : IList, IReadOnlyList + { + private IList _innerList; + + public ChangeTrackingList() + { + } + + /// The inner list. + public ChangeTrackingList(IList innerList) + { + if (innerList != null) + { + _innerList = innerList; + } + } + + /// The inner list. + public ChangeTrackingList(IReadOnlyList innerList) + { + if (innerList != null) + { + _innerList = innerList.ToList(); + } + } + + /// Gets the IsUndefined. + public bool IsUndefined => _innerList == null; + + /// Gets the Count. + public int Count => IsUndefined ? 0 : EnsureList().Count; + + /// Gets the IsReadOnly. + public bool IsReadOnly => IsUndefined ? false : EnsureList().IsReadOnly; + + /// Gets or sets the value associated with the specified key. + public T this[int index] + { + get + { + if (IsUndefined) + { + throw new ArgumentOutOfRangeException(nameof(index)); + } + return EnsureList()[index]; + } + set + { + if (IsUndefined) + { + throw new ArgumentOutOfRangeException(nameof(index)); + } + EnsureList()[index] = value; + } + } + + public void Reset() + { + _innerList = null; + } + + public IEnumerator GetEnumerator() + { + if (IsUndefined) + { + IEnumerator enumerateEmpty() + { + yield break; + } + return enumerateEmpty(); + } + return EnsureList().GetEnumerator(); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetEnumerator(); + } + + /// The item to add. + public void Add(T item) + { + EnsureList().Add(item); + } + + public void Clear() + { + EnsureList().Clear(); + } + + /// The item. + public bool Contains(T item) + { + if (IsUndefined) + { + return false; + } + return EnsureList().Contains(item); + } + + /// The array to copy to. + /// The array index. + public void CopyTo(T[] array, int arrayIndex) + { + if (IsUndefined) + { + return; + } + EnsureList().CopyTo(array, arrayIndex); + } + + /// The item. + public bool Remove(T item) + { + if (IsUndefined) + { + return false; + } + return EnsureList().Remove(item); + } + + /// The item. + public int IndexOf(T item) + { + if (IsUndefined) + { + return -1; + } + return EnsureList().IndexOf(item); + } + + /// The inner list. + /// The item. + public void Insert(int index, T item) + { + EnsureList().Insert(index, item); + } + + /// The inner list. + public void RemoveAt(int index) + { + if (IsUndefined) + { + throw new ArgumentOutOfRangeException(nameof(index)); + } + EnsureList().RemoveAt(index); + } + + public IList EnsureList() + { + return _innerList ??= new List(); + } + } +} diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/collection-format/src/Generated/Internal/ClientPipelineExtensions.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/collection-format/src/Generated/Internal/ClientPipelineExtensions.cs new file mode 100644 index 00000000000..d7c3a3e9661 --- /dev/null +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/collection-format/src/Generated/Internal/ClientPipelineExtensions.cs @@ -0,0 +1,67 @@ +// + +#nullable disable + +using System.ClientModel; +using System.ClientModel.Primitives; +using System.Threading.Tasks; + +namespace Parameters.CollectionFormat +{ + internal static partial class ClientPipelineExtensions + { + public static async ValueTask ProcessMessageAsync(this ClientPipeline pipeline, PipelineMessage message, RequestOptions options) + { + await pipeline.SendAsync(message).ConfigureAwait(false); + + if (message.Response.IsError && (options?.ErrorOptions & ClientErrorBehaviors.NoThrow) != ClientErrorBehaviors.NoThrow) + { + throw await ClientResultException.CreateAsync(message.Response).ConfigureAwait(false); + } + + PipelineResponse response = message.BufferResponse ? message.Response : message.ExtractResponse(); + return response; + } + + public static PipelineResponse ProcessMessage(this ClientPipeline pipeline, PipelineMessage message, RequestOptions options) + { + pipeline.Send(message); + + if (message.Response.IsError && (options?.ErrorOptions & ClientErrorBehaviors.NoThrow) != ClientErrorBehaviors.NoThrow) + { + throw new ClientResultException(message.Response); + } + + PipelineResponse response = message.BufferResponse ? message.Response : message.ExtractResponse(); + return response; + } + + public static async ValueTask> ProcessHeadAsBoolMessageAsync(this ClientPipeline pipeline, PipelineMessage message, RequestOptions options) + { + PipelineResponse response = await pipeline.ProcessMessageAsync(message, options).ConfigureAwait(false); + switch (response.Status) + { + case >= 200 and < 300: + return ClientResult.FromValue(true, response); + case >= 400 and < 500: + return ClientResult.FromValue(false, response); + default: + return new ErrorResult(response, new ClientResultException(response)); + } + } + + public static ClientResult ProcessHeadAsBoolMessage(this ClientPipeline pipeline, PipelineMessage message, RequestOptions options) + { + PipelineResponse response = pipeline.ProcessMessage(message, options); + switch (response.Status) + { + case >= 200 and < 300: + return ClientResult.FromValue(true, response); + case >= 400 and < 500: + return ClientResult.FromValue(false, response); + default: + return new ErrorResult(response, new ClientResultException(response)); + } + } + } +} diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/collection-format/src/Generated/Internal/ClientUriBuilder.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/collection-format/src/Generated/Internal/ClientUriBuilder.cs new file mode 100644 index 00000000000..3483a54e490 --- /dev/null +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/collection-format/src/Generated/Internal/ClientUriBuilder.cs @@ -0,0 +1,181 @@ +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace Parameters.CollectionFormat +{ + internal partial class ClientUriBuilder + { + private UriBuilder _uriBuilder; + private StringBuilder _pathAndQuery; + private int _pathLength; + + public ClientUriBuilder() + { + } + + private UriBuilder UriBuilder => _uriBuilder ??= new UriBuilder(); + + private StringBuilder PathAndQuery => _pathAndQuery ??= new StringBuilder(); + + public void Reset(Uri uri) + { + _uriBuilder = new UriBuilder(uri); + PathAndQuery.Clear(); + PathAndQuery.Append(UriBuilder.Path); + _pathLength = PathAndQuery.Length; + PathAndQuery.Append(UriBuilder.Query); + } + + public void AppendPath(string value, bool escape) + { + if (escape) + { + value = Uri.EscapeDataString(value); + } + if (_pathLength > 0 && PathAndQuery[_pathLength - 1] == '/' && value[0] == '/') + { + PathAndQuery.Remove(_pathLength - 1, 1); + _pathLength = _pathLength - 1; + } + PathAndQuery.Insert(_pathLength, value); + _pathLength = _pathLength + value.Length; + } + + public void AppendPath(bool value, bool escape = false) => AppendPath(TypeFormatters.ConvertToString(value), escape); + + public void AppendPath(float value, bool escape = true) => AppendPath(TypeFormatters.ConvertToString(value), escape); + + public void AppendPath(double value, bool escape = true) => AppendPath(TypeFormatters.ConvertToString(value), escape); + + public void AppendPath(int value, bool escape = true) => AppendPath(TypeFormatters.ConvertToString(value), escape); + + public void AppendPath(byte[] value, SerializationFormat format = SerializationFormat.Default, bool escape = true) => AppendPath(TypeFormatters.ConvertToString(value, format), escape); + + public void AppendPath(DateTimeOffset value, SerializationFormat format = SerializationFormat.Default, bool escape = true) => AppendPath(TypeFormatters.ConvertToString(value, format), escape); + + public void AppendPath(TimeSpan value, SerializationFormat format = SerializationFormat.Default, bool escape = true) => AppendPath(TypeFormatters.ConvertToString(value, format), escape); + + public void AppendPath(Guid value, bool escape = true) => AppendPath(TypeFormatters.ConvertToString(value), escape); + + public void AppendPath(long value, bool escape = true) => AppendPath(TypeFormatters.ConvertToString(value), escape); + + public void AppendPathDelimited(IEnumerable value, string delimiter, SerializationFormat format = SerializationFormat.Default, bool escape = true) + { + delimiter ??= ","; + IEnumerable stringValues = value.Select(v => TypeFormatters.ConvertToString(v, format)); + AppendPath(string.Join(delimiter, stringValues), escape); + } + + public void AppendQuery(string name, string value, bool escape) + { + if (PathAndQuery.Length == _pathLength) + { + PathAndQuery.Append('?'); + } + if (PathAndQuery.Length > _pathLength && PathAndQuery[PathAndQuery.Length - 1] != '?') + { + PathAndQuery.Append('&'); + } + if (escape) + { + value = Uri.EscapeDataString(value); + } + PathAndQuery.Append(name); + PathAndQuery.Append('='); + PathAndQuery.Append(value); + } + + public void AppendQuery(string name, bool value, bool escape = false) => AppendQuery(name, TypeFormatters.ConvertToString(value), escape); + + public void AppendQuery(string name, float value, bool escape = true) => AppendQuery(name, TypeFormatters.ConvertToString(value), escape); + + public void AppendQuery(string name, DateTimeOffset value, SerializationFormat format = SerializationFormat.Default, bool escape = true) => AppendQuery(name, TypeFormatters.ConvertToString(value, format), escape); + + public void AppendQuery(string name, TimeSpan value, SerializationFormat format = SerializationFormat.Default, bool escape = true) => AppendQuery(name, TypeFormatters.ConvertToString(value, format), escape); + + public void AppendQuery(string name, double value, bool escape = true) => AppendQuery(name, TypeFormatters.ConvertToString(value), escape); + + public void AppendQuery(string name, decimal value, bool escape = true) => AppendQuery(name, TypeFormatters.ConvertToString(value), escape); + + public void AppendQuery(string name, int value, bool escape = true) => AppendQuery(name, TypeFormatters.ConvertToString(value), escape); + + public void AppendQuery(string name, long value, bool escape = true) => AppendQuery(name, TypeFormatters.ConvertToString(value), escape); + + public void AppendQuery(string name, TimeSpan value, bool escape = true) => AppendQuery(name, TypeFormatters.ConvertToString(value), escape); + + public void AppendQuery(string name, byte[] value, SerializationFormat format = SerializationFormat.Default, bool escape = true) => AppendQuery(name, TypeFormatters.ConvertToString(value, format), escape); + + public void AppendQuery(string name, Guid value, bool escape = true) => AppendQuery(name, TypeFormatters.ConvertToString(value), escape); + + public void AppendQueryDelimited(string name, IEnumerable value, string delimiter, SerializationFormat format = SerializationFormat.Default, bool escape = true) + { + delimiter ??= ","; + IEnumerable stringValues = value.Select(v => TypeFormatters.ConvertToString(v, format)); + AppendQuery(name, string.Join(delimiter, stringValues), escape); + } + + public void UpdateQuery(string name, string value) + { + if (PathAndQuery.Length == _pathLength) + { + AppendQuery(name, value, false); + } + else + { + int queryStartIndex = _pathLength + 1; + string searchPattern = name + "="; + string queryString = PathAndQuery.ToString(queryStartIndex, PathAndQuery.Length - queryStartIndex); + int paramStartIndex = -1; + if (queryString.StartsWith(searchPattern)) + { + paramStartIndex = 0; + } + if (paramStartIndex == -1) + { + int prefixedIndex = queryString.IndexOf("&" + searchPattern); + if (prefixedIndex >= 0) + { + paramStartIndex = prefixedIndex + 1; + } + } + if (paramStartIndex >= 0) + { + int valueStartIndex = paramStartIndex + searchPattern.Length; + int valueEndIndex = queryString.IndexOf('&', valueStartIndex); + if (valueEndIndex == -1) + { + valueEndIndex = queryString.Length; + } + int globalStart = queryStartIndex + valueStartIndex; + int globalEnd = queryStartIndex + valueEndIndex; + PathAndQuery.Remove(globalStart, globalEnd - globalStart); + PathAndQuery.Insert(globalStart, value); + } + else + { + AppendQuery(name, value, false); + } + } + } + + public Uri ToUri() + { + UriBuilder.Path = PathAndQuery.ToString(0, _pathLength); + if (PathAndQuery.Length > _pathLength) + { + UriBuilder.Query = PathAndQuery.ToString(_pathLength + 1, PathAndQuery.Length - _pathLength - 1); + } + if (PathAndQuery.Length == _pathLength) + { + UriBuilder.Query = ""; + } + return UriBuilder.Uri; + } + } +} diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/collection-format/src/Generated/Internal/CodeGenMemberAttribute.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/collection-format/src/Generated/Internal/CodeGenMemberAttribute.cs new file mode 100644 index 00000000000..044dfe314c5 --- /dev/null +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/collection-format/src/Generated/Internal/CodeGenMemberAttribute.cs @@ -0,0 +1,17 @@ +// + +#nullable disable + +using System; + +namespace Microsoft.TypeSpec.Generator.Customizations +{ + [AttributeUsage((AttributeTargets.Property | AttributeTargets.Field))] + internal partial class CodeGenMemberAttribute : CodeGenTypeAttribute + { + /// The original name of the member. + public CodeGenMemberAttribute(string originalName) : base(originalName) + { + } + } +} diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/collection-format/src/Generated/Internal/CodeGenSerializationAttribute.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/collection-format/src/Generated/Internal/CodeGenSerializationAttribute.cs new file mode 100644 index 00000000000..aedb8b359b8 --- /dev/null +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/collection-format/src/Generated/Internal/CodeGenSerializationAttribute.cs @@ -0,0 +1,45 @@ +// + +#nullable disable + +using System; + +namespace Microsoft.TypeSpec.Generator.Customizations +{ + [AttributeUsage((AttributeTargets.Class | AttributeTargets.Struct), AllowMultiple = true, Inherited = true)] + internal partial class CodeGenSerializationAttribute : Attribute + { + /// The property name which these hooks apply to. + public CodeGenSerializationAttribute(string propertyName) + { + PropertyName = propertyName; + } + + /// The property name which these hooks apply to. + /// The serialization name of the property. + public CodeGenSerializationAttribute(string propertyName, string serializationName) + { + PropertyName = propertyName; + SerializationName = serializationName; + } + + /// Gets or sets the property name which these hooks should apply to. + public string PropertyName { get; } + + /// Gets or sets the serialization name of the property. + public string SerializationName { get; set; } + + /// + /// Gets or sets the method name to use when serializing the property value (property name excluded). + /// The signature of the serialization hook method must be or compatible with when invoking: private void SerializeHook(Utf8JsonWriter writer); + /// + public string SerializationValueHook { get; set; } + + /// + /// Gets or sets the method name to use when deserializing the property value from the JSON. + /// private static void DeserializationHook(JsonProperty property, ref TypeOfTheProperty propertyValue); // if the property is required + /// private static void DeserializationHook(JsonProperty property, ref Optional<TypeOfTheProperty> propertyValue); // if the property is optional + /// + public string DeserializationValueHook { get; set; } + } +} diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/collection-format/src/Generated/Internal/CodeGenSuppressAttribute.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/collection-format/src/Generated/Internal/CodeGenSuppressAttribute.cs new file mode 100644 index 00000000000..601ded913ab --- /dev/null +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/collection-format/src/Generated/Internal/CodeGenSuppressAttribute.cs @@ -0,0 +1,26 @@ +// + +#nullable disable + +using System; + +namespace Microsoft.TypeSpec.Generator.Customizations +{ + [AttributeUsage((AttributeTargets.Class | AttributeTargets.Enum | AttributeTargets.Struct), AllowMultiple = true)] + internal partial class CodeGenSuppressAttribute : Attribute + { + /// The member to suppress. + /// The types of the parameters of the member. + public CodeGenSuppressAttribute(string member, params Type[] parameters) + { + Member = member; + Parameters = parameters; + } + + /// Gets the Member. + public string Member { get; } + + /// Gets the Parameters. + public Type[] Parameters { get; } + } +} diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/collection-format/src/Generated/Internal/CodeGenTypeAttribute.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/collection-format/src/Generated/Internal/CodeGenTypeAttribute.cs new file mode 100644 index 00000000000..d7b56bdccdf --- /dev/null +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/collection-format/src/Generated/Internal/CodeGenTypeAttribute.cs @@ -0,0 +1,21 @@ +// + +#nullable disable + +using System; + +namespace Microsoft.TypeSpec.Generator.Customizations +{ + [AttributeUsage((AttributeTargets.Class | AttributeTargets.Enum | AttributeTargets.Struct))] + internal partial class CodeGenTypeAttribute : Attribute + { + /// The original name of the type. + public CodeGenTypeAttribute(string originalName) + { + OriginalName = originalName; + } + + /// Gets the OriginalName. + public string OriginalName { get; } + } +} diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/collection-format/src/Generated/Internal/ErrorResult.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/collection-format/src/Generated/Internal/ErrorResult.cs new file mode 100644 index 00000000000..0c834723df0 --- /dev/null +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/collection-format/src/Generated/Internal/ErrorResult.cs @@ -0,0 +1,24 @@ +// + +#nullable disable + +using System.ClientModel; +using System.ClientModel.Primitives; + +namespace Parameters.CollectionFormat +{ + internal partial class ErrorResult : ClientResult + { + private readonly PipelineResponse _response; + private readonly ClientResultException _exception; + + public ErrorResult(PipelineResponse response, ClientResultException exception) : base(default, response) + { + _response = response; + _exception = exception; + } + + /// Gets the Value. + public override T Value => throw _exception; + } +} diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/collection-format/src/Generated/Internal/PipelineRequestHeadersExtensions.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/collection-format/src/Generated/Internal/PipelineRequestHeadersExtensions.cs new file mode 100644 index 00000000000..a967deea84f --- /dev/null +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/collection-format/src/Generated/Internal/PipelineRequestHeadersExtensions.cs @@ -0,0 +1,45 @@ +// + +#nullable disable + +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Linq; + +namespace Parameters.CollectionFormat +{ + internal static partial class PipelineRequestHeadersExtensions + { + /// + /// The name. + /// The value. + /// The delimiter. + public static void SetDelimited(this PipelineRequestHeaders headers, string name, IEnumerable value, string delimiter) + { + IEnumerable stringValues = value.Select(v => TypeFormatters.ConvertToString(v)); + headers.Set(name, string.Join(delimiter, stringValues)); + } + + /// + /// The name. + /// The value. + /// The delimiter. + /// The format. + public static void SetDelimited(this PipelineRequestHeaders headers, string name, IEnumerable value, string delimiter, SerializationFormat format) + { + IEnumerable stringValues = value.Select(v => TypeFormatters.ConvertToString(v, format)); + headers.Set(name, string.Join(delimiter, stringValues)); + } + + /// + /// The prefix to prepend to each header key. + /// The dictionary of headers to add. + public static void Add(this PipelineRequestHeaders headers, string prefix, IDictionary value) + { + foreach (var header in value) + { + headers.Add(prefix + header.Key, header.Value); + } + } + } +} diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/collection-format/src/Generated/Internal/SerializationFormat.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/collection-format/src/Generated/Internal/SerializationFormat.cs new file mode 100644 index 00000000000..cfae3ec3f50 --- /dev/null +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/collection-format/src/Generated/Internal/SerializationFormat.cs @@ -0,0 +1,46 @@ +// + +#nullable disable + +namespace Parameters.CollectionFormat +{ + internal enum SerializationFormat + { + /// The default serialization format. + Default = 0, + /// The RFC1123 date time format. + DateTime_RFC1123 = 1, + /// The RFC3339 date time format. + DateTime_RFC3339 = 2, + /// The RFC7231 date time format. + DateTime_RFC7231 = 3, + /// The ISO8601 date time format. + DateTime_ISO8601 = 4, + /// The Unix date time format. + DateTime_Unix = 5, + /// The ISO8601 date format. + Date_ISO8601 = 6, + /// The ISO8601 duration format. + Duration_ISO8601 = 7, + /// The constant duration format. + Duration_Constant = 8, + /// The seconds duration format. + Duration_Seconds = 9, + /// The seconds duration format with float precision. + Duration_Seconds_Float = 10, + /// The seconds duration format with double precision. + Duration_Seconds_Double = 11, + /// The milliseconds duration format. + Duration_Milliseconds = 12, + /// The milliseconds duration format with float precision. + Duration_Milliseconds_Float = 13, + /// The milliseconds duration format with double precision. + Duration_Milliseconds_Double = 14, + /// The ISO8601 time format. + Time_ISO8601 = 15, + /// The Base64Url bytes format. + Bytes_Base64Url = 16, + /// The Base64 bytes format. + Bytes_Base64 = 17 + } +} diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/collection-format/src/Generated/Internal/TypeFormatters.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/collection-format/src/Generated/Internal/TypeFormatters.cs new file mode 100644 index 00000000000..4e6e433db70 --- /dev/null +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/collection-format/src/Generated/Internal/TypeFormatters.cs @@ -0,0 +1,178 @@ +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Globalization; +using System.Xml; + +namespace Parameters.CollectionFormat +{ + internal static partial class TypeFormatters + { + private const string RoundtripZFormat = "yyyy-MM-ddTHH:mm:ss.fffffffZ"; + public const string DefaultNumberFormat = "G"; + + public static string ToString(bool value) => value ? "true" : "false"; + + public static string ToString(DateTime value, string format) => value.Kind switch + { + DateTimeKind.Utc => ToString((DateTimeOffset)value, format), + _ => throw new NotSupportedException($"DateTime {value} has a Kind of {value.Kind}. Generated clients require it to be UTC. You can call DateTime.SpecifyKind to change Kind property value to DateTimeKind.Utc.") + }; + + public static string ToString(DateTimeOffset value, string format) => format switch + { + "D" => value.ToString("yyyy-MM-dd", CultureInfo.InvariantCulture), + "U" => value.ToUnixTimeSeconds().ToString(CultureInfo.InvariantCulture), + "O" => value.ToUniversalTime().ToString(RoundtripZFormat, CultureInfo.InvariantCulture), + "o" => value.ToUniversalTime().ToString(RoundtripZFormat, CultureInfo.InvariantCulture), + "R" => value.ToString("r", CultureInfo.InvariantCulture), + _ => value.ToString(format, CultureInfo.InvariantCulture) + }; + + public static string ToString(TimeSpan value, string format) => format switch + { + "P" => XmlConvert.ToString(value), + _ => value.ToString(format, CultureInfo.InvariantCulture) + }; + + public static string ToString(byte[] value, string format) => format switch + { + "U" => ToBase64UrlString(value), + "D" => Convert.ToBase64String(value), + _ => throw new ArgumentException($"Format is not supported: '{format}'", nameof(format)) + }; + + public static string ToBase64UrlString(byte[] value) + { + int numWholeOrPartialInputBlocks = checked (value.Length + 2) / 3; + int size = checked (numWholeOrPartialInputBlocks * 4); + char[] output = new char[size]; + + int numBase64Chars = Convert.ToBase64CharArray(value, 0, value.Length, output, 0); + + int i = 0; + for (; i < numBase64Chars; i++) + { + char ch = output[i]; + if (ch == '+') + { + output[i] = '-'; + } + else + { + if (ch == '/') + { + output[i] = '_'; + } + else + { + if (ch == '=') + { + break; + } + } + } + } + + return new string(output, 0, i); + } + + public static byte[] FromBase64UrlString(string value) + { + int paddingCharsToAdd = (value.Length % 4) switch + { + 0 => 0, + 2 => 2, + 3 => 1, + _ => throw new InvalidOperationException("Malformed input") + }; + char[] output = new char[(value.Length + paddingCharsToAdd)]; + int i = 0; + for (; i < value.Length; i++) + { + char ch = value[i]; + if (ch == '-') + { + output[i] = '+'; + } + else + { + if (ch == '_') + { + output[i] = '/'; + } + else + { + output[i] = ch; + } + } + } + + for (; i < output.Length; i++) + { + output[i] = '='; + } + + return Convert.FromBase64CharArray(output, 0, output.Length); + } + + public static DateTimeOffset ParseDateTimeOffset(string value, string format) => format switch + { + "U" => DateTimeOffset.FromUnixTimeSeconds(long.Parse(value, CultureInfo.InvariantCulture)), + _ => DateTimeOffset.Parse(value, CultureInfo.InvariantCulture, DateTimeStyles.AssumeUniversal) + }; + + public static TimeSpan ParseTimeSpan(string value, string format) => format switch + { + "P" => XmlConvert.ToTimeSpan(value), + _ => TimeSpan.ParseExact(value, format, CultureInfo.InvariantCulture) + }; + + public static string ToFormatSpecifier(SerializationFormat format) => format switch + { + SerializationFormat.DateTime_RFC1123 => "R", + SerializationFormat.DateTime_RFC3339 => "O", + SerializationFormat.DateTime_RFC7231 => "R", + SerializationFormat.DateTime_ISO8601 => "O", + SerializationFormat.Date_ISO8601 => "D", + SerializationFormat.DateTime_Unix => "U", + SerializationFormat.Bytes_Base64Url => "U", + SerializationFormat.Bytes_Base64 => "D", + SerializationFormat.Duration_ISO8601 => "P", + SerializationFormat.Duration_Constant => "c", + SerializationFormat.Duration_Seconds => "%s", + SerializationFormat.Duration_Seconds_Float => "s\\.FFF", + SerializationFormat.Duration_Seconds_Double => "s\\.FFFFFF", + SerializationFormat.Time_ISO8601 => "T", + _ => null + }; + + public static string ConvertToString(object value, SerializationFormat format = SerializationFormat.Default) + { + string formatSpecifier = ToFormatSpecifier(format); + + return value switch + { + null => "null", + string s => s, + bool b => ToString(b), + int or float or double or long or decimal => ((IFormattable)value).ToString(DefaultNumberFormat, CultureInfo.InvariantCulture), + byte[] b0 when formatSpecifier != null => ToString(b0, formatSpecifier), + IEnumerable s0 => string.Join(",", s0), + DateTimeOffset dateTime when formatSpecifier != null => ToString(dateTime, formatSpecifier), + TimeSpan timeSpan when format == SerializationFormat.Duration_Seconds => Convert.ToInt32(timeSpan.TotalSeconds).ToString(CultureInfo.InvariantCulture), + TimeSpan timeSpan0 when format == SerializationFormat.Duration_Seconds_Float || format == SerializationFormat.Duration_Seconds_Double => timeSpan0.TotalSeconds.ToString(CultureInfo.InvariantCulture), + TimeSpan timeSpan1 when format == SerializationFormat.Duration_Milliseconds => Convert.ToInt32(timeSpan1.TotalMilliseconds).ToString(CultureInfo.InvariantCulture), + TimeSpan timeSpan2 when format == SerializationFormat.Duration_Milliseconds_Float || format == SerializationFormat.Duration_Milliseconds_Double => timeSpan2.TotalMilliseconds.ToString(CultureInfo.InvariantCulture), + TimeSpan timeSpan3 when formatSpecifier != null => ToString(timeSpan3, formatSpecifier), + TimeSpan timeSpan4 => XmlConvert.ToString(timeSpan4), + Guid guid => guid.ToString(), + BinaryData binaryData => ConvertToString(binaryData.ToArray(), format), + _ => value.ToString() + }; + } + } +} diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/collection-format/src/Generated/Models/ParametersCollectionFormatContext.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/collection-format/src/Generated/Models/ParametersCollectionFormatContext.cs index 51eb41ca60a..14f36e4eacf 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/collection-format/src/Generated/Models/ParametersCollectionFormatContext.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/collection-format/src/Generated/Models/ParametersCollectionFormatContext.cs @@ -6,6 +6,10 @@ namespace Parameters.CollectionFormat { + /// + /// Context class which will be filled in by the System.ClientModel.SourceGeneration. + /// For more information + /// public partial class ParametersCollectionFormatContext : ModelReaderWriterContext { } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/collection-format/src/Generated/Query.RestClient.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/collection-format/src/Generated/Query.RestClient.cs new file mode 100644 index 00000000000..49f73f3781e --- /dev/null +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/collection-format/src/Generated/Query.RestClient.cs @@ -0,0 +1,81 @@ +// + +#nullable disable + +using System.ClientModel.Primitives; +using System.Collections.Generic; +using Parameters.CollectionFormat; + +namespace Parameters.CollectionFormat._Query +{ + /// + public partial class Query + { + private static PipelineMessageClassifier _pipelineMessageClassifier204; + + private static PipelineMessageClassifier PipelineMessageClassifier204 => _pipelineMessageClassifier204 ??= PipelineMessageClassifier.Create(stackalloc ushort[] { 204 }); + + internal PipelineMessage CreateMultiRequest(IEnumerable colors, RequestOptions options) + { + ClientUriBuilder uri = new ClientUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/parameters/collection-format/query/multi", false); + if (colors != null && !(colors is ChangeTrackingList changeTrackingList && changeTrackingList.IsUndefined)) + { + foreach (var @param in colors) + { + uri.AppendQuery("colors", @param, true); + } + } + PipelineMessage message = Pipeline.CreateMessage(uri.ToUri(), "GET", PipelineMessageClassifier204); + PipelineRequest request = message.Request; + message.Apply(options); + return message; + } + + internal PipelineMessage CreateSsvRequest(IEnumerable colors, RequestOptions options) + { + ClientUriBuilder uri = new ClientUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/parameters/collection-format/query/ssv", false); + if (colors != null && !(colors is ChangeTrackingList changeTrackingList && changeTrackingList.IsUndefined)) + { + uri.AppendQueryDelimited("colors", colors, " ", escape: true); + } + PipelineMessage message = Pipeline.CreateMessage(uri.ToUri(), "GET", PipelineMessageClassifier204); + PipelineRequest request = message.Request; + message.Apply(options); + return message; + } + + internal PipelineMessage CreatePipesRequest(IEnumerable colors, RequestOptions options) + { + ClientUriBuilder uri = new ClientUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/parameters/collection-format/query/pipes", false); + if (colors != null && !(colors is ChangeTrackingList changeTrackingList && changeTrackingList.IsUndefined)) + { + uri.AppendQueryDelimited("colors", colors, "|", escape: true); + } + PipelineMessage message = Pipeline.CreateMessage(uri.ToUri(), "GET", PipelineMessageClassifier204); + PipelineRequest request = message.Request; + message.Apply(options); + return message; + } + + internal PipelineMessage CreateCsvRequest(IEnumerable colors, RequestOptions options) + { + ClientUriBuilder uri = new ClientUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/parameters/collection-format/query/csv", false); + if (colors != null && !(colors is ChangeTrackingList changeTrackingList && changeTrackingList.IsUndefined)) + { + uri.AppendQueryDelimited("colors", colors, ",", escape: true); + } + PipelineMessage message = Pipeline.CreateMessage(uri.ToUri(), "GET", PipelineMessageClassifier204); + PipelineRequest request = message.Request; + message.Apply(options); + return message; + } + } +} diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/collection-format/src/Generated/Query.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/collection-format/src/Generated/Query.cs index c54d95436b6..026fee33cdb 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/collection-format/src/Generated/Query.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/collection-format/src/Generated/Query.cs @@ -2,50 +2,300 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Collections.Generic; using System.Threading; using System.Threading.Tasks; +using Parameters.CollectionFormat; namespace Parameters.CollectionFormat._Query { + /// The Query sub-client. public partial class Query { - protected Query() => throw null; + private readonly Uri _endpoint; - public ClientPipeline Pipeline => throw null; + /// Initializes a new instance of Query for mocking. + protected Query() + { + } - public virtual ClientResult Multi(IEnumerable colors, RequestOptions options) => throw null; + /// Initializes a new instance of Query. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// Service endpoint. + internal Query(ClientPipeline pipeline, Uri endpoint) + { + _endpoint = endpoint; + Pipeline = pipeline; + } - public virtual Task MultiAsync(IEnumerable colors, RequestOptions options) => throw null; + /// The HTTP pipeline for sending and receiving REST requests and responses. + public ClientPipeline Pipeline { get; } - public virtual ClientResult Multi(IEnumerable colors, CancellationToken cancellationToken = default) => throw null; + /// + /// [Protocol Method] Multi + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// Possible values for colors are [blue,red,green]. + /// The request options, which can override default behaviors of the client pipeline on a per-call basis. + /// is null. + /// Service returned a non-success status code. + /// The response returned from the service. + public virtual ClientResult Multi(IEnumerable colors, RequestOptions options) + { + Argument.AssertNotNull(colors, nameof(colors)); - public virtual Task MultiAsync(IEnumerable colors, CancellationToken cancellationToken = default) => throw null; + using PipelineMessage message = CreateMultiRequest(colors, options); + return ClientResult.FromResponse(Pipeline.ProcessMessage(message, options)); + } - public virtual ClientResult Ssv(IEnumerable colors, RequestOptions options) => throw null; + /// + /// [Protocol Method] Multi + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// Possible values for colors are [blue,red,green]. + /// The request options, which can override default behaviors of the client pipeline on a per-call basis. + /// is null. + /// Service returned a non-success status code. + /// The response returned from the service. + public virtual async Task MultiAsync(IEnumerable colors, RequestOptions options) + { + Argument.AssertNotNull(colors, nameof(colors)); - public virtual Task SsvAsync(IEnumerable colors, RequestOptions options) => throw null; + using PipelineMessage message = CreateMultiRequest(colors, options); + return ClientResult.FromResponse(await Pipeline.ProcessMessageAsync(message, options).ConfigureAwait(false)); + } - public virtual ClientResult Ssv(IEnumerable colors, CancellationToken cancellationToken = default) => throw null; + /// Multi. + /// Possible values for colors are [blue,red,green]. + /// The cancellation token that can be used to cancel the operation. + /// is null. + /// Service returned a non-success status code. + public virtual ClientResult Multi(IEnumerable colors, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(colors, nameof(colors)); - public virtual Task SsvAsync(IEnumerable colors, CancellationToken cancellationToken = default) => throw null; + return Multi(colors, cancellationToken.ToRequestOptions()); + } - public virtual ClientResult Pipes(IEnumerable colors, RequestOptions options) => throw null; + /// Multi. + /// Possible values for colors are [blue,red,green]. + /// The cancellation token that can be used to cancel the operation. + /// is null. + /// Service returned a non-success status code. + public virtual async Task MultiAsync(IEnumerable colors, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(colors, nameof(colors)); - public virtual Task PipesAsync(IEnumerable colors, RequestOptions options) => throw null; + return await MultiAsync(colors, cancellationToken.ToRequestOptions()).ConfigureAwait(false); + } - public virtual ClientResult Pipes(IEnumerable colors, CancellationToken cancellationToken = default) => throw null; + /// + /// [Protocol Method] Ssv + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// Possible values for colors are [blue,red,green]. + /// The request options, which can override default behaviors of the client pipeline on a per-call basis. + /// is null. + /// Service returned a non-success status code. + /// The response returned from the service. + public virtual ClientResult Ssv(IEnumerable colors, RequestOptions options) + { + Argument.AssertNotNull(colors, nameof(colors)); - public virtual Task PipesAsync(IEnumerable colors, CancellationToken cancellationToken = default) => throw null; + using PipelineMessage message = CreateSsvRequest(colors, options); + return ClientResult.FromResponse(Pipeline.ProcessMessage(message, options)); + } - public virtual ClientResult Csv(IEnumerable colors, RequestOptions options) => throw null; + /// + /// [Protocol Method] Ssv + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// Possible values for colors are [blue,red,green]. + /// The request options, which can override default behaviors of the client pipeline on a per-call basis. + /// is null. + /// Service returned a non-success status code. + /// The response returned from the service. + public virtual async Task SsvAsync(IEnumerable colors, RequestOptions options) + { + Argument.AssertNotNull(colors, nameof(colors)); - public virtual Task CsvAsync(IEnumerable colors, RequestOptions options) => throw null; + using PipelineMessage message = CreateSsvRequest(colors, options); + return ClientResult.FromResponse(await Pipeline.ProcessMessageAsync(message, options).ConfigureAwait(false)); + } - public virtual ClientResult Csv(IEnumerable colors, CancellationToken cancellationToken = default) => throw null; + /// Ssv. + /// Possible values for colors are [blue,red,green]. + /// The cancellation token that can be used to cancel the operation. + /// is null. + /// Service returned a non-success status code. + public virtual ClientResult Ssv(IEnumerable colors, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(colors, nameof(colors)); - public virtual Task CsvAsync(IEnumerable colors, CancellationToken cancellationToken = default) => throw null; + return Ssv(colors, cancellationToken.ToRequestOptions()); + } + + /// Ssv. + /// Possible values for colors are [blue,red,green]. + /// The cancellation token that can be used to cancel the operation. + /// is null. + /// Service returned a non-success status code. + public virtual async Task SsvAsync(IEnumerable colors, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(colors, nameof(colors)); + + return await SsvAsync(colors, cancellationToken.ToRequestOptions()).ConfigureAwait(false); + } + + /// + /// [Protocol Method] Pipes + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// Possible values for colors are [blue,red,green]. + /// The request options, which can override default behaviors of the client pipeline on a per-call basis. + /// is null. + /// Service returned a non-success status code. + /// The response returned from the service. + public virtual ClientResult Pipes(IEnumerable colors, RequestOptions options) + { + Argument.AssertNotNull(colors, nameof(colors)); + + using PipelineMessage message = CreatePipesRequest(colors, options); + return ClientResult.FromResponse(Pipeline.ProcessMessage(message, options)); + } + + /// + /// [Protocol Method] Pipes + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// Possible values for colors are [blue,red,green]. + /// The request options, which can override default behaviors of the client pipeline on a per-call basis. + /// is null. + /// Service returned a non-success status code. + /// The response returned from the service. + public virtual async Task PipesAsync(IEnumerable colors, RequestOptions options) + { + Argument.AssertNotNull(colors, nameof(colors)); + + using PipelineMessage message = CreatePipesRequest(colors, options); + return ClientResult.FromResponse(await Pipeline.ProcessMessageAsync(message, options).ConfigureAwait(false)); + } + + /// Pipes. + /// Possible values for colors are [blue,red,green]. + /// The cancellation token that can be used to cancel the operation. + /// is null. + /// Service returned a non-success status code. + public virtual ClientResult Pipes(IEnumerable colors, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(colors, nameof(colors)); + + return Pipes(colors, cancellationToken.ToRequestOptions()); + } + + /// Pipes. + /// Possible values for colors are [blue,red,green]. + /// The cancellation token that can be used to cancel the operation. + /// is null. + /// Service returned a non-success status code. + public virtual async Task PipesAsync(IEnumerable colors, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(colors, nameof(colors)); + + return await PipesAsync(colors, cancellationToken.ToRequestOptions()).ConfigureAwait(false); + } + + /// + /// [Protocol Method] Csv + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// Possible values for colors are [blue,red,green]. + /// The request options, which can override default behaviors of the client pipeline on a per-call basis. + /// is null. + /// Service returned a non-success status code. + /// The response returned from the service. + public virtual ClientResult Csv(IEnumerable colors, RequestOptions options) + { + Argument.AssertNotNull(colors, nameof(colors)); + + using PipelineMessage message = CreateCsvRequest(colors, options); + return ClientResult.FromResponse(Pipeline.ProcessMessage(message, options)); + } + + /// + /// [Protocol Method] Csv + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// Possible values for colors are [blue,red,green]. + /// The request options, which can override default behaviors of the client pipeline on a per-call basis. + /// is null. + /// Service returned a non-success status code. + /// The response returned from the service. + public virtual async Task CsvAsync(IEnumerable colors, RequestOptions options) + { + Argument.AssertNotNull(colors, nameof(colors)); + + using PipelineMessage message = CreateCsvRequest(colors, options); + return ClientResult.FromResponse(await Pipeline.ProcessMessageAsync(message, options).ConfigureAwait(false)); + } + + /// Csv. + /// Possible values for colors are [blue,red,green]. + /// The cancellation token that can be used to cancel the operation. + /// is null. + /// Service returned a non-success status code. + public virtual ClientResult Csv(IEnumerable colors, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(colors, nameof(colors)); + + return Csv(colors, cancellationToken.ToRequestOptions()); + } + + /// Csv. + /// Possible values for colors are [blue,red,green]. + /// The cancellation token that can be used to cancel the operation. + /// is null. + /// Service returned a non-success status code. + public virtual async Task CsvAsync(IEnumerable colors, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(colors, nameof(colors)); + + return await CsvAsync(colors, cancellationToken.ToRequestOptions()).ConfigureAwait(false); + } } } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/path/src/Generated/PathClient.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/path/src/Generated/PathClient.cs index 11094da54ed..d0563f49bda 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/path/src/Generated/PathClient.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/path/src/Generated/PathClient.cs @@ -13,12 +13,14 @@ namespace Parameters.Path { public partial class PathClient { - public PathClient() => throw null; + public PathClient() : this(new Uri("http://localhost:3000"), new PathClientOptions()) => throw null; - public PathClient(Uri endpoint, PathClientOptions options) => throw null; + internal PathClient(AuthenticationPolicy authenticationPolicy, Uri endpoint, PathClientOptions options) => throw null; + + public PathClient(Uri endpoint, PathClientOptions options) : this(null, endpoint, options) => throw null; [Experimental("SCME0002")] - public PathClient(PathClientSettings settings) => throw null; + public PathClient(PathClientSettings settings) : this(AuthenticationPolicy.Create(settings), settings?.Endpoint, settings?.Options) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/query/src/Generated/Constant.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/query/src/Generated/Constant.cs index b1be965f2d8..3545cccf023 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/query/src/Generated/Constant.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/query/src/Generated/Constant.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -13,6 +14,8 @@ public partial class Constant { protected Constant() => throw null; + internal Constant(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult Post(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/query/src/Generated/QueryClient.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/query/src/Generated/QueryClient.cs index e9a23f5c534..6a4be8cbeed 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/query/src/Generated/QueryClient.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/query/src/Generated/QueryClient.cs @@ -10,12 +10,14 @@ namespace Parameters.Query { public partial class QueryClient { - public QueryClient() => throw null; + public QueryClient() : this(new Uri("http://localhost:3000"), new QueryClientOptions()) => throw null; - public QueryClient(Uri endpoint, QueryClientOptions options) => throw null; + internal QueryClient(AuthenticationPolicy authenticationPolicy, Uri endpoint, QueryClientOptions options) => throw null; + + public QueryClient(Uri endpoint, QueryClientOptions options) : this(null, endpoint, options) => throw null; [Experimental("SCME0002")] - public QueryClient(QueryClientSettings settings) => throw null; + public QueryClient(QueryClientSettings settings) : this(AuthenticationPolicy.Create(settings), settings?.Endpoint, settings?.Options) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/spread/src/Generated/Alias.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/spread/src/Generated/Alias.cs index ec8be6a9570..201900b0bc1 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/spread/src/Generated/Alias.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/spread/src/Generated/Alias.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Collections.Generic; @@ -14,6 +15,8 @@ public partial class Alias { protected Alias() => throw null; + internal Alias(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult SpreadAsRequestBody(BinaryContent content, RequestOptions options = null) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/spread/src/Generated/Model.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/spread/src/Generated/Model.cs index 31ca1bfeab4..792e9511624 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/spread/src/Generated/Model.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/spread/src/Generated/Model.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -13,6 +14,8 @@ public partial class Model { protected Model() => throw null; + internal Model(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult SpreadAsRequestBody(BinaryContent content, RequestOptions options = null) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/spread/src/Generated/SpreadClient.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/spread/src/Generated/SpreadClient.cs index c5a95ad9cc7..5367a1359ab 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/spread/src/Generated/SpreadClient.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/spread/src/Generated/SpreadClient.cs @@ -12,12 +12,14 @@ namespace Parameters.Spread { public partial class SpreadClient { - public SpreadClient() => throw null; + public SpreadClient() : this(new Uri("http://localhost:3000"), new SpreadClientOptions()) => throw null; - public SpreadClient(Uri endpoint, SpreadClientOptions options) => throw null; + internal SpreadClient(AuthenticationPolicy authenticationPolicy, Uri endpoint, SpreadClientOptions options) => throw null; + + public SpreadClient(Uri endpoint, SpreadClientOptions options) : this(null, endpoint, options) => throw null; [Experimental("SCME0002")] - public SpreadClient(SpreadClientSettings settings) => throw null; + public SpreadClient(SpreadClientSettings settings) : this(AuthenticationPolicy.Create(settings), settings?.Endpoint, settings?.Options) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/content-negotiation/src/Generated/ContentNegotiationClient.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/content-negotiation/src/Generated/ContentNegotiationClient.cs index d4401918516..919000580c5 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/content-negotiation/src/Generated/ContentNegotiationClient.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/content-negotiation/src/Generated/ContentNegotiationClient.cs @@ -12,12 +12,14 @@ namespace Payload.ContentNegotiation { public partial class ContentNegotiationClient { - public ContentNegotiationClient() => throw null; + public ContentNegotiationClient() : this(new Uri("http://localhost:3000"), new ContentNegotiationClientOptions()) => throw null; - public ContentNegotiationClient(Uri endpoint, ContentNegotiationClientOptions options) => throw null; + internal ContentNegotiationClient(AuthenticationPolicy authenticationPolicy, Uri endpoint, ContentNegotiationClientOptions options) => throw null; + + public ContentNegotiationClient(Uri endpoint, ContentNegotiationClientOptions options) : this(null, endpoint, options) => throw null; [Experimental("SCME0002")] - public ContentNegotiationClient(ContentNegotiationClientSettings settings) => throw null; + public ContentNegotiationClient(ContentNegotiationClientSettings settings) : this(AuthenticationPolicy.Create(settings), settings?.Endpoint, settings?.Options) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/content-negotiation/src/Generated/DifferentBody.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/content-negotiation/src/Generated/DifferentBody.cs index 76ada7bada7..765ef0cc721 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/content-negotiation/src/Generated/DifferentBody.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/content-negotiation/src/Generated/DifferentBody.cs @@ -14,6 +14,8 @@ public partial class DifferentBody { protected DifferentBody() => throw null; + internal DifferentBody(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult GetAvatarAsPng(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/content-negotiation/src/Generated/SameBody.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/content-negotiation/src/Generated/SameBody.cs index fd6ad96379d..57af2a77ab4 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/content-negotiation/src/Generated/SameBody.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/content-negotiation/src/Generated/SameBody.cs @@ -14,6 +14,8 @@ public partial class SameBody { protected SameBody() => throw null; + internal SameBody(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult GetAvatarAsPng(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/json-merge-patch/src/Generated/JsonMergePatchClient.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/json-merge-patch/src/Generated/JsonMergePatchClient.cs index 01a560ae62b..878bd2ed9bd 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/json-merge-patch/src/Generated/JsonMergePatchClient.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/json-merge-patch/src/Generated/JsonMergePatchClient.cs @@ -13,12 +13,14 @@ namespace Payload.JsonMergePatch { public partial class JsonMergePatchClient { - public JsonMergePatchClient() => throw null; + public JsonMergePatchClient() : this(new Uri("http://localhost:3000"), new JsonMergePatchClientOptions()) => throw null; - public JsonMergePatchClient(Uri endpoint, JsonMergePatchClientOptions options) => throw null; + internal JsonMergePatchClient(AuthenticationPolicy authenticationPolicy, Uri endpoint, JsonMergePatchClientOptions options) => throw null; + + public JsonMergePatchClient(Uri endpoint, JsonMergePatchClientOptions options) : this(null, endpoint, options) => throw null; [Experimental("SCME0002")] - public JsonMergePatchClient(JsonMergePatchClientSettings settings) => throw null; + public JsonMergePatchClient(JsonMergePatchClientSettings settings) : this(AuthenticationPolicy.Create(settings), settings?.Endpoint, settings?.Options) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/media-type/src/Generated/MediaTypeClient.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/media-type/src/Generated/MediaTypeClient.cs index eb46a8d77b6..dbfd6a68c4c 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/media-type/src/Generated/MediaTypeClient.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/media-type/src/Generated/MediaTypeClient.cs @@ -11,12 +11,14 @@ namespace Payload.MediaType { public partial class MediaTypeClient { - public MediaTypeClient() => throw null; + public MediaTypeClient() : this(new Uri("http://localhost:3000"), new MediaTypeClientOptions()) => throw null; - public MediaTypeClient(Uri endpoint, MediaTypeClientOptions options) => throw null; + internal MediaTypeClient(AuthenticationPolicy authenticationPolicy, Uri endpoint, MediaTypeClientOptions options) => throw null; + + public MediaTypeClient(Uri endpoint, MediaTypeClientOptions options) : this(null, endpoint, options) => throw null; [Experimental("SCME0002")] - public MediaTypeClient(MediaTypeClientSettings settings) => throw null; + public MediaTypeClient(MediaTypeClientSettings settings) : this(AuthenticationPolicy.Create(settings), settings?.Endpoint, settings?.Options) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/media-type/src/Generated/StringBody.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/media-type/src/Generated/StringBody.cs index f31c4875707..3efbadabb94 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/media-type/src/Generated/StringBody.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/media-type/src/Generated/StringBody.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -13,6 +14,8 @@ public partial class StringBody { protected StringBody() => throw null; + internal StringBody(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult SendAsText(BinaryContent content, RequestOptions options = null) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/multipart/src/Generated/FormData.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/multipart/src/Generated/FormData.cs index c6e02e93832..7af85b26e37 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/multipart/src/Generated/FormData.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/multipart/src/Generated/FormData.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading.Tasks; @@ -14,6 +15,8 @@ public partial class FormData { protected FormData() => throw null; + internal FormData(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult Basic(BinaryContent content, string contentType, RequestOptions options = null) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/multipart/src/Generated/FormDataFile.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/multipart/src/Generated/FormDataFile.cs index 055f8f20cb7..af3b92422ad 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/multipart/src/Generated/FormDataFile.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/multipart/src/Generated/FormDataFile.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading.Tasks; @@ -12,6 +13,8 @@ public partial class FormDataFile { protected FormDataFile() => throw null; + internal FormDataFile(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult UploadFileSpecificContentType(BinaryContent content, string contentType, RequestOptions options = null) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/multipart/src/Generated/FormDataHttpParts.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/multipart/src/Generated/FormDataHttpParts.cs index 033e295e92d..53b236c7af8 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/multipart/src/Generated/FormDataHttpParts.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/multipart/src/Generated/FormDataHttpParts.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading.Tasks; @@ -14,6 +15,8 @@ public partial class FormDataHttpParts { protected FormDataHttpParts() => throw null; + internal FormDataHttpParts(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult JsonArrayAndFileArray(BinaryContent content, string contentType, RequestOptions options = null) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/multipart/src/Generated/FormDataHttpPartsContentType.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/multipart/src/Generated/FormDataHttpPartsContentType.cs index 32cb80df3d0..971ee6ad114 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/multipart/src/Generated/FormDataHttpPartsContentType.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/multipart/src/Generated/FormDataHttpPartsContentType.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading.Tasks; @@ -12,6 +13,8 @@ public partial class FormDataHttpPartsContentType { protected FormDataHttpPartsContentType() => throw null; + internal FormDataHttpPartsContentType(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult ImageJpegContentType(BinaryContent content, string contentType, RequestOptions options = null) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/multipart/src/Generated/FormDataHttpPartsNonString.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/multipart/src/Generated/FormDataHttpPartsNonString.cs index 47557d7876b..cfb735ba1c8 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/multipart/src/Generated/FormDataHttpPartsNonString.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/multipart/src/Generated/FormDataHttpPartsNonString.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading.Tasks; @@ -12,6 +13,8 @@ public partial class FormDataHttpPartsNonString { protected FormDataHttpPartsNonString() => throw null; + internal FormDataHttpPartsNonString(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult Float(BinaryContent content, string contentType, RequestOptions options = null) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/multipart/src/Generated/MultiPartClient.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/multipart/src/Generated/MultiPartClient.cs index ae8d9b57459..882e5cd3826 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/multipart/src/Generated/MultiPartClient.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/multipart/src/Generated/MultiPartClient.cs @@ -11,12 +11,14 @@ namespace Payload.MultiPart { public partial class MultiPartClient { - public MultiPartClient() => throw null; + public MultiPartClient() : this(new Uri("http://localhost:3000"), new MultiPartClientOptions()) => throw null; - public MultiPartClient(Uri endpoint, MultiPartClientOptions options) => throw null; + internal MultiPartClient(AuthenticationPolicy authenticationPolicy, Uri endpoint, MultiPartClientOptions options) => throw null; + + public MultiPartClient(Uri endpoint, MultiPartClientOptions options) : this(null, endpoint, options) => throw null; [Experimental("SCME0002")] - public MultiPartClient(MultiPartClientSettings settings) => throw null; + public MultiPartClient(MultiPartClientSettings settings) : this(AuthenticationPolicy.Create(settings), settings?.Endpoint, settings?.Options) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/pageable/src/Generated/PageSize.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/pageable/src/Generated/PageSize.cs index aa4b7b3ce6a..1ba387d0819 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/pageable/src/Generated/PageSize.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/pageable/src/Generated/PageSize.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -13,6 +14,8 @@ public partial class PageSize { protected PageSize() => throw null; + internal PageSize(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual CollectionResult GetWithoutContinuation(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/pageable/src/Generated/PageableClient.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/pageable/src/Generated/PageableClient.cs index c4d9477bd64..3b78a1ed79c 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/pageable/src/Generated/PageableClient.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/pageable/src/Generated/PageableClient.cs @@ -13,12 +13,14 @@ namespace Payload.Pageable { public partial class PageableClient { - public PageableClient() => throw null; + public PageableClient() : this(new Uri("http://localhost:3000"), new PageableClientOptions()) => throw null; - public PageableClient(Uri endpoint, PageableClientOptions options) => throw null; + internal PageableClient(AuthenticationPolicy authenticationPolicy, Uri endpoint, PageableClientOptions options) => throw null; + + public PageableClient(Uri endpoint, PageableClientOptions options) : this(null, endpoint, options) => throw null; [Experimental("SCME0002")] - public PageableClient(PageableClientSettings settings) => throw null; + public PageableClient(PageableClientSettings settings) : this(AuthenticationPolicy.Create(settings), settings?.Endpoint, settings?.Options) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/pageable/src/Generated/ServerDrivenPagination.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/pageable/src/Generated/ServerDrivenPagination.cs index b611ba4910d..b027b296309 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/pageable/src/Generated/ServerDrivenPagination.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/pageable/src/Generated/ServerDrivenPagination.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -14,6 +15,8 @@ public partial class ServerDrivenPagination { protected ServerDrivenPagination() => throw null; + internal ServerDrivenPagination(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual CollectionResult Link(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/pageable/src/Generated/ServerDrivenPaginationContinuationToken.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/pageable/src/Generated/ServerDrivenPaginationContinuationToken.cs index 5c48d40f9b3..928eaab911f 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/pageable/src/Generated/ServerDrivenPaginationContinuationToken.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/pageable/src/Generated/ServerDrivenPaginationContinuationToken.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -13,6 +14,8 @@ public partial class ServerDrivenPaginationContinuationToken { protected ServerDrivenPaginationContinuationToken() => throw null; + internal ServerDrivenPaginationContinuationToken(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual CollectionResult RequestQueryResponseBody(string token, string foo, string bar, RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/pageable/src/Generated/XmlPagination.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/pageable/src/Generated/XmlPagination.cs index f5423d536cc..edbc61168f7 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/pageable/src/Generated/XmlPagination.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/pageable/src/Generated/XmlPagination.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -13,6 +14,8 @@ public partial class XmlPagination { protected XmlPagination() => throw null; + internal XmlPagination(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual CollectionResult GetWithContinuation(string marker, RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/xml/src/Generated/ModelWithArrayOfModelValue.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/xml/src/Generated/ModelWithArrayOfModelValue.cs index e3bb0da6da6..f1cfe2710d1 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/xml/src/Generated/ModelWithArrayOfModelValue.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/xml/src/Generated/ModelWithArrayOfModelValue.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -13,6 +14,8 @@ public partial class ModelWithArrayOfModelValue { protected ModelWithArrayOfModelValue() => throw null; + internal ModelWithArrayOfModelValue(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult Get(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/xml/src/Generated/ModelWithAttributesValue.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/xml/src/Generated/ModelWithAttributesValue.cs index b9e82ff75b4..283cfb4c443 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/xml/src/Generated/ModelWithAttributesValue.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/xml/src/Generated/ModelWithAttributesValue.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -13,6 +14,8 @@ public partial class ModelWithAttributesValue { protected ModelWithAttributesValue() => throw null; + internal ModelWithAttributesValue(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult Get(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/xml/src/Generated/ModelWithDictionaryValue.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/xml/src/Generated/ModelWithDictionaryValue.cs index 454fd7f51b9..0c0df435c8a 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/xml/src/Generated/ModelWithDictionaryValue.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/xml/src/Generated/ModelWithDictionaryValue.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -13,6 +14,8 @@ public partial class ModelWithDictionaryValue { protected ModelWithDictionaryValue() => throw null; + internal ModelWithDictionaryValue(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult Get(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/xml/src/Generated/ModelWithEmptyArrayValue.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/xml/src/Generated/ModelWithEmptyArrayValue.cs index f97e5bb89d6..bad31fbc8cc 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/xml/src/Generated/ModelWithEmptyArrayValue.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/xml/src/Generated/ModelWithEmptyArrayValue.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -13,6 +14,8 @@ public partial class ModelWithEmptyArrayValue { protected ModelWithEmptyArrayValue() => throw null; + internal ModelWithEmptyArrayValue(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult Get(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/xml/src/Generated/ModelWithEncodedNamesValue.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/xml/src/Generated/ModelWithEncodedNamesValue.cs index 1dbf3924200..6b6a02b751f 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/xml/src/Generated/ModelWithEncodedNamesValue.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/xml/src/Generated/ModelWithEncodedNamesValue.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -13,6 +14,8 @@ public partial class ModelWithEncodedNamesValue { protected ModelWithEncodedNamesValue() => throw null; + internal ModelWithEncodedNamesValue(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult Get(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/xml/src/Generated/ModelWithOptionalFieldValue.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/xml/src/Generated/ModelWithOptionalFieldValue.cs index 3dc923de469..e2bbd2a0fe9 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/xml/src/Generated/ModelWithOptionalFieldValue.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/xml/src/Generated/ModelWithOptionalFieldValue.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -13,6 +14,8 @@ public partial class ModelWithOptionalFieldValue { protected ModelWithOptionalFieldValue() => throw null; + internal ModelWithOptionalFieldValue(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult Get(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/xml/src/Generated/ModelWithRenamedArraysValue.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/xml/src/Generated/ModelWithRenamedArraysValue.cs index c27e948d0ef..f387ba00d47 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/xml/src/Generated/ModelWithRenamedArraysValue.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/xml/src/Generated/ModelWithRenamedArraysValue.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -13,6 +14,8 @@ public partial class ModelWithRenamedArraysValue { protected ModelWithRenamedArraysValue() => throw null; + internal ModelWithRenamedArraysValue(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult Get(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/xml/src/Generated/ModelWithRenamedFieldsValue.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/xml/src/Generated/ModelWithRenamedFieldsValue.cs index 976fe8192f3..291ca0113d2 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/xml/src/Generated/ModelWithRenamedFieldsValue.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/xml/src/Generated/ModelWithRenamedFieldsValue.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -13,6 +14,8 @@ public partial class ModelWithRenamedFieldsValue { protected ModelWithRenamedFieldsValue() => throw null; + internal ModelWithRenamedFieldsValue(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult Get(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/xml/src/Generated/ModelWithSimpleArraysValue.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/xml/src/Generated/ModelWithSimpleArraysValue.cs index 221293cbc43..ef168252ce1 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/xml/src/Generated/ModelWithSimpleArraysValue.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/xml/src/Generated/ModelWithSimpleArraysValue.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -13,6 +14,8 @@ public partial class ModelWithSimpleArraysValue { protected ModelWithSimpleArraysValue() => throw null; + internal ModelWithSimpleArraysValue(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult Get(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/xml/src/Generated/ModelWithTextValue.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/xml/src/Generated/ModelWithTextValue.cs index c87bf14cccd..273515d228e 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/xml/src/Generated/ModelWithTextValue.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/xml/src/Generated/ModelWithTextValue.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -13,6 +14,8 @@ public partial class ModelWithTextValue { protected ModelWithTextValue() => throw null; + internal ModelWithTextValue(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult Get(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/xml/src/Generated/ModelWithUnwrappedArrayValue.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/xml/src/Generated/ModelWithUnwrappedArrayValue.cs index 74372fd6b84..319bba5194c 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/xml/src/Generated/ModelWithUnwrappedArrayValue.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/xml/src/Generated/ModelWithUnwrappedArrayValue.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -13,6 +14,8 @@ public partial class ModelWithUnwrappedArrayValue { protected ModelWithUnwrappedArrayValue() => throw null; + internal ModelWithUnwrappedArrayValue(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult Get(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/xml/src/Generated/SimpleModelValue.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/xml/src/Generated/SimpleModelValue.cs index 6a020d4c531..0ca41673678 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/xml/src/Generated/SimpleModelValue.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/xml/src/Generated/SimpleModelValue.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -13,6 +14,8 @@ public partial class SimpleModelValue { protected SimpleModelValue() => throw null; + internal SimpleModelValue(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult Get(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/xml/src/Generated/XmlClient.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/xml/src/Generated/XmlClient.cs index 81dc325d12a..cab5046952f 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/xml/src/Generated/XmlClient.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/xml/src/Generated/XmlClient.cs @@ -10,12 +10,14 @@ namespace Payload.Xml { public partial class XmlClient { - public XmlClient() => throw null; + public XmlClient() : this(new Uri("http://localhost:3000"), new XmlClientOptions()) => throw null; - public XmlClient(Uri endpoint, XmlClientOptions options) => throw null; + internal XmlClient(AuthenticationPolicy authenticationPolicy, Uri endpoint, XmlClientOptions options) => throw null; + + public XmlClient(Uri endpoint, XmlClientOptions options) : this(null, endpoint, options) => throw null; [Experimental("SCME0002")] - public XmlClient(XmlClientSettings settings) => throw null; + public XmlClient(XmlClientSettings settings) : this(AuthenticationPolicy.Create(settings), settings?.Endpoint, settings?.Options) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/xml/src/Generated/XmlErrorValue.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/xml/src/Generated/XmlErrorValue.cs index 13069ff4ebb..cf37b300967 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/xml/src/Generated/XmlErrorValue.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/xml/src/Generated/XmlErrorValue.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -13,6 +14,8 @@ public partial class XmlErrorValue { protected XmlErrorValue() => throw null; + internal XmlErrorValue(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult Get(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/resiliency/srv-driven/v1/src/Generated/ResiliencyServiceDrivenClient.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/resiliency/srv-driven/v1/src/Generated/ResiliencyServiceDrivenClient.cs index 0858f38f289..0d010ec8ea0 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/resiliency/srv-driven/v1/src/Generated/ResiliencyServiceDrivenClient.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/resiliency/srv-driven/v1/src/Generated/ResiliencyServiceDrivenClient.cs @@ -15,12 +15,14 @@ public partial class ResiliencyServiceDrivenClient { protected ResiliencyServiceDrivenClient() => throw null; - public ResiliencyServiceDrivenClient(Uri endpoint, string serviceDeploymentVersion) => throw null; + public ResiliencyServiceDrivenClient(Uri endpoint, string serviceDeploymentVersion) : this(endpoint, serviceDeploymentVersion, new ResiliencyServiceDrivenClientOptions()) => throw null; - public ResiliencyServiceDrivenClient(Uri endpoint, string serviceDeploymentVersion, ResiliencyServiceDrivenClientOptions options) => throw null; + internal ResiliencyServiceDrivenClient(AuthenticationPolicy authenticationPolicy, Uri endpoint, string serviceDeploymentVersion, ResiliencyServiceDrivenClientOptions options) => throw null; + + public ResiliencyServiceDrivenClient(Uri endpoint, string serviceDeploymentVersion, ResiliencyServiceDrivenClientOptions options) : this(null, endpoint, serviceDeploymentVersion, options) => throw null; [Experimental("SCME0002")] - public ResiliencyServiceDrivenClient(ResiliencyServiceDrivenClientSettings settings) => throw null; + public ResiliencyServiceDrivenClient(ResiliencyServiceDrivenClientSettings settings) : this(AuthenticationPolicy.Create(settings), settings?.Endpoint, settings?.ServiceDeploymentVersion, settings?.Options) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/resiliency/srv-driven/v2/src/Generated/ResiliencyServiceDrivenClient.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/resiliency/srv-driven/v2/src/Generated/ResiliencyServiceDrivenClient.cs index 24668d794cd..59d7160e347 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/resiliency/srv-driven/v2/src/Generated/ResiliencyServiceDrivenClient.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/resiliency/srv-driven/v2/src/Generated/ResiliencyServiceDrivenClient.cs @@ -15,12 +15,14 @@ public partial class ResiliencyServiceDrivenClient { protected ResiliencyServiceDrivenClient() => throw null; - public ResiliencyServiceDrivenClient(Uri endpoint, string serviceDeploymentVersion) => throw null; + public ResiliencyServiceDrivenClient(Uri endpoint, string serviceDeploymentVersion) : this(endpoint, serviceDeploymentVersion, new ResiliencyServiceDrivenClientOptions()) => throw null; - public ResiliencyServiceDrivenClient(Uri endpoint, string serviceDeploymentVersion, ResiliencyServiceDrivenClientOptions options) => throw null; + internal ResiliencyServiceDrivenClient(AuthenticationPolicy authenticationPolicy, Uri endpoint, string serviceDeploymentVersion, ResiliencyServiceDrivenClientOptions options) => throw null; + + public ResiliencyServiceDrivenClient(Uri endpoint, string serviceDeploymentVersion, ResiliencyServiceDrivenClientOptions options) : this(null, endpoint, serviceDeploymentVersion, options) => throw null; [Experimental("SCME0002")] - public ResiliencyServiceDrivenClient(ResiliencyServiceDrivenClientSettings settings) => throw null; + public ResiliencyServiceDrivenClient(ResiliencyServiceDrivenClientSettings settings) : this(AuthenticationPolicy.Create(settings), settings?.Endpoint, settings?.ServiceDeploymentVersion, settings?.Options) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/response/status-code-range/src/Generated/StatusCodeRangeClient.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/response/status-code-range/src/Generated/StatusCodeRangeClient.cs index e0c48a15a85..1cf6258e804 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/response/status-code-range/src/Generated/StatusCodeRangeClient.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/response/status-code-range/src/Generated/StatusCodeRangeClient.cs @@ -13,12 +13,14 @@ namespace Response.StatusCodeRange { public partial class StatusCodeRangeClient { - public StatusCodeRangeClient() => throw null; + public StatusCodeRangeClient() : this(new Uri("http://localhost:3000"), new StatusCodeRangeClientOptions()) => throw null; - public StatusCodeRangeClient(Uri endpoint, StatusCodeRangeClientOptions options) => throw null; + internal StatusCodeRangeClient(AuthenticationPolicy authenticationPolicy, Uri endpoint, StatusCodeRangeClientOptions options) => throw null; + + public StatusCodeRangeClient(Uri endpoint, StatusCodeRangeClientOptions options) : this(null, endpoint, options) => throw null; [Experimental("SCME0002")] - public StatusCodeRangeClient(StatusCodeRangeClientSettings settings) => throw null; + public StatusCodeRangeClient(StatusCodeRangeClientSettings settings) : this(AuthenticationPolicy.Create(settings), settings?.Endpoint, settings?.Options) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/InInterface.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/InInterface.cs index 2c68d8281b8..934018fdcc3 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/InInterface.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/InInterface.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -13,6 +14,8 @@ public partial class InInterface { protected InInterface() => throw null; + internal InInterface(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult Fixed(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/PathParameters.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/PathParameters.cs index 3e17767b7d8..305a607546a 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/PathParameters.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/PathParameters.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -18,6 +19,8 @@ public partial class PathParameters { protected PathParameters() => throw null; + internal PathParameters(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult TemplateOnly(string @param, RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/PathParametersLabelExpansion.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/PathParametersLabelExpansion.cs index b7d6a6cbc7c..a3daa8878cb 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/PathParametersLabelExpansion.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/PathParametersLabelExpansion.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel.Primitives; using Routes._PathParameters.LabelExpansion.Explode; using Routes._PathParameters.LabelExpansion.Standard; @@ -12,6 +13,8 @@ public partial class PathParametersLabelExpansion { protected PathParametersLabelExpansion() => throw null; + internal PathParametersLabelExpansion(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual PathParametersLabelExpansionStandard GetPathParametersLabelExpansionStandardClient() => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/PathParametersLabelExpansionExplode.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/PathParametersLabelExpansionExplode.cs index 79470e680e1..d032c33fc38 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/PathParametersLabelExpansionExplode.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/PathParametersLabelExpansionExplode.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Collections.Generic; @@ -14,6 +15,8 @@ public partial class PathParametersLabelExpansionExplode { protected PathParametersLabelExpansionExplode() => throw null; + internal PathParametersLabelExpansionExplode(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult Primitive(string @param, RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/PathParametersLabelExpansionStandard.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/PathParametersLabelExpansionStandard.cs index 0b742d05724..f18f1e516cc 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/PathParametersLabelExpansionStandard.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/PathParametersLabelExpansionStandard.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Collections.Generic; @@ -14,6 +15,8 @@ public partial class PathParametersLabelExpansionStandard { protected PathParametersLabelExpansionStandard() => throw null; + internal PathParametersLabelExpansionStandard(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult Primitive(string @param, RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/PathParametersMatrixExpansion.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/PathParametersMatrixExpansion.cs index 6bf98190256..5c60d18f7bb 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/PathParametersMatrixExpansion.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/PathParametersMatrixExpansion.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel.Primitives; using Routes._PathParameters.MatrixExpansion.Explode; using Routes._PathParameters.MatrixExpansion.Standard; @@ -12,6 +13,8 @@ public partial class PathParametersMatrixExpansion { protected PathParametersMatrixExpansion() => throw null; + internal PathParametersMatrixExpansion(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual PathParametersMatrixExpansionStandard GetPathParametersMatrixExpansionStandardClient() => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/PathParametersMatrixExpansionExplode.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/PathParametersMatrixExpansionExplode.cs index b92df406571..bf3f3e88d58 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/PathParametersMatrixExpansionExplode.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/PathParametersMatrixExpansionExplode.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Collections.Generic; @@ -14,6 +15,8 @@ public partial class PathParametersMatrixExpansionExplode { protected PathParametersMatrixExpansionExplode() => throw null; + internal PathParametersMatrixExpansionExplode(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult Primitive(string @param, RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/PathParametersMatrixExpansionStandard.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/PathParametersMatrixExpansionStandard.cs index d40c1696d15..165a76d190f 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/PathParametersMatrixExpansionStandard.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/PathParametersMatrixExpansionStandard.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Collections.Generic; @@ -14,6 +15,8 @@ public partial class PathParametersMatrixExpansionStandard { protected PathParametersMatrixExpansionStandard() => throw null; + internal PathParametersMatrixExpansionStandard(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult Primitive(string @param, RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/PathParametersPathExpansion.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/PathParametersPathExpansion.cs index ec2f665c1a2..11bd31de479 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/PathParametersPathExpansion.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/PathParametersPathExpansion.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel.Primitives; using Routes._PathParameters.PathExpansion.Explode; using Routes._PathParameters.PathExpansion.Standard; @@ -12,6 +13,8 @@ public partial class PathParametersPathExpansion { protected PathParametersPathExpansion() => throw null; + internal PathParametersPathExpansion(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual PathParametersPathExpansionStandard GetPathParametersPathExpansionStandardClient() => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/PathParametersPathExpansionExplode.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/PathParametersPathExpansionExplode.cs index b7f10f1c6d4..e2368337641 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/PathParametersPathExpansionExplode.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/PathParametersPathExpansionExplode.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Collections.Generic; @@ -14,6 +15,8 @@ public partial class PathParametersPathExpansionExplode { protected PathParametersPathExpansionExplode() => throw null; + internal PathParametersPathExpansionExplode(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult Primitive(string @param, RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/PathParametersPathExpansionStandard.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/PathParametersPathExpansionStandard.cs index d58ca6fbc4d..8c63b0829fb 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/PathParametersPathExpansionStandard.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/PathParametersPathExpansionStandard.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Collections.Generic; @@ -14,6 +15,8 @@ public partial class PathParametersPathExpansionStandard { protected PathParametersPathExpansionStandard() => throw null; + internal PathParametersPathExpansionStandard(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult Primitive(string @param, RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/PathParametersReservedExpansion.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/PathParametersReservedExpansion.cs index 3becc3ca8f2..60f78bfde07 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/PathParametersReservedExpansion.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/PathParametersReservedExpansion.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -13,6 +14,8 @@ public partial class PathParametersReservedExpansion { protected PathParametersReservedExpansion() => throw null; + internal PathParametersReservedExpansion(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult Template(string @param, RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/PathParametersSimpleExpansion.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/PathParametersSimpleExpansion.cs index cb3b2ce1c3a..87724df6d6d 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/PathParametersSimpleExpansion.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/PathParametersSimpleExpansion.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel.Primitives; using Routes._PathParameters.SimpleExpansion.Explode; using Routes._PathParameters.SimpleExpansion.Standard; @@ -12,6 +13,8 @@ public partial class PathParametersSimpleExpansion { protected PathParametersSimpleExpansion() => throw null; + internal PathParametersSimpleExpansion(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual PathParametersSimpleExpansionStandard GetPathParametersSimpleExpansionStandardClient() => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/PathParametersSimpleExpansionExplode.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/PathParametersSimpleExpansionExplode.cs index 00c4d218a1c..2abcc233d4b 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/PathParametersSimpleExpansionExplode.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/PathParametersSimpleExpansionExplode.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Collections.Generic; @@ -14,6 +15,8 @@ public partial class PathParametersSimpleExpansionExplode { protected PathParametersSimpleExpansionExplode() => throw null; + internal PathParametersSimpleExpansionExplode(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult Primitive(string @param, RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/PathParametersSimpleExpansionStandard.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/PathParametersSimpleExpansionStandard.cs index 63477a318ae..21f896bcdb3 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/PathParametersSimpleExpansionStandard.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/PathParametersSimpleExpansionStandard.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Collections.Generic; @@ -14,6 +15,8 @@ public partial class PathParametersSimpleExpansionStandard { protected PathParametersSimpleExpansionStandard() => throw null; + internal PathParametersSimpleExpansionStandard(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult Primitive(string @param, RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/QueryParameters.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/QueryParameters.cs index 4ccfde73030..50f707d2cf0 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/QueryParameters.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/QueryParameters.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -15,6 +16,8 @@ public partial class QueryParameters { protected QueryParameters() => throw null; + internal QueryParameters(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult TemplateOnly(string @param, RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/QueryParametersQueryContinuation.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/QueryParametersQueryContinuation.cs index c1e1821e791..3aa640a00e5 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/QueryParametersQueryContinuation.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/QueryParametersQueryContinuation.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel.Primitives; using Routes._QueryParameters.QueryContinuation.Explode; using Routes._QueryParameters.QueryContinuation.Standard; @@ -12,6 +13,8 @@ public partial class QueryParametersQueryContinuation { protected QueryParametersQueryContinuation() => throw null; + internal QueryParametersQueryContinuation(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual QueryParametersQueryContinuationStandard GetQueryParametersQueryContinuationStandardClient() => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/QueryParametersQueryContinuationExplode.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/QueryParametersQueryContinuationExplode.cs index b9a3cb696d4..ca911b55cb3 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/QueryParametersQueryContinuationExplode.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/QueryParametersQueryContinuationExplode.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Collections.Generic; @@ -14,6 +15,8 @@ public partial class QueryParametersQueryContinuationExplode { protected QueryParametersQueryContinuationExplode() => throw null; + internal QueryParametersQueryContinuationExplode(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult Primitive(string @param, RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/QueryParametersQueryContinuationStandard.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/QueryParametersQueryContinuationStandard.cs index 679ca546a46..828f03e49f2 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/QueryParametersQueryContinuationStandard.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/QueryParametersQueryContinuationStandard.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Collections.Generic; @@ -14,6 +15,8 @@ public partial class QueryParametersQueryContinuationStandard { protected QueryParametersQueryContinuationStandard() => throw null; + internal QueryParametersQueryContinuationStandard(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult Primitive(string @param, RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/QueryParametersQueryExpansion.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/QueryParametersQueryExpansion.cs index 7038262cc30..4d2b16565c0 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/QueryParametersQueryExpansion.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/QueryParametersQueryExpansion.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel.Primitives; using Routes._QueryParameters.QueryExpansion.Explode; using Routes._QueryParameters.QueryExpansion.Standard; @@ -12,6 +13,8 @@ public partial class QueryParametersQueryExpansion { protected QueryParametersQueryExpansion() => throw null; + internal QueryParametersQueryExpansion(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual QueryParametersQueryExpansionStandard GetQueryParametersQueryExpansionStandardClient() => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/QueryParametersQueryExpansionExplode.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/QueryParametersQueryExpansionExplode.cs index cedde7fe6aa..e8989434a9d 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/QueryParametersQueryExpansionExplode.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/QueryParametersQueryExpansionExplode.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Collections.Generic; @@ -14,6 +15,8 @@ public partial class QueryParametersQueryExpansionExplode { protected QueryParametersQueryExpansionExplode() => throw null; + internal QueryParametersQueryExpansionExplode(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult Primitive(string @param, RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/QueryParametersQueryExpansionStandard.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/QueryParametersQueryExpansionStandard.cs index dd88da3b509..9566e4d25f8 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/QueryParametersQueryExpansionStandard.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/QueryParametersQueryExpansionStandard.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Collections.Generic; @@ -14,6 +15,8 @@ public partial class QueryParametersQueryExpansionStandard { protected QueryParametersQueryExpansionStandard() => throw null; + internal QueryParametersQueryExpansionStandard(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult Primitive(string @param, RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/RoutesClient.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/RoutesClient.cs index 835c7c58cd7..8e156cfd6b7 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/RoutesClient.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/src/Generated/RoutesClient.cs @@ -15,12 +15,14 @@ namespace Routes { public partial class RoutesClient { - public RoutesClient() => throw null; + public RoutesClient() : this(new Uri("http://localhost:3000"), new RoutesClientOptions()) => throw null; - public RoutesClient(Uri endpoint, RoutesClientOptions options) => throw null; + internal RoutesClient(AuthenticationPolicy authenticationPolicy, Uri endpoint, RoutesClientOptions options) => throw null; + + public RoutesClient(Uri endpoint, RoutesClientOptions options) : this(null, endpoint, options) => throw null; [Experimental("SCME0002")] - public RoutesClient(RoutesClientSettings settings) => throw null; + public RoutesClient(RoutesClientSettings settings) : this(AuthenticationPolicy.Create(settings), settings?.Endpoint, settings?.Options) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/serialization/encoded-name/json/src/Generated/JsonClient.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/serialization/encoded-name/json/src/Generated/JsonClient.cs index 628ce575919..5501186e310 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/serialization/encoded-name/json/src/Generated/JsonClient.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/serialization/encoded-name/json/src/Generated/JsonClient.cs @@ -11,12 +11,14 @@ namespace Serialization.EncodedName.Json { public partial class JsonClient { - public JsonClient() => throw null; + public JsonClient() : this(new Uri("http://localhost:3000"), new JsonClientOptions()) => throw null; - public JsonClient(Uri endpoint, JsonClientOptions options) => throw null; + internal JsonClient(AuthenticationPolicy authenticationPolicy, Uri endpoint, JsonClientOptions options) => throw null; + + public JsonClient(Uri endpoint, JsonClientOptions options) : this(null, endpoint, options) => throw null; [Experimental("SCME0002")] - public JsonClient(JsonClientSettings settings) => throw null; + public JsonClient(JsonClientSettings settings) : this(AuthenticationPolicy.Create(settings), settings?.Endpoint, settings?.Options) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/serialization/encoded-name/json/src/Generated/Property.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/serialization/encoded-name/json/src/Generated/Property.cs index 2a1aea1756d..67558d68030 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/serialization/encoded-name/json/src/Generated/Property.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/serialization/encoded-name/json/src/Generated/Property.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -13,6 +14,8 @@ public partial class Property { protected Property() => throw null; + internal Property(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult Send(BinaryContent content, RequestOptions options = null) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/server/endpoint/not-defined/src/Generated/NotDefinedClient.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/server/endpoint/not-defined/src/Generated/NotDefinedClient.cs index 4f941f9c7c3..a503b59d200 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/server/endpoint/not-defined/src/Generated/NotDefinedClient.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/server/endpoint/not-defined/src/Generated/NotDefinedClient.cs @@ -15,12 +15,14 @@ public partial class NotDefinedClient { protected NotDefinedClient() => throw null; - public NotDefinedClient(Uri endpoint) => throw null; + public NotDefinedClient(Uri endpoint) : this(endpoint, new NotDefinedClientOptions()) => throw null; - public NotDefinedClient(Uri endpoint, NotDefinedClientOptions options) => throw null; + internal NotDefinedClient(AuthenticationPolicy authenticationPolicy, Uri endpoint, NotDefinedClientOptions options) => throw null; + + public NotDefinedClient(Uri endpoint, NotDefinedClientOptions options) : this(null, endpoint, options) => throw null; [Experimental("SCME0002")] - public NotDefinedClient(NotDefinedClientSettings settings) => throw null; + public NotDefinedClient(NotDefinedClientSettings settings) : this(AuthenticationPolicy.Create(settings), settings?.Endpoint, settings?.Options) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/server/path/multiple/src/Generated/MultipleClient.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/server/path/multiple/src/Generated/MultipleClient.cs index d4c2debf3bd..10ba60fb3a1 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/server/path/multiple/src/Generated/MultipleClient.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/server/path/multiple/src/Generated/MultipleClient.cs @@ -15,12 +15,14 @@ public partial class MultipleClient { protected MultipleClient() => throw null; - public MultipleClient(Uri endpoint) => throw null; + public MultipleClient(Uri endpoint) : this(endpoint, new MultipleClientOptions()) => throw null; - public MultipleClient(Uri endpoint, MultipleClientOptions options) => throw null; + internal MultipleClient(AuthenticationPolicy authenticationPolicy, Uri endpoint, MultipleClientOptions options) => throw null; + + public MultipleClient(Uri endpoint, MultipleClientOptions options) : this(null, endpoint, options) => throw null; [Experimental("SCME0002")] - public MultipleClient(MultipleClientSettings settings) => throw null; + public MultipleClient(MultipleClientSettings settings) : this(AuthenticationPolicy.Create(settings), settings?.Endpoint, settings?.Options) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/server/path/single/src/Generated/SingleClient.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/server/path/single/src/Generated/SingleClient.cs index 4c47fdb1c66..3bc250e9775 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/server/path/single/src/Generated/SingleClient.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/server/path/single/src/Generated/SingleClient.cs @@ -15,12 +15,14 @@ public partial class SingleClient { protected SingleClient() => throw null; - public SingleClient(Uri endpoint) => throw null; + public SingleClient(Uri endpoint) : this(endpoint, new SingleClientOptions()) => throw null; - public SingleClient(Uri endpoint, SingleClientOptions options) => throw null; + internal SingleClient(AuthenticationPolicy authenticationPolicy, Uri endpoint, SingleClientOptions options) => throw null; + + public SingleClient(Uri endpoint, SingleClientOptions options) : this(null, endpoint, options) => throw null; [Experimental("SCME0002")] - public SingleClient(SingleClientSettings settings) => throw null; + public SingleClient(SingleClientSettings settings) : this(AuthenticationPolicy.Create(settings), settings?.Endpoint, settings?.Options) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/server/versions/not-versioned/src/Generated/NotVersionedClient.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/server/versions/not-versioned/src/Generated/NotVersionedClient.cs index 78167a7b2af..66b8752fa2d 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/server/versions/not-versioned/src/Generated/NotVersionedClient.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/server/versions/not-versioned/src/Generated/NotVersionedClient.cs @@ -15,12 +15,14 @@ public partial class NotVersionedClient { protected NotVersionedClient() => throw null; - public NotVersionedClient(Uri endpoint) => throw null; + public NotVersionedClient(Uri endpoint) : this(endpoint, new NotVersionedClientOptions()) => throw null; - public NotVersionedClient(Uri endpoint, NotVersionedClientOptions options) => throw null; + internal NotVersionedClient(AuthenticationPolicy authenticationPolicy, Uri endpoint, NotVersionedClientOptions options) => throw null; + + public NotVersionedClient(Uri endpoint, NotVersionedClientOptions options) : this(null, endpoint, options) => throw null; [Experimental("SCME0002")] - public NotVersionedClient(NotVersionedClientSettings settings) => throw null; + public NotVersionedClient(NotVersionedClientSettings settings) : this(AuthenticationPolicy.Create(settings), settings?.Endpoint, settings?.Options) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/server/versions/versioned/src/Generated/VersionedClient.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/server/versions/versioned/src/Generated/VersionedClient.cs index 114ebf9a3b8..fc5d889c517 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/server/versions/versioned/src/Generated/VersionedClient.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/server/versions/versioned/src/Generated/VersionedClient.cs @@ -15,12 +15,14 @@ public partial class VersionedClient { protected VersionedClient() => throw null; - public VersionedClient(Uri endpoint) => throw null; + public VersionedClient(Uri endpoint) : this(endpoint, new VersionedClientOptions()) => throw null; - public VersionedClient(Uri endpoint, VersionedClientOptions options) => throw null; + internal VersionedClient(AuthenticationPolicy authenticationPolicy, Uri endpoint, VersionedClientOptions options) => throw null; + + public VersionedClient(Uri endpoint, VersionedClientOptions options) : this(null, endpoint, options) => throw null; [Experimental("SCME0002")] - public VersionedClient(VersionedClientSettings settings) => throw null; + public VersionedClient(VersionedClientSettings settings) : this(AuthenticationPolicy.Create(settings), settings?.Endpoint, settings?.Options) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/special-headers/conditional-request/src/Generated/ConditionalRequestClient.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/special-headers/conditional-request/src/Generated/ConditionalRequestClient.cs index 4b5d78f3e38..cac754cfedb 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/special-headers/conditional-request/src/Generated/ConditionalRequestClient.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/special-headers/conditional-request/src/Generated/ConditionalRequestClient.cs @@ -13,12 +13,14 @@ namespace SpecialHeaders.ConditionalRequest { public partial class ConditionalRequestClient { - public ConditionalRequestClient() => throw null; + public ConditionalRequestClient() : this(new Uri("http://localhost:3000"), new ConditionalRequestClientOptions()) => throw null; - public ConditionalRequestClient(Uri endpoint, ConditionalRequestClientOptions options) => throw null; + internal ConditionalRequestClient(AuthenticationPolicy authenticationPolicy, Uri endpoint, ConditionalRequestClientOptions options) => throw null; + + public ConditionalRequestClient(Uri endpoint, ConditionalRequestClientOptions options) : this(null, endpoint, options) => throw null; [Experimental("SCME0002")] - public ConditionalRequestClient(ConditionalRequestClientSettings settings) => throw null; + public ConditionalRequestClient(ConditionalRequestClientSettings settings) : this(AuthenticationPolicy.Create(settings), settings?.Endpoint, settings?.Options) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/special-headers/repeatability/src/Generated/RepeatabilityClient.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/special-headers/repeatability/src/Generated/RepeatabilityClient.cs index 8dbfdce2d83..cff3310bcef 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/special-headers/repeatability/src/Generated/RepeatabilityClient.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/special-headers/repeatability/src/Generated/RepeatabilityClient.cs @@ -13,12 +13,14 @@ namespace SpecialHeaders.Repeatability { public partial class RepeatabilityClient { - public RepeatabilityClient() => throw null; + public RepeatabilityClient() : this(new Uri("http://localhost:3000"), new RepeatabilityClientOptions()) => throw null; - public RepeatabilityClient(Uri endpoint, RepeatabilityClientOptions options) => throw null; + internal RepeatabilityClient(AuthenticationPolicy authenticationPolicy, Uri endpoint, RepeatabilityClientOptions options) => throw null; + + public RepeatabilityClient(Uri endpoint, RepeatabilityClientOptions options) : this(null, endpoint, options) => throw null; [Experimental("SCME0002")] - public RepeatabilityClient(RepeatabilityClientSettings settings) => throw null; + public RepeatabilityClient(RepeatabilityClientSettings settings) : this(AuthenticationPolicy.Create(settings), settings?.Endpoint, settings?.Options) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/special-words/src/Generated/ModelProperties.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/special-words/src/Generated/ModelProperties.cs index 76f4b999169..145be0ededd 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/special-words/src/Generated/ModelProperties.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/special-words/src/Generated/ModelProperties.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -13,6 +14,8 @@ public partial class ModelProperties { protected ModelProperties() => throw null; + internal ModelProperties(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult SameAsModel(BinaryContent content, RequestOptions options = null) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/special-words/src/Generated/Models.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/special-words/src/Generated/Models.cs index af9e99fa778..ec89fe4d3f7 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/special-words/src/Generated/Models.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/special-words/src/Generated/Models.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -13,6 +14,8 @@ public partial class Models { protected Models() => throw null; + internal Models(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult WithAnd(BinaryContent content, RequestOptions options = null) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/special-words/src/Generated/Operations.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/special-words/src/Generated/Operations.cs index bb367d9e0e7..1dfa7cdcfbe 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/special-words/src/Generated/Operations.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/special-words/src/Generated/Operations.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -13,6 +14,8 @@ public partial class Operations { protected Operations() => throw null; + internal Operations(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult And(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/special-words/src/Generated/Parameters.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/special-words/src/Generated/Parameters.cs index a489749d1a9..fb1b60d7ad1 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/special-words/src/Generated/Parameters.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/special-words/src/Generated/Parameters.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -13,6 +14,8 @@ public partial class Parameters { protected Parameters() => throw null; + internal Parameters(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult WithAnd(string @and, RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/special-words/src/Generated/SpecialWordsClient.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/special-words/src/Generated/SpecialWordsClient.cs index d984f1ee8b4..92dda3fce4e 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/special-words/src/Generated/SpecialWordsClient.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/special-words/src/Generated/SpecialWordsClient.cs @@ -12,12 +12,14 @@ namespace SpecialWords { public partial class SpecialWordsClient { - public SpecialWordsClient() => throw null; + public SpecialWordsClient() : this(new Uri("http://localhost:3000"), new SpecialWordsClientOptions()) => throw null; - public SpecialWordsClient(Uri endpoint, SpecialWordsClientOptions options) => throw null; + internal SpecialWordsClient(AuthenticationPolicy authenticationPolicy, Uri endpoint, SpecialWordsClientOptions options) => throw null; + + public SpecialWordsClient(Uri endpoint, SpecialWordsClientOptions options) : this(null, endpoint, options) => throw null; [Experimental("SCME0002")] - public SpecialWordsClient(SpecialWordsClientSettings settings) => throw null; + public SpecialWordsClient(SpecialWordsClientSettings settings) : this(AuthenticationPolicy.Create(settings), settings?.Endpoint, settings?.Options) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/array/src/Generated/ArrayClient.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/array/src/Generated/ArrayClient.cs index a26f44fb210..1597bfe32fb 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/array/src/Generated/ArrayClient.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/array/src/Generated/ArrayClient.cs @@ -10,12 +10,14 @@ namespace _Type._Array { public partial class ArrayClient { - public ArrayClient() => throw null; + public ArrayClient() : this(new Uri("http://localhost:3000"), new ArrayClientOptions()) => throw null; - public ArrayClient(Uri endpoint, ArrayClientOptions options) => throw null; + internal ArrayClient(AuthenticationPolicy authenticationPolicy, Uri endpoint, ArrayClientOptions options) => throw null; + + public ArrayClient(Uri endpoint, ArrayClientOptions options) : this(null, endpoint, options) => throw null; [Experimental("SCME0002")] - public ArrayClient(ArrayClientSettings settings) => throw null; + public ArrayClient(ArrayClientSettings settings) : this(AuthenticationPolicy.Create(settings), settings?.Endpoint, settings?.Options) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/array/src/Generated/BooleanValue.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/array/src/Generated/BooleanValue.cs index 01b3af52309..d290fed4d03 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/array/src/Generated/BooleanValue.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/array/src/Generated/BooleanValue.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Collections.Generic; @@ -14,6 +15,8 @@ public partial class BooleanValue { protected BooleanValue() => throw null; + internal BooleanValue(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult Get(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/array/src/Generated/DatetimeValue.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/array/src/Generated/DatetimeValue.cs index 720dc85c07b..c7cd4718045 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/array/src/Generated/DatetimeValue.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/array/src/Generated/DatetimeValue.cs @@ -15,6 +15,8 @@ public partial class DatetimeValue { protected DatetimeValue() => throw null; + internal DatetimeValue(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult Get(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/array/src/Generated/DurationValue.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/array/src/Generated/DurationValue.cs index 2b2696da40c..d41e7956ded 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/array/src/Generated/DurationValue.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/array/src/Generated/DurationValue.cs @@ -15,6 +15,8 @@ public partial class DurationValue { protected DurationValue() => throw null; + internal DurationValue(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult Get(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/array/src/Generated/Float32Value.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/array/src/Generated/Float32Value.cs index 56b5ffb2f95..139091b980e 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/array/src/Generated/Float32Value.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/array/src/Generated/Float32Value.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Collections.Generic; @@ -14,6 +15,8 @@ public partial class Float32Value { protected Float32Value() => throw null; + internal Float32Value(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult Get(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/array/src/Generated/Int32Value.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/array/src/Generated/Int32Value.cs index 7babbc0f8f9..b38525f6496 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/array/src/Generated/Int32Value.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/array/src/Generated/Int32Value.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Collections.Generic; @@ -14,6 +15,8 @@ public partial class Int32Value { protected Int32Value() => throw null; + internal Int32Value(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult Get(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/array/src/Generated/Int64Value.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/array/src/Generated/Int64Value.cs index ba6f600bae1..952fb96e4cc 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/array/src/Generated/Int64Value.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/array/src/Generated/Int64Value.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Collections.Generic; @@ -14,6 +15,8 @@ public partial class Int64Value { protected Int64Value() => throw null; + internal Int64Value(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult Get(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/array/src/Generated/ModelValue.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/array/src/Generated/ModelValue.cs index d842b2c8829..333dfabdcff 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/array/src/Generated/ModelValue.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/array/src/Generated/ModelValue.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Collections.Generic; @@ -14,6 +15,8 @@ public partial class ModelValue { protected ModelValue() => throw null; + internal ModelValue(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult Get(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/array/src/Generated/NullableBooleanValue.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/array/src/Generated/NullableBooleanValue.cs index 21c9ed002fe..eb0177c832a 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/array/src/Generated/NullableBooleanValue.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/array/src/Generated/NullableBooleanValue.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Collections.Generic; @@ -14,6 +15,8 @@ public partial class NullableBooleanValue { protected NullableBooleanValue() => throw null; + internal NullableBooleanValue(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult Get(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/array/src/Generated/NullableFloatValue.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/array/src/Generated/NullableFloatValue.cs index dcfe8553721..ab401bf7739 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/array/src/Generated/NullableFloatValue.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/array/src/Generated/NullableFloatValue.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Collections.Generic; @@ -14,6 +15,8 @@ public partial class NullableFloatValue { protected NullableFloatValue() => throw null; + internal NullableFloatValue(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult Get(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/array/src/Generated/NullableInt32Value.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/array/src/Generated/NullableInt32Value.cs index 6aae5a6a603..df168f64ea3 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/array/src/Generated/NullableInt32Value.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/array/src/Generated/NullableInt32Value.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Collections.Generic; @@ -14,6 +15,8 @@ public partial class NullableInt32Value { protected NullableInt32Value() => throw null; + internal NullableInt32Value(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult Get(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/array/src/Generated/NullableModelValue.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/array/src/Generated/NullableModelValue.cs index bb14d5e8e9d..336d4186bd1 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/array/src/Generated/NullableModelValue.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/array/src/Generated/NullableModelValue.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Collections.Generic; @@ -14,6 +15,8 @@ public partial class NullableModelValue { protected NullableModelValue() => throw null; + internal NullableModelValue(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult Get(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/array/src/Generated/NullableStringValue.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/array/src/Generated/NullableStringValue.cs index 490dd4aad6e..f22d0fb8493 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/array/src/Generated/NullableStringValue.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/array/src/Generated/NullableStringValue.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Collections.Generic; @@ -14,6 +15,8 @@ public partial class NullableStringValue { protected NullableStringValue() => throw null; + internal NullableStringValue(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult Get(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/array/src/Generated/StringValue.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/array/src/Generated/StringValue.cs index 7d61138920c..e330fa6ffa4 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/array/src/Generated/StringValue.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/array/src/Generated/StringValue.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Collections.Generic; @@ -14,6 +15,8 @@ public partial class StringValue { protected StringValue() => throw null; + internal StringValue(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult Get(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/array/src/Generated/UnknownValue.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/array/src/Generated/UnknownValue.cs index 0fcbbd28461..a049ca8e8b3 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/array/src/Generated/UnknownValue.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/array/src/Generated/UnknownValue.cs @@ -15,6 +15,8 @@ public partial class UnknownValue { protected UnknownValue() => throw null; + internal UnknownValue(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult Get(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/dictionary/src/Generated/BooleanValue.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/dictionary/src/Generated/BooleanValue.cs index 8e54e093f42..f4727e78b82 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/dictionary/src/Generated/BooleanValue.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/dictionary/src/Generated/BooleanValue.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Collections.Generic; @@ -14,6 +15,8 @@ public partial class BooleanValue { protected BooleanValue() => throw null; + internal BooleanValue(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult Get(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/dictionary/src/Generated/DatetimeValue.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/dictionary/src/Generated/DatetimeValue.cs index 1063eabc942..03241999bc4 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/dictionary/src/Generated/DatetimeValue.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/dictionary/src/Generated/DatetimeValue.cs @@ -15,6 +15,8 @@ public partial class DatetimeValue { protected DatetimeValue() => throw null; + internal DatetimeValue(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult Get(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/dictionary/src/Generated/DictionaryClient.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/dictionary/src/Generated/DictionaryClient.cs index 954c86817af..54d7b564602 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/dictionary/src/Generated/DictionaryClient.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/dictionary/src/Generated/DictionaryClient.cs @@ -10,12 +10,14 @@ namespace _Type.Dictionary { public partial class DictionaryClient { - public DictionaryClient() => throw null; + public DictionaryClient() : this(new Uri("http://localhost:3000"), new DictionaryClientOptions()) => throw null; - public DictionaryClient(Uri endpoint, DictionaryClientOptions options) => throw null; + internal DictionaryClient(AuthenticationPolicy authenticationPolicy, Uri endpoint, DictionaryClientOptions options) => throw null; + + public DictionaryClient(Uri endpoint, DictionaryClientOptions options) : this(null, endpoint, options) => throw null; [Experimental("SCME0002")] - public DictionaryClient(DictionaryClientSettings settings) => throw null; + public DictionaryClient(DictionaryClientSettings settings) : this(AuthenticationPolicy.Create(settings), settings?.Endpoint, settings?.Options) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/dictionary/src/Generated/DurationValue.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/dictionary/src/Generated/DurationValue.cs index 677f6e3c69f..025fb9260d0 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/dictionary/src/Generated/DurationValue.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/dictionary/src/Generated/DurationValue.cs @@ -15,6 +15,8 @@ public partial class DurationValue { protected DurationValue() => throw null; + internal DurationValue(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult Get(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/dictionary/src/Generated/Float32Value.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/dictionary/src/Generated/Float32Value.cs index 89e188a1dfa..bb5152ac021 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/dictionary/src/Generated/Float32Value.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/dictionary/src/Generated/Float32Value.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Collections.Generic; @@ -14,6 +15,8 @@ public partial class Float32Value { protected Float32Value() => throw null; + internal Float32Value(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult Get(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/dictionary/src/Generated/Int32Value.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/dictionary/src/Generated/Int32Value.cs index 1746503b91b..943b687f046 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/dictionary/src/Generated/Int32Value.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/dictionary/src/Generated/Int32Value.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Collections.Generic; @@ -14,6 +15,8 @@ public partial class Int32Value { protected Int32Value() => throw null; + internal Int32Value(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult Get(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/dictionary/src/Generated/Int64Value.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/dictionary/src/Generated/Int64Value.cs index a86d59c62e2..7963141ea14 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/dictionary/src/Generated/Int64Value.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/dictionary/src/Generated/Int64Value.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Collections.Generic; @@ -14,6 +15,8 @@ public partial class Int64Value { protected Int64Value() => throw null; + internal Int64Value(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult Get(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/dictionary/src/Generated/ModelValue.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/dictionary/src/Generated/ModelValue.cs index becd3b219d2..58bd7395fb9 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/dictionary/src/Generated/ModelValue.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/dictionary/src/Generated/ModelValue.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Collections.Generic; @@ -14,6 +15,8 @@ public partial class ModelValue { protected ModelValue() => throw null; + internal ModelValue(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult Get(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/dictionary/src/Generated/NullableFloatValue.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/dictionary/src/Generated/NullableFloatValue.cs index bf6a1626799..b1b16591b20 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/dictionary/src/Generated/NullableFloatValue.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/dictionary/src/Generated/NullableFloatValue.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Collections.Generic; @@ -14,6 +15,8 @@ public partial class NullableFloatValue { protected NullableFloatValue() => throw null; + internal NullableFloatValue(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult Get(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/dictionary/src/Generated/RecursiveModelValue.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/dictionary/src/Generated/RecursiveModelValue.cs index 83cced869b4..eb4eac17013 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/dictionary/src/Generated/RecursiveModelValue.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/dictionary/src/Generated/RecursiveModelValue.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Collections.Generic; @@ -14,6 +15,8 @@ public partial class RecursiveModelValue { protected RecursiveModelValue() => throw null; + internal RecursiveModelValue(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult Get(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/dictionary/src/Generated/StringValue.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/dictionary/src/Generated/StringValue.cs index 66b9650148f..7fe039c683c 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/dictionary/src/Generated/StringValue.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/dictionary/src/Generated/StringValue.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Collections.Generic; @@ -14,6 +15,8 @@ public partial class StringValue { protected StringValue() => throw null; + internal StringValue(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult Get(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/dictionary/src/Generated/UnknownValue.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/dictionary/src/Generated/UnknownValue.cs index 4106f860d0b..f91e8911853 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/dictionary/src/Generated/UnknownValue.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/dictionary/src/Generated/UnknownValue.cs @@ -15,6 +15,8 @@ public partial class UnknownValue { protected UnknownValue() => throw null; + internal UnknownValue(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult Get(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/enum/extensible/src/Generated/ExtensibleClient.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/enum/extensible/src/Generated/ExtensibleClient.cs index de60ac0c773..25a7ff8aa60 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/enum/extensible/src/Generated/ExtensibleClient.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/enum/extensible/src/Generated/ExtensibleClient.cs @@ -10,12 +10,14 @@ namespace _Type._Enum.Extensible { public partial class ExtensibleClient { - public ExtensibleClient() => throw null; + public ExtensibleClient() : this(new Uri("http://localhost:3000"), new ExtensibleClientOptions()) => throw null; - public ExtensibleClient(Uri endpoint, ExtensibleClientOptions options) => throw null; + internal ExtensibleClient(AuthenticationPolicy authenticationPolicy, Uri endpoint, ExtensibleClientOptions options) => throw null; + + public ExtensibleClient(Uri endpoint, ExtensibleClientOptions options) : this(null, endpoint, options) => throw null; [Experimental("SCME0002")] - public ExtensibleClient(ExtensibleClientSettings settings) => throw null; + public ExtensibleClient(ExtensibleClientSettings settings) : this(AuthenticationPolicy.Create(settings), settings?.Endpoint, settings?.Options) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/enum/extensible/src/Generated/String.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/enum/extensible/src/Generated/String.cs index c4aadc25dce..30632b37530 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/enum/extensible/src/Generated/String.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/enum/extensible/src/Generated/String.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -13,6 +14,8 @@ public partial class String { protected String() => throw null; + internal String(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult GetKnownValue(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/enum/fixed/src/Generated/FixedClient.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/enum/fixed/src/Generated/FixedClient.cs index dd46f30d35b..b111aa81947 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/enum/fixed/src/Generated/FixedClient.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/enum/fixed/src/Generated/FixedClient.cs @@ -10,12 +10,14 @@ namespace _Type._Enum.Fixed { public partial class FixedClient { - public FixedClient() => throw null; + public FixedClient() : this(new Uri("http://localhost:3000"), new FixedClientOptions()) => throw null; - public FixedClient(Uri endpoint, FixedClientOptions options) => throw null; + internal FixedClient(AuthenticationPolicy authenticationPolicy, Uri endpoint, FixedClientOptions options) => throw null; + + public FixedClient(Uri endpoint, FixedClientOptions options) : this(null, endpoint, options) => throw null; [Experimental("SCME0002")] - public FixedClient(FixedClientSettings settings) => throw null; + public FixedClient(FixedClientSettings settings) : this(AuthenticationPolicy.Create(settings), settings?.Endpoint, settings?.Options) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/enum/fixed/src/Generated/String.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/enum/fixed/src/Generated/String.cs index 65c6edb1c24..056c892aa72 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/enum/fixed/src/Generated/String.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/enum/fixed/src/Generated/String.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -13,6 +14,8 @@ public partial class String { protected String() => throw null; + internal String(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult GetKnownValue(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/empty/src/Generated/EmptyClient.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/empty/src/Generated/EmptyClient.cs index 3f68d005ac9..00f7325cbd9 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/empty/src/Generated/EmptyClient.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/empty/src/Generated/EmptyClient.cs @@ -13,12 +13,14 @@ namespace _Type.Model.Empty { public partial class EmptyClient { - public EmptyClient() => throw null; + public EmptyClient() : this(new Uri("http://localhost:3000"), new EmptyClientOptions()) => throw null; - public EmptyClient(Uri endpoint, EmptyClientOptions options) => throw null; + internal EmptyClient(AuthenticationPolicy authenticationPolicy, Uri endpoint, EmptyClientOptions options) => throw null; + + public EmptyClient(Uri endpoint, EmptyClientOptions options) : this(null, endpoint, options) => throw null; [Experimental("SCME0002")] - public EmptyClient(EmptyClientSettings settings) => throw null; + public EmptyClient(EmptyClientSettings settings) : this(AuthenticationPolicy.Create(settings), settings?.Endpoint, settings?.Options) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/inheritance/enum-discriminator/src/Generated/EnumDiscriminatorClient.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/inheritance/enum-discriminator/src/Generated/EnumDiscriminatorClient.cs index dd43e92dd04..ca37716df88 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/inheritance/enum-discriminator/src/Generated/EnumDiscriminatorClient.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/inheritance/enum-discriminator/src/Generated/EnumDiscriminatorClient.cs @@ -13,12 +13,14 @@ namespace _Type.Model.Inheritance.EnumDiscriminator { public partial class EnumDiscriminatorClient { - public EnumDiscriminatorClient() => throw null; + public EnumDiscriminatorClient() : this(new Uri("http://localhost:3000"), new EnumDiscriminatorClientOptions()) => throw null; - public EnumDiscriminatorClient(Uri endpoint, EnumDiscriminatorClientOptions options) => throw null; + internal EnumDiscriminatorClient(AuthenticationPolicy authenticationPolicy, Uri endpoint, EnumDiscriminatorClientOptions options) => throw null; + + public EnumDiscriminatorClient(Uri endpoint, EnumDiscriminatorClientOptions options) : this(null, endpoint, options) => throw null; [Experimental("SCME0002")] - public EnumDiscriminatorClient(EnumDiscriminatorClientSettings settings) => throw null; + public EnumDiscriminatorClient(EnumDiscriminatorClientSettings settings) : this(AuthenticationPolicy.Create(settings), settings?.Endpoint, settings?.Options) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/inheritance/nested-discriminator/src/Generated/NestedDiscriminatorClient.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/inheritance/nested-discriminator/src/Generated/NestedDiscriminatorClient.cs index 684d514011f..7e5536731ab 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/inheritance/nested-discriminator/src/Generated/NestedDiscriminatorClient.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/inheritance/nested-discriminator/src/Generated/NestedDiscriminatorClient.cs @@ -13,12 +13,14 @@ namespace _Type.Model.Inheritance.NestedDiscriminator { public partial class NestedDiscriminatorClient { - public NestedDiscriminatorClient() => throw null; + public NestedDiscriminatorClient() : this(new Uri("http://localhost:3000"), new NestedDiscriminatorClientOptions()) => throw null; - public NestedDiscriminatorClient(Uri endpoint, NestedDiscriminatorClientOptions options) => throw null; + internal NestedDiscriminatorClient(AuthenticationPolicy authenticationPolicy, Uri endpoint, NestedDiscriminatorClientOptions options) => throw null; + + public NestedDiscriminatorClient(Uri endpoint, NestedDiscriminatorClientOptions options) : this(null, endpoint, options) => throw null; [Experimental("SCME0002")] - public NestedDiscriminatorClient(NestedDiscriminatorClientSettings settings) => throw null; + public NestedDiscriminatorClient(NestedDiscriminatorClientSettings settings) : this(AuthenticationPolicy.Create(settings), settings?.Endpoint, settings?.Options) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/inheritance/not-discriminated/src/Generated/NotDiscriminatedClient.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/inheritance/not-discriminated/src/Generated/NotDiscriminatedClient.cs index 0bcc1f95dfb..4a7e240071e 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/inheritance/not-discriminated/src/Generated/NotDiscriminatedClient.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/inheritance/not-discriminated/src/Generated/NotDiscriminatedClient.cs @@ -13,12 +13,14 @@ namespace _Type.Model.Inheritance.NotDiscriminated { public partial class NotDiscriminatedClient { - public NotDiscriminatedClient() => throw null; + public NotDiscriminatedClient() : this(new Uri("http://localhost:3000"), new NotDiscriminatedClientOptions()) => throw null; - public NotDiscriminatedClient(Uri endpoint, NotDiscriminatedClientOptions options) => throw null; + internal NotDiscriminatedClient(AuthenticationPolicy authenticationPolicy, Uri endpoint, NotDiscriminatedClientOptions options) => throw null; + + public NotDiscriminatedClient(Uri endpoint, NotDiscriminatedClientOptions options) : this(null, endpoint, options) => throw null; [Experimental("SCME0002")] - public NotDiscriminatedClient(NotDiscriminatedClientSettings settings) => throw null; + public NotDiscriminatedClient(NotDiscriminatedClientSettings settings) : this(AuthenticationPolicy.Create(settings), settings?.Endpoint, settings?.Options) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/inheritance/recursive/src/Generated/RecursiveClient.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/inheritance/recursive/src/Generated/RecursiveClient.cs index 953628d0fd7..1f429a7f058 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/inheritance/recursive/src/Generated/RecursiveClient.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/inheritance/recursive/src/Generated/RecursiveClient.cs @@ -13,12 +13,14 @@ namespace _Type.Model.Inheritance.Recursive { public partial class RecursiveClient { - public RecursiveClient() => throw null; + public RecursiveClient() : this(new Uri("http://localhost:3000"), new RecursiveClientOptions()) => throw null; - public RecursiveClient(Uri endpoint, RecursiveClientOptions options) => throw null; + internal RecursiveClient(AuthenticationPolicy authenticationPolicy, Uri endpoint, RecursiveClientOptions options) => throw null; + + public RecursiveClient(Uri endpoint, RecursiveClientOptions options) : this(null, endpoint, options) => throw null; [Experimental("SCME0002")] - public RecursiveClient(RecursiveClientSettings settings) => throw null; + public RecursiveClient(RecursiveClientSettings settings) : this(AuthenticationPolicy.Create(settings), settings?.Endpoint, settings?.Options) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/inheritance/single-discriminator/src/Generated/SingleDiscriminatorClient.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/inheritance/single-discriminator/src/Generated/SingleDiscriminatorClient.cs index 9a61f48c26c..d6a1a0eb170 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/inheritance/single-discriminator/src/Generated/SingleDiscriminatorClient.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/inheritance/single-discriminator/src/Generated/SingleDiscriminatorClient.cs @@ -13,12 +13,14 @@ namespace _Type.Model.Inheritance.SingleDiscriminator { public partial class SingleDiscriminatorClient { - public SingleDiscriminatorClient() => throw null; + public SingleDiscriminatorClient() : this(new Uri("http://localhost:3000"), new SingleDiscriminatorClientOptions()) => throw null; - public SingleDiscriminatorClient(Uri endpoint, SingleDiscriminatorClientOptions options) => throw null; + internal SingleDiscriminatorClient(AuthenticationPolicy authenticationPolicy, Uri endpoint, SingleDiscriminatorClientOptions options) => throw null; + + public SingleDiscriminatorClient(Uri endpoint, SingleDiscriminatorClientOptions options) : this(null, endpoint, options) => throw null; [Experimental("SCME0002")] - public SingleDiscriminatorClient(SingleDiscriminatorClientSettings settings) => throw null; + public SingleDiscriminatorClient(SingleDiscriminatorClientSettings settings) : this(AuthenticationPolicy.Create(settings), settings?.Endpoint, settings?.Options) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/usage/src/Generated/Internal/Argument.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/usage/src/Generated/Internal/Argument.cs new file mode 100644 index 00000000000..2f3abd47bd9 --- /dev/null +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/usage/src/Generated/Internal/Argument.cs @@ -0,0 +1,110 @@ +// + +#nullable disable + +using System; +using System.Collections; +using System.Collections.Generic; + +namespace _Type.Model.Usage +{ + internal static partial class Argument + { + /// The value. + /// The name. + public static void AssertNotNull(T value, string name) + { + if (value is null) + { + throw new ArgumentNullException(name); + } + } + + /// The value. + /// The name. + public static void AssertNotNull(T? value, string name) + where T : struct + { + if (!value.HasValue) + { + throw new ArgumentNullException(name); + } + } + + /// The value. + /// The name. + public static void AssertNotNullOrEmpty(IEnumerable value, string name) + { + if (value is null) + { + throw new ArgumentNullException(name); + } + if (value is ICollection collectionOfT && collectionOfT.Count == 0) + { + throw new ArgumentException("Value cannot be an empty collection.", name); + } + if (value is ICollection collection && collection.Count == 0) + { + throw new ArgumentException("Value cannot be an empty collection.", name); + } + using IEnumerator e = value.GetEnumerator(); + if (!e.MoveNext()) + { + throw new ArgumentException("Value cannot be an empty collection.", name); + } + } + + /// The value. + /// The name. + public static void AssertNotNullOrEmpty(string value, string name) + { + if (value is null) + { + throw new ArgumentNullException(name); + } + if (value.Length == 0) + { + throw new ArgumentException("Value cannot be an empty string.", name); + } + } + + /// The value. + /// The name. + public static void AssertNotNullOrWhiteSpace(string value, string name) + { + if (value is null) + { + throw new ArgumentNullException(name); + } + if (string.IsNullOrWhiteSpace(value)) + { + throw new ArgumentException("Value cannot be empty or contain only white-space characters.", name); + } + } + + /// The value. + /// The minimum value. + /// The maximum value. + /// The name. + public static void AssertInRange(T value, T minimum, T maximum, string name) + where T : notnull, IComparable + { + if (minimum.CompareTo(value) > 0) + { + throw new ArgumentOutOfRangeException(name, "Value is less than the minimum allowed."); + } + if (maximum.CompareTo(value) < 0) + { + throw new ArgumentOutOfRangeException(name, "Value is greater than the maximum allowed."); + } + } + + /// The value. + /// The name. + public static string CheckNotNullOrEmpty(string value, string name) + { + AssertNotNullOrEmpty(value, name); + return value; + } + } +} diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/usage/src/Generated/Internal/CancellationTokenExtensions.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/usage/src/Generated/Internal/CancellationTokenExtensions.cs new file mode 100644 index 00000000000..8b42fe0a958 --- /dev/null +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/usage/src/Generated/Internal/CancellationTokenExtensions.cs @@ -0,0 +1,14 @@ +// + +#nullable disable + +using System.ClientModel.Primitives; +using System.Threading; + +namespace _Type.Model.Usage +{ + internal static partial class CancellationTokenExtensions + { + public static RequestOptions ToRequestOptions(this CancellationToken cancellationToken) => cancellationToken.CanBeCanceled ? new RequestOptions { CancellationToken = cancellationToken } : null; + } +} diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/usage/src/Generated/Internal/ChangeTrackingDictionary.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/usage/src/Generated/Internal/ChangeTrackingDictionary.cs new file mode 100644 index 00000000000..5480d573b70 --- /dev/null +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/usage/src/Generated/Internal/ChangeTrackingDictionary.cs @@ -0,0 +1,186 @@ +// + +#nullable disable + +using System; +using System.Collections; +using System.Collections.Generic; + +namespace _Type.Model.Usage +{ + internal partial class ChangeTrackingDictionary : IDictionary, IReadOnlyDictionary + where TKey : notnull + { + private IDictionary _innerDictionary; + + public ChangeTrackingDictionary() + { + } + + /// The inner dictionary. + public ChangeTrackingDictionary(IDictionary dictionary) + { + if (dictionary == null) + { + return; + } + _innerDictionary = new Dictionary(dictionary); + } + + /// The inner dictionary. + public ChangeTrackingDictionary(IReadOnlyDictionary dictionary) + { + if (dictionary == null) + { + return; + } + _innerDictionary = new Dictionary(); + foreach (var pair in dictionary) + { + _innerDictionary.Add(pair); + } + } + + /// Gets the IsUndefined. + public bool IsUndefined => _innerDictionary == null; + + /// Gets the Count. + public int Count => IsUndefined ? 0 : EnsureDictionary().Count; + + /// Gets the IsReadOnly. + public bool IsReadOnly => IsUndefined ? false : EnsureDictionary().IsReadOnly; + + /// Gets the Keys. + public ICollection Keys => IsUndefined ? Array.Empty() : EnsureDictionary().Keys; + + /// Gets the Values. + public ICollection Values => IsUndefined ? Array.Empty() : EnsureDictionary().Values; + + /// Gets or sets the value associated with the specified key. + public TValue this[TKey key] + { + get + { + if (IsUndefined) + { + throw new KeyNotFoundException(nameof(key)); + } + return EnsureDictionary()[key]; + } + set + { + EnsureDictionary()[key] = value; + } + } + + /// Gets the Keys. + IEnumerable IReadOnlyDictionary.Keys => Keys; + + /// Gets the Values. + IEnumerable IReadOnlyDictionary.Values => Values; + + public IEnumerator> GetEnumerator() + { + if (IsUndefined) + { + IEnumerator> enumerateEmpty() + { + yield break; + } + return enumerateEmpty(); + } + return EnsureDictionary().GetEnumerator(); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetEnumerator(); + } + + /// The item to add. + public void Add(KeyValuePair item) + { + EnsureDictionary().Add(item); + } + + public void Clear() + { + EnsureDictionary().Clear(); + } + + /// The item to search for. + public bool Contains(KeyValuePair item) + { + if (IsUndefined) + { + return false; + } + return EnsureDictionary().Contains(item); + } + + /// The array to copy. + /// The index. + public void CopyTo(KeyValuePair[] array, int index) + { + if (IsUndefined) + { + return; + } + EnsureDictionary().CopyTo(array, index); + } + + /// The item to remove. + public bool Remove(KeyValuePair item) + { + if (IsUndefined) + { + return false; + } + return EnsureDictionary().Remove(item); + } + + /// The key. + /// The value to add. + public void Add(TKey key, TValue value) + { + EnsureDictionary().Add(key, value); + } + + /// The key to search for. + public bool ContainsKey(TKey key) + { + if (IsUndefined) + { + return false; + } + return EnsureDictionary().ContainsKey(key); + } + + /// The key. + public bool Remove(TKey key) + { + if (IsUndefined) + { + return false; + } + return EnsureDictionary().Remove(key); + } + + /// The key to search for. + /// The value. + public bool TryGetValue(TKey key, out TValue value) + { + if (IsUndefined) + { + value = default; + return false; + } + return EnsureDictionary().TryGetValue(key, out value); + } + + public IDictionary EnsureDictionary() + { + return _innerDictionary ??= new Dictionary(); + } + } +} diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/usage/src/Generated/Internal/ClientPipelineExtensions.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/usage/src/Generated/Internal/ClientPipelineExtensions.cs new file mode 100644 index 00000000000..fdb5a9e7b3c --- /dev/null +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/usage/src/Generated/Internal/ClientPipelineExtensions.cs @@ -0,0 +1,67 @@ +// + +#nullable disable + +using System.ClientModel; +using System.ClientModel.Primitives; +using System.Threading.Tasks; + +namespace _Type.Model.Usage +{ + internal static partial class ClientPipelineExtensions + { + public static async ValueTask ProcessMessageAsync(this ClientPipeline pipeline, PipelineMessage message, RequestOptions options) + { + await pipeline.SendAsync(message).ConfigureAwait(false); + + if (message.Response.IsError && (options?.ErrorOptions & ClientErrorBehaviors.NoThrow) != ClientErrorBehaviors.NoThrow) + { + throw await ClientResultException.CreateAsync(message.Response).ConfigureAwait(false); + } + + PipelineResponse response = message.BufferResponse ? message.Response : message.ExtractResponse(); + return response; + } + + public static PipelineResponse ProcessMessage(this ClientPipeline pipeline, PipelineMessage message, RequestOptions options) + { + pipeline.Send(message); + + if (message.Response.IsError && (options?.ErrorOptions & ClientErrorBehaviors.NoThrow) != ClientErrorBehaviors.NoThrow) + { + throw new ClientResultException(message.Response); + } + + PipelineResponse response = message.BufferResponse ? message.Response : message.ExtractResponse(); + return response; + } + + public static async ValueTask> ProcessHeadAsBoolMessageAsync(this ClientPipeline pipeline, PipelineMessage message, RequestOptions options) + { + PipelineResponse response = await pipeline.ProcessMessageAsync(message, options).ConfigureAwait(false); + switch (response.Status) + { + case >= 200 and < 300: + return ClientResult.FromValue(true, response); + case >= 400 and < 500: + return ClientResult.FromValue(false, response); + default: + return new ErrorResult(response, new ClientResultException(response)); + } + } + + public static ClientResult ProcessHeadAsBoolMessage(this ClientPipeline pipeline, PipelineMessage message, RequestOptions options) + { + PipelineResponse response = pipeline.ProcessMessage(message, options); + switch (response.Status) + { + case >= 200 and < 300: + return ClientResult.FromValue(true, response); + case >= 400 and < 500: + return ClientResult.FromValue(false, response); + default: + return new ErrorResult(response, new ClientResultException(response)); + } + } + } +} diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/usage/src/Generated/Internal/ClientUriBuilder.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/usage/src/Generated/Internal/ClientUriBuilder.cs new file mode 100644 index 00000000000..968cfc1020f --- /dev/null +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/usage/src/Generated/Internal/ClientUriBuilder.cs @@ -0,0 +1,181 @@ +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace _Type.Model.Usage +{ + internal partial class ClientUriBuilder + { + private UriBuilder _uriBuilder; + private StringBuilder _pathAndQuery; + private int _pathLength; + + public ClientUriBuilder() + { + } + + private UriBuilder UriBuilder => _uriBuilder ??= new UriBuilder(); + + private StringBuilder PathAndQuery => _pathAndQuery ??= new StringBuilder(); + + public void Reset(Uri uri) + { + _uriBuilder = new UriBuilder(uri); + PathAndQuery.Clear(); + PathAndQuery.Append(UriBuilder.Path); + _pathLength = PathAndQuery.Length; + PathAndQuery.Append(UriBuilder.Query); + } + + public void AppendPath(string value, bool escape) + { + if (escape) + { + value = Uri.EscapeDataString(value); + } + if (_pathLength > 0 && PathAndQuery[_pathLength - 1] == '/' && value[0] == '/') + { + PathAndQuery.Remove(_pathLength - 1, 1); + _pathLength = _pathLength - 1; + } + PathAndQuery.Insert(_pathLength, value); + _pathLength = _pathLength + value.Length; + } + + public void AppendPath(bool value, bool escape = false) => AppendPath(TypeFormatters.ConvertToString(value), escape); + + public void AppendPath(float value, bool escape = true) => AppendPath(TypeFormatters.ConvertToString(value), escape); + + public void AppendPath(double value, bool escape = true) => AppendPath(TypeFormatters.ConvertToString(value), escape); + + public void AppendPath(int value, bool escape = true) => AppendPath(TypeFormatters.ConvertToString(value), escape); + + public void AppendPath(byte[] value, SerializationFormat format = SerializationFormat.Default, bool escape = true) => AppendPath(TypeFormatters.ConvertToString(value, format), escape); + + public void AppendPath(DateTimeOffset value, SerializationFormat format = SerializationFormat.Default, bool escape = true) => AppendPath(TypeFormatters.ConvertToString(value, format), escape); + + public void AppendPath(TimeSpan value, SerializationFormat format = SerializationFormat.Default, bool escape = true) => AppendPath(TypeFormatters.ConvertToString(value, format), escape); + + public void AppendPath(Guid value, bool escape = true) => AppendPath(TypeFormatters.ConvertToString(value), escape); + + public void AppendPath(long value, bool escape = true) => AppendPath(TypeFormatters.ConvertToString(value), escape); + + public void AppendPathDelimited(IEnumerable value, string delimiter, SerializationFormat format = SerializationFormat.Default, bool escape = true) + { + delimiter ??= ","; + IEnumerable stringValues = value.Select(v => TypeFormatters.ConvertToString(v, format)); + AppendPath(string.Join(delimiter, stringValues), escape); + } + + public void AppendQuery(string name, string value, bool escape) + { + if (PathAndQuery.Length == _pathLength) + { + PathAndQuery.Append('?'); + } + if (PathAndQuery.Length > _pathLength && PathAndQuery[PathAndQuery.Length - 1] != '?') + { + PathAndQuery.Append('&'); + } + if (escape) + { + value = Uri.EscapeDataString(value); + } + PathAndQuery.Append(name); + PathAndQuery.Append('='); + PathAndQuery.Append(value); + } + + public void AppendQuery(string name, bool value, bool escape = false) => AppendQuery(name, TypeFormatters.ConvertToString(value), escape); + + public void AppendQuery(string name, float value, bool escape = true) => AppendQuery(name, TypeFormatters.ConvertToString(value), escape); + + public void AppendQuery(string name, DateTimeOffset value, SerializationFormat format = SerializationFormat.Default, bool escape = true) => AppendQuery(name, TypeFormatters.ConvertToString(value, format), escape); + + public void AppendQuery(string name, TimeSpan value, SerializationFormat format = SerializationFormat.Default, bool escape = true) => AppendQuery(name, TypeFormatters.ConvertToString(value, format), escape); + + public void AppendQuery(string name, double value, bool escape = true) => AppendQuery(name, TypeFormatters.ConvertToString(value), escape); + + public void AppendQuery(string name, decimal value, bool escape = true) => AppendQuery(name, TypeFormatters.ConvertToString(value), escape); + + public void AppendQuery(string name, int value, bool escape = true) => AppendQuery(name, TypeFormatters.ConvertToString(value), escape); + + public void AppendQuery(string name, long value, bool escape = true) => AppendQuery(name, TypeFormatters.ConvertToString(value), escape); + + public void AppendQuery(string name, TimeSpan value, bool escape = true) => AppendQuery(name, TypeFormatters.ConvertToString(value), escape); + + public void AppendQuery(string name, byte[] value, SerializationFormat format = SerializationFormat.Default, bool escape = true) => AppendQuery(name, TypeFormatters.ConvertToString(value, format), escape); + + public void AppendQuery(string name, Guid value, bool escape = true) => AppendQuery(name, TypeFormatters.ConvertToString(value), escape); + + public void AppendQueryDelimited(string name, IEnumerable value, string delimiter, SerializationFormat format = SerializationFormat.Default, bool escape = true) + { + delimiter ??= ","; + IEnumerable stringValues = value.Select(v => TypeFormatters.ConvertToString(v, format)); + AppendQuery(name, string.Join(delimiter, stringValues), escape); + } + + public void UpdateQuery(string name, string value) + { + if (PathAndQuery.Length == _pathLength) + { + AppendQuery(name, value, false); + } + else + { + int queryStartIndex = _pathLength + 1; + string searchPattern = name + "="; + string queryString = PathAndQuery.ToString(queryStartIndex, PathAndQuery.Length - queryStartIndex); + int paramStartIndex = -1; + if (queryString.StartsWith(searchPattern)) + { + paramStartIndex = 0; + } + if (paramStartIndex == -1) + { + int prefixedIndex = queryString.IndexOf("&" + searchPattern); + if (prefixedIndex >= 0) + { + paramStartIndex = prefixedIndex + 1; + } + } + if (paramStartIndex >= 0) + { + int valueStartIndex = paramStartIndex + searchPattern.Length; + int valueEndIndex = queryString.IndexOf('&', valueStartIndex); + if (valueEndIndex == -1) + { + valueEndIndex = queryString.Length; + } + int globalStart = queryStartIndex + valueStartIndex; + int globalEnd = queryStartIndex + valueEndIndex; + PathAndQuery.Remove(globalStart, globalEnd - globalStart); + PathAndQuery.Insert(globalStart, value); + } + else + { + AppendQuery(name, value, false); + } + } + } + + public Uri ToUri() + { + UriBuilder.Path = PathAndQuery.ToString(0, _pathLength); + if (PathAndQuery.Length > _pathLength) + { + UriBuilder.Query = PathAndQuery.ToString(_pathLength + 1, PathAndQuery.Length - _pathLength - 1); + } + if (PathAndQuery.Length == _pathLength) + { + UriBuilder.Query = ""; + } + return UriBuilder.Uri; + } + } +} diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/usage/src/Generated/Internal/CodeGenMemberAttribute.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/usage/src/Generated/Internal/CodeGenMemberAttribute.cs new file mode 100644 index 00000000000..044dfe314c5 --- /dev/null +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/usage/src/Generated/Internal/CodeGenMemberAttribute.cs @@ -0,0 +1,17 @@ +// + +#nullable disable + +using System; + +namespace Microsoft.TypeSpec.Generator.Customizations +{ + [AttributeUsage((AttributeTargets.Property | AttributeTargets.Field))] + internal partial class CodeGenMemberAttribute : CodeGenTypeAttribute + { + /// The original name of the member. + public CodeGenMemberAttribute(string originalName) : base(originalName) + { + } + } +} diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/usage/src/Generated/Internal/CodeGenSerializationAttribute.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/usage/src/Generated/Internal/CodeGenSerializationAttribute.cs new file mode 100644 index 00000000000..aedb8b359b8 --- /dev/null +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/usage/src/Generated/Internal/CodeGenSerializationAttribute.cs @@ -0,0 +1,45 @@ +// + +#nullable disable + +using System; + +namespace Microsoft.TypeSpec.Generator.Customizations +{ + [AttributeUsage((AttributeTargets.Class | AttributeTargets.Struct), AllowMultiple = true, Inherited = true)] + internal partial class CodeGenSerializationAttribute : Attribute + { + /// The property name which these hooks apply to. + public CodeGenSerializationAttribute(string propertyName) + { + PropertyName = propertyName; + } + + /// The property name which these hooks apply to. + /// The serialization name of the property. + public CodeGenSerializationAttribute(string propertyName, string serializationName) + { + PropertyName = propertyName; + SerializationName = serializationName; + } + + /// Gets or sets the property name which these hooks should apply to. + public string PropertyName { get; } + + /// Gets or sets the serialization name of the property. + public string SerializationName { get; set; } + + /// + /// Gets or sets the method name to use when serializing the property value (property name excluded). + /// The signature of the serialization hook method must be or compatible with when invoking: private void SerializeHook(Utf8JsonWriter writer); + /// + public string SerializationValueHook { get; set; } + + /// + /// Gets or sets the method name to use when deserializing the property value from the JSON. + /// private static void DeserializationHook(JsonProperty property, ref TypeOfTheProperty propertyValue); // if the property is required + /// private static void DeserializationHook(JsonProperty property, ref Optional<TypeOfTheProperty> propertyValue); // if the property is optional + /// + public string DeserializationValueHook { get; set; } + } +} diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/usage/src/Generated/Internal/CodeGenSuppressAttribute.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/usage/src/Generated/Internal/CodeGenSuppressAttribute.cs new file mode 100644 index 00000000000..601ded913ab --- /dev/null +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/usage/src/Generated/Internal/CodeGenSuppressAttribute.cs @@ -0,0 +1,26 @@ +// + +#nullable disable + +using System; + +namespace Microsoft.TypeSpec.Generator.Customizations +{ + [AttributeUsage((AttributeTargets.Class | AttributeTargets.Enum | AttributeTargets.Struct), AllowMultiple = true)] + internal partial class CodeGenSuppressAttribute : Attribute + { + /// The member to suppress. + /// The types of the parameters of the member. + public CodeGenSuppressAttribute(string member, params Type[] parameters) + { + Member = member; + Parameters = parameters; + } + + /// Gets the Member. + public string Member { get; } + + /// Gets the Parameters. + public Type[] Parameters { get; } + } +} diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/usage/src/Generated/Internal/CodeGenTypeAttribute.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/usage/src/Generated/Internal/CodeGenTypeAttribute.cs new file mode 100644 index 00000000000..d7b56bdccdf --- /dev/null +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/usage/src/Generated/Internal/CodeGenTypeAttribute.cs @@ -0,0 +1,21 @@ +// + +#nullable disable + +using System; + +namespace Microsoft.TypeSpec.Generator.Customizations +{ + [AttributeUsage((AttributeTargets.Class | AttributeTargets.Enum | AttributeTargets.Struct))] + internal partial class CodeGenTypeAttribute : Attribute + { + /// The original name of the type. + public CodeGenTypeAttribute(string originalName) + { + OriginalName = originalName; + } + + /// Gets the OriginalName. + public string OriginalName { get; } + } +} diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/usage/src/Generated/Internal/ErrorResult.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/usage/src/Generated/Internal/ErrorResult.cs new file mode 100644 index 00000000000..92d71fb1f24 --- /dev/null +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/usage/src/Generated/Internal/ErrorResult.cs @@ -0,0 +1,24 @@ +// + +#nullable disable + +using System.ClientModel; +using System.ClientModel.Primitives; + +namespace _Type.Model.Usage +{ + internal partial class ErrorResult : ClientResult + { + private readonly PipelineResponse _response; + private readonly ClientResultException _exception; + + public ErrorResult(PipelineResponse response, ClientResultException exception) : base(default, response) + { + _response = response; + _exception = exception; + } + + /// Gets the Value. + public override T Value => throw _exception; + } +} diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/usage/src/Generated/Internal/ModelSerializationExtensions.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/usage/src/Generated/Internal/ModelSerializationExtensions.cs new file mode 100644 index 00000000000..aa9e0733a67 --- /dev/null +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/usage/src/Generated/Internal/ModelSerializationExtensions.cs @@ -0,0 +1,265 @@ +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Diagnostics; +using System.Globalization; +using System.Runtime.InteropServices; +using System.Text.Json; + +namespace _Type.Model.Usage +{ + internal static partial class ModelSerializationExtensions + { + internal static readonly ModelReaderWriterOptions WireOptions = new ModelReaderWriterOptions("W"); + internal static readonly JsonDocumentOptions JsonDocumentOptions = new JsonDocumentOptions + { + MaxDepth = 256 + }; + + public static object GetObject(this JsonElement element) + { + switch (element.ValueKind) + { + case JsonValueKind.String: + return element.GetString(); + case JsonValueKind.Number: + if (element.TryGetInt32(out int intValue)) + { + return intValue; + } + if (element.TryGetInt64(out long longValue)) + { + return longValue; + } + return element.GetDouble(); + case JsonValueKind.True: + return true; + case JsonValueKind.False: + return false; + case JsonValueKind.Undefined: + case JsonValueKind.Null: + return null; + case JsonValueKind.Object: + Dictionary dictionary = new Dictionary(); + foreach (var jsonProperty in element.EnumerateObject()) + { + dictionary.Add(jsonProperty.Name, jsonProperty.Value.GetObject()); + } + return dictionary; + case JsonValueKind.Array: + List list = new List(); + foreach (var item in element.EnumerateArray()) + { + list.Add(item.GetObject()); + } + return list.ToArray(); + default: + throw new NotSupportedException($"Not supported value kind {element.ValueKind}"); + } + } + + public static byte[] GetBytesFromBase64(this JsonElement element, string format) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + + return format switch + { + "U" => TypeFormatters.FromBase64UrlString(element.GetRequiredString()), + "D" => element.GetBytesFromBase64(), + _ => throw new ArgumentException($"Format is not supported: '{format}'", nameof(format)) + }; + } + + public static DateTimeOffset GetDateTimeOffset(this JsonElement element, string format) => format switch + { + "U" when element.ValueKind == JsonValueKind.Number => DateTimeOffset.FromUnixTimeSeconds(element.GetInt64()), + _ => TypeFormatters.ParseDateTimeOffset(element.GetString(), format) + }; + + public static TimeSpan GetTimeSpan(this JsonElement element, string format) => TypeFormatters.ParseTimeSpan(element.GetString(), format); + + public static char GetChar(this JsonElement element) + { + if (element.ValueKind == JsonValueKind.String) + { + string text = element.GetString(); + if (text == null || text.Length != 1) + { + throw new NotSupportedException($"Cannot convert \"{text}\" to a char"); + } + return text[0]; + } + else + { + throw new NotSupportedException($"Cannot convert {element.ValueKind} to a char"); + } + } + + [Conditional("DEBUG")] + public static void ThrowNonNullablePropertyIsNull(this JsonProperty @property) + { + throw new JsonException($"A property '{@property.Name}' defined as non-nullable but received as null from the service. This exception only happens in DEBUG builds of the library and would be ignored in the release build"); + } + + public static string GetRequiredString(this JsonElement element) + { + string value = element.GetString(); + if (value == null) + { + throw new InvalidOperationException($"The requested operation requires an element of type 'String', but the target element has type '{element.ValueKind}'."); + } + return value; + } + + public static void WriteStringValue(this Utf8JsonWriter writer, DateTimeOffset value, string format) + { + writer.WriteStringValue(TypeFormatters.ToString(value, format)); + } + + public static void WriteStringValue(this Utf8JsonWriter writer, DateTime value, string format) + { + writer.WriteStringValue(TypeFormatters.ToString(value, format)); + } + + public static void WriteStringValue(this Utf8JsonWriter writer, TimeSpan value, string format) + { + writer.WriteStringValue(TypeFormatters.ToString(value, format)); + } + + public static void WriteStringValue(this Utf8JsonWriter writer, char value) + { + writer.WriteStringValue(value.ToString(CultureInfo.InvariantCulture)); + } + + public static void WriteBase64StringValue(this Utf8JsonWriter writer, byte[] value, string format) + { + if (value == null) + { + writer.WriteNullValue(); + return; + } + switch (format) + { + case "U": + writer.WriteStringValue(TypeFormatters.ToBase64UrlString(value)); + break; + case "D": + writer.WriteBase64StringValue(value); + break; + default: + throw new ArgumentException($"Format is not supported: '{format}'", nameof(format)); + } + } + + public static void WriteNumberValue(this Utf8JsonWriter writer, DateTimeOffset value, string format) + { + if (format != "U") + { + throw new ArgumentOutOfRangeException(nameof(format), "Only 'U' format is supported when writing a DateTimeOffset as a Number."); + } + writer.WriteNumberValue(value.ToUnixTimeSeconds()); + } + + public static void WriteObjectValue(this Utf8JsonWriter writer, T value, ModelReaderWriterOptions options = null) + { + switch (value) + { + case null: + writer.WriteNullValue(); + break; + case IJsonModel jsonModel: + jsonModel.Write(writer, options ?? WireOptions); + break; + case byte[] bytes: + writer.WriteBase64StringValue(bytes); + break; + case BinaryData bytes0: + writer.WriteBase64StringValue(bytes0); + break; + case JsonElement json: + json.WriteTo(writer); + break; + case int i: + writer.WriteNumberValue(i); + break; + case decimal d: + writer.WriteNumberValue(d); + break; + case double d0: + if (double.IsNaN(d0)) + { + writer.WriteStringValue("NaN"); + } + else + { + writer.WriteNumberValue(d0); + } + break; + case float f: + writer.WriteNumberValue(f); + break; + case long l: + writer.WriteNumberValue(l); + break; + case string s: + writer.WriteStringValue(s); + break; + case bool b: + writer.WriteBooleanValue(b); + break; + case Guid g: + writer.WriteStringValue(g); + break; + case DateTimeOffset dateTimeOffset: + writer.WriteStringValue(dateTimeOffset, "O"); + break; + case DateTime dateTime: + writer.WriteStringValue(dateTime, "O"); + break; + case IEnumerable> enumerable: + writer.WriteStartObject(); + foreach (var pair in enumerable) + { + writer.WritePropertyName(pair.Key); + writer.WriteObjectValue(pair.Value, options); + } + writer.WriteEndObject(); + break; + case IEnumerable objectEnumerable: + writer.WriteStartArray(); + foreach (var item in objectEnumerable) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + break; + case TimeSpan timeSpan: + writer.WriteStringValue(timeSpan, "P"); + break; + default: + throw new NotSupportedException($"Not supported type {value.GetType()}"); + } + } + + public static void WriteObjectValue(this Utf8JsonWriter writer, object value, ModelReaderWriterOptions options = null) + { + writer.WriteObjectValue(value, options); + } + + public static BinaryData GetUtf8Bytes(this JsonElement element) + { +#if NET9_0_OR_GREATER + return new global::System.BinaryData(global::System.Runtime.InteropServices.JsonMarshal.GetRawUtf8Value(element).ToArray()); +#else + return BinaryData.FromString(element.GetRawText()); +#endif + } + } +} diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/usage/src/Generated/Internal/SerializationFormat.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/usage/src/Generated/Internal/SerializationFormat.cs new file mode 100644 index 00000000000..40afda08aba --- /dev/null +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/usage/src/Generated/Internal/SerializationFormat.cs @@ -0,0 +1,46 @@ +// + +#nullable disable + +namespace _Type.Model.Usage +{ + internal enum SerializationFormat + { + /// The default serialization format. + Default = 0, + /// The RFC1123 date time format. + DateTime_RFC1123 = 1, + /// The RFC3339 date time format. + DateTime_RFC3339 = 2, + /// The RFC7231 date time format. + DateTime_RFC7231 = 3, + /// The ISO8601 date time format. + DateTime_ISO8601 = 4, + /// The Unix date time format. + DateTime_Unix = 5, + /// The ISO8601 date format. + Date_ISO8601 = 6, + /// The ISO8601 duration format. + Duration_ISO8601 = 7, + /// The constant duration format. + Duration_Constant = 8, + /// The seconds duration format. + Duration_Seconds = 9, + /// The seconds duration format with float precision. + Duration_Seconds_Float = 10, + /// The seconds duration format with double precision. + Duration_Seconds_Double = 11, + /// The milliseconds duration format. + Duration_Milliseconds = 12, + /// The milliseconds duration format with float precision. + Duration_Milliseconds_Float = 13, + /// The milliseconds duration format with double precision. + Duration_Milliseconds_Double = 14, + /// The ISO8601 time format. + Time_ISO8601 = 15, + /// The Base64Url bytes format. + Bytes_Base64Url = 16, + /// The Base64 bytes format. + Bytes_Base64 = 17 + } +} diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/usage/src/Generated/Internal/TypeFormatters.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/usage/src/Generated/Internal/TypeFormatters.cs new file mode 100644 index 00000000000..8dbbc318772 --- /dev/null +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/usage/src/Generated/Internal/TypeFormatters.cs @@ -0,0 +1,178 @@ +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Globalization; +using System.Xml; + +namespace _Type.Model.Usage +{ + internal static partial class TypeFormatters + { + private const string RoundtripZFormat = "yyyy-MM-ddTHH:mm:ss.fffffffZ"; + public const string DefaultNumberFormat = "G"; + + public static string ToString(bool value) => value ? "true" : "false"; + + public static string ToString(DateTime value, string format) => value.Kind switch + { + DateTimeKind.Utc => ToString((DateTimeOffset)value, format), + _ => throw new NotSupportedException($"DateTime {value} has a Kind of {value.Kind}. Generated clients require it to be UTC. You can call DateTime.SpecifyKind to change Kind property value to DateTimeKind.Utc.") + }; + + public static string ToString(DateTimeOffset value, string format) => format switch + { + "D" => value.ToString("yyyy-MM-dd", CultureInfo.InvariantCulture), + "U" => value.ToUnixTimeSeconds().ToString(CultureInfo.InvariantCulture), + "O" => value.ToUniversalTime().ToString(RoundtripZFormat, CultureInfo.InvariantCulture), + "o" => value.ToUniversalTime().ToString(RoundtripZFormat, CultureInfo.InvariantCulture), + "R" => value.ToString("r", CultureInfo.InvariantCulture), + _ => value.ToString(format, CultureInfo.InvariantCulture) + }; + + public static string ToString(TimeSpan value, string format) => format switch + { + "P" => XmlConvert.ToString(value), + _ => value.ToString(format, CultureInfo.InvariantCulture) + }; + + public static string ToString(byte[] value, string format) => format switch + { + "U" => ToBase64UrlString(value), + "D" => Convert.ToBase64String(value), + _ => throw new ArgumentException($"Format is not supported: '{format}'", nameof(format)) + }; + + public static string ToBase64UrlString(byte[] value) + { + int numWholeOrPartialInputBlocks = checked (value.Length + 2) / 3; + int size = checked (numWholeOrPartialInputBlocks * 4); + char[] output = new char[size]; + + int numBase64Chars = Convert.ToBase64CharArray(value, 0, value.Length, output, 0); + + int i = 0; + for (; i < numBase64Chars; i++) + { + char ch = output[i]; + if (ch == '+') + { + output[i] = '-'; + } + else + { + if (ch == '/') + { + output[i] = '_'; + } + else + { + if (ch == '=') + { + break; + } + } + } + } + + return new string(output, 0, i); + } + + public static byte[] FromBase64UrlString(string value) + { + int paddingCharsToAdd = (value.Length % 4) switch + { + 0 => 0, + 2 => 2, + 3 => 1, + _ => throw new InvalidOperationException("Malformed input") + }; + char[] output = new char[(value.Length + paddingCharsToAdd)]; + int i = 0; + for (; i < value.Length; i++) + { + char ch = value[i]; + if (ch == '-') + { + output[i] = '+'; + } + else + { + if (ch == '_') + { + output[i] = '/'; + } + else + { + output[i] = ch; + } + } + } + + for (; i < output.Length; i++) + { + output[i] = '='; + } + + return Convert.FromBase64CharArray(output, 0, output.Length); + } + + public static DateTimeOffset ParseDateTimeOffset(string value, string format) => format switch + { + "U" => DateTimeOffset.FromUnixTimeSeconds(long.Parse(value, CultureInfo.InvariantCulture)), + _ => DateTimeOffset.Parse(value, CultureInfo.InvariantCulture, DateTimeStyles.AssumeUniversal) + }; + + public static TimeSpan ParseTimeSpan(string value, string format) => format switch + { + "P" => XmlConvert.ToTimeSpan(value), + _ => TimeSpan.ParseExact(value, format, CultureInfo.InvariantCulture) + }; + + public static string ToFormatSpecifier(SerializationFormat format) => format switch + { + SerializationFormat.DateTime_RFC1123 => "R", + SerializationFormat.DateTime_RFC3339 => "O", + SerializationFormat.DateTime_RFC7231 => "R", + SerializationFormat.DateTime_ISO8601 => "O", + SerializationFormat.Date_ISO8601 => "D", + SerializationFormat.DateTime_Unix => "U", + SerializationFormat.Bytes_Base64Url => "U", + SerializationFormat.Bytes_Base64 => "D", + SerializationFormat.Duration_ISO8601 => "P", + SerializationFormat.Duration_Constant => "c", + SerializationFormat.Duration_Seconds => "%s", + SerializationFormat.Duration_Seconds_Float => "s\\.FFF", + SerializationFormat.Duration_Seconds_Double => "s\\.FFFFFF", + SerializationFormat.Time_ISO8601 => "T", + _ => null + }; + + public static string ConvertToString(object value, SerializationFormat format = SerializationFormat.Default) + { + string formatSpecifier = ToFormatSpecifier(format); + + return value switch + { + null => "null", + string s => s, + bool b => ToString(b), + int or float or double or long or decimal => ((IFormattable)value).ToString(DefaultNumberFormat, CultureInfo.InvariantCulture), + byte[] b0 when formatSpecifier != null => ToString(b0, formatSpecifier), + IEnumerable s0 => string.Join(",", s0), + DateTimeOffset dateTime when formatSpecifier != null => ToString(dateTime, formatSpecifier), + TimeSpan timeSpan when format == SerializationFormat.Duration_Seconds => Convert.ToInt32(timeSpan.TotalSeconds).ToString(CultureInfo.InvariantCulture), + TimeSpan timeSpan0 when format == SerializationFormat.Duration_Seconds_Float || format == SerializationFormat.Duration_Seconds_Double => timeSpan0.TotalSeconds.ToString(CultureInfo.InvariantCulture), + TimeSpan timeSpan1 when format == SerializationFormat.Duration_Milliseconds => Convert.ToInt32(timeSpan1.TotalMilliseconds).ToString(CultureInfo.InvariantCulture), + TimeSpan timeSpan2 when format == SerializationFormat.Duration_Milliseconds_Float || format == SerializationFormat.Duration_Milliseconds_Double => timeSpan2.TotalMilliseconds.ToString(CultureInfo.InvariantCulture), + TimeSpan timeSpan3 when formatSpecifier != null => ToString(timeSpan3, formatSpecifier), + TimeSpan timeSpan4 => XmlConvert.ToString(timeSpan4), + Guid guid => guid.ToString(), + BinaryData binaryData => ConvertToString(binaryData.ToArray(), format), + _ => value.ToString() + }; + } + } +} diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/usage/src/Generated/Models/InputOutputRecord.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/usage/src/Generated/Models/InputOutputRecord.Serialization.cs index f6736632d78..eab0dbb0e8d 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/usage/src/Generated/Models/InputOutputRecord.Serialization.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/usage/src/Generated/Models/InputOutputRecord.Serialization.cs @@ -5,34 +5,154 @@ using System; using System.ClientModel; using System.ClientModel.Primitives; +using System.Collections.Generic; using System.Text.Json; namespace _Type.Model.Usage { + /// Record used both as operation parameter and return type. public partial class InputOutputRecord : IJsonModel { - internal InputOutputRecord() => throw null; + /// Initializes a new instance of for deserialization. + internal InputOutputRecord() + { + } - protected virtual InputOutputRecord PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; + /// The data to parse. + /// The client options for reading and writing models. + protected virtual InputOutputRecord PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + using (JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions)) + { + return DeserializeInputOutputRecord(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(InputOutputRecord)} does not support reading '{options.Format}' format."); + } + } - protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) => throw null; + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, _TypeModelUsageContext.Default); + default: + throw new FormatException($"The model {nameof(InputOutputRecord)} does not support writing '{options.Format}' format."); + } + } - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => throw null; + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); - InputOutputRecord IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => throw null; + /// The data to parse. + /// The client options for reading and writing models. + InputOutputRecord IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => throw null; + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - public static implicit operator BinaryContent(InputOutputRecord inputOutputRecord) => throw null; + /// The to serialize into . + public static implicit operator BinaryContent(InputOutputRecord inputOutputRecord) + { + if (inputOutputRecord == null) + { + return null; + } + return BinaryContent.Create(inputOutputRecord, ModelSerializationExtensions.WireOptions); + } - public static explicit operator InputOutputRecord(ClientResult result) => throw null; + /// The to deserialize the from. + public static explicit operator InputOutputRecord(ClientResult result) + { + PipelineResponse response = result.GetRawResponse(); + using JsonDocument document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeInputOutputRecord(document.RootElement, ModelSerializationExtensions.WireOptions); + } - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; + /// The JSON writer. + /// The client options for reading and writing models. + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } - protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(InputOutputRecord)} does not support writing '{format}' format."); + } + writer.WritePropertyName("requiredProp"u8); + writer.WriteStringValue(RequiredProp); + if (options.Format != "W" && _additionalBinaryDataProperties != null) + { + foreach (var item in _additionalBinaryDataProperties) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } - InputOutputRecord IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => throw null; + /// The JSON reader. + /// The client options for reading and writing models. + InputOutputRecord IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); - protected virtual InputOutputRecord JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => throw null; + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual InputOutputRecord JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(InputOutputRecord)} does not support reading '{format}' format."); + } + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeInputOutputRecord(document.RootElement, options); + } + + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static InputOutputRecord DeserializeInputOutputRecord(JsonElement element, ModelReaderWriterOptions options) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string requiredProp = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) + { + if (prop.NameEquals("requiredProp"u8)) + { + requiredProp = prop.Value.GetString(); + continue; + } + if (options.Format != "W") + { + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); + } + } + return new InputOutputRecord(requiredProp, additionalBinaryDataProperties); + } } } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/usage/src/Generated/Models/InputOutputRecord.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/usage/src/Generated/Models/InputOutputRecord.cs index 1aac054f001..26525fd4f43 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/usage/src/Generated/Models/InputOutputRecord.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/usage/src/Generated/Models/InputOutputRecord.cs @@ -2,16 +2,37 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace _Type.Model.Usage { + /// Record used both as operation parameter and return type. public partial class InputOutputRecord { - public InputOutputRecord(string requiredProp) => throw null; + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; + + /// Initializes a new instance of . + /// + /// is null. + public InputOutputRecord(string requiredProp) + { + Argument.AssertNotNull(requiredProp, nameof(requiredProp)); - public string RequiredProp + RequiredProp = requiredProp; + } + + /// Initializes a new instance of . + /// + /// Keeps track of any properties unknown to the library. + internal InputOutputRecord(string requiredProp, IDictionary additionalBinaryDataProperties) { - get => throw null; - set => throw null; + RequiredProp = requiredProp; + _additionalBinaryDataProperties = additionalBinaryDataProperties; } + + /// Gets or sets the RequiredProp. + public string RequiredProp { get; set; } } } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/usage/src/Generated/Models/InputRecord.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/usage/src/Generated/Models/InputRecord.Serialization.cs index 0f4cc4dbb5d..c1199136a38 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/usage/src/Generated/Models/InputRecord.Serialization.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/usage/src/Generated/Models/InputRecord.Serialization.cs @@ -5,32 +5,146 @@ using System; using System.ClientModel; using System.ClientModel.Primitives; +using System.Collections.Generic; using System.Text.Json; namespace _Type.Model.Usage { + /// Record used in operation parameters. public partial class InputRecord : IJsonModel { - internal InputRecord() => throw null; + /// Initializes a new instance of for deserialization. + internal InputRecord() + { + } - protected virtual InputRecord PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; + /// The data to parse. + /// The client options for reading and writing models. + protected virtual InputRecord PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + using (JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions)) + { + return DeserializeInputRecord(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(InputRecord)} does not support reading '{options.Format}' format."); + } + } - protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) => throw null; + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, _TypeModelUsageContext.Default); + default: + throw new FormatException($"The model {nameof(InputRecord)} does not support writing '{options.Format}' format."); + } + } - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => throw null; + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); - InputRecord IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => throw null; + /// The data to parse. + /// The client options for reading and writing models. + InputRecord IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => throw null; + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - public static implicit operator BinaryContent(InputRecord inputRecord) => throw null; + /// The to serialize into . + public static implicit operator BinaryContent(InputRecord inputRecord) + { + if (inputRecord == null) + { + return null; + } + return BinaryContent.Create(inputRecord, ModelSerializationExtensions.WireOptions); + } - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; + /// The JSON writer. + /// The client options for reading and writing models. + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } - protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(InputRecord)} does not support writing '{format}' format."); + } + writer.WritePropertyName("requiredProp"u8); + writer.WriteStringValue(RequiredProp); + if (options.Format != "W" && _additionalBinaryDataProperties != null) + { + foreach (var item in _additionalBinaryDataProperties) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } - InputRecord IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => throw null; + /// The JSON reader. + /// The client options for reading and writing models. + InputRecord IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); - protected virtual InputRecord JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => throw null; + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual InputRecord JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(InputRecord)} does not support reading '{format}' format."); + } + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeInputRecord(document.RootElement, options); + } + + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static InputRecord DeserializeInputRecord(JsonElement element, ModelReaderWriterOptions options) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string requiredProp = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) + { + if (prop.NameEquals("requiredProp"u8)) + { + requiredProp = prop.Value.GetString(); + continue; + } + if (options.Format != "W") + { + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); + } + } + return new InputRecord(requiredProp, additionalBinaryDataProperties); + } } } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/usage/src/Generated/Models/InputRecord.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/usage/src/Generated/Models/InputRecord.cs index aa1c9d6cd43..9ecd0bcc369 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/usage/src/Generated/Models/InputRecord.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/usage/src/Generated/Models/InputRecord.cs @@ -2,12 +2,37 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace _Type.Model.Usage { + /// Record used in operation parameters. public partial class InputRecord { - public InputRecord(string requiredProp) => throw null; + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; + + /// Initializes a new instance of . + /// + /// is null. + public InputRecord(string requiredProp) + { + Argument.AssertNotNull(requiredProp, nameof(requiredProp)); + + RequiredProp = requiredProp; + } + + /// Initializes a new instance of . + /// + /// Keeps track of any properties unknown to the library. + internal InputRecord(string requiredProp, IDictionary additionalBinaryDataProperties) + { + RequiredProp = requiredProp; + _additionalBinaryDataProperties = additionalBinaryDataProperties; + } - public string RequiredProp => throw null; + /// Gets the RequiredProp. + public string RequiredProp { get; } } } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/usage/src/Generated/Models/OutputRecord.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/usage/src/Generated/Models/OutputRecord.Serialization.cs index 5e02f50a12b..d4b14ef28d3 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/usage/src/Generated/Models/OutputRecord.Serialization.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/usage/src/Generated/Models/OutputRecord.Serialization.cs @@ -5,32 +5,144 @@ using System; using System.ClientModel; using System.ClientModel.Primitives; +using System.Collections.Generic; using System.Text.Json; namespace _Type.Model.Usage { + /// Record used in operation return type. public partial class OutputRecord : IJsonModel { - internal OutputRecord() => throw null; + /// Initializes a new instance of for deserialization. + internal OutputRecord() + { + } - protected virtual OutputRecord PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; + /// The data to parse. + /// The client options for reading and writing models. + protected virtual OutputRecord PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + using (JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions)) + { + return DeserializeOutputRecord(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(OutputRecord)} does not support reading '{options.Format}' format."); + } + } - protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) => throw null; + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, _TypeModelUsageContext.Default); + default: + throw new FormatException($"The model {nameof(OutputRecord)} does not support writing '{options.Format}' format."); + } + } - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => throw null; + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); - OutputRecord IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => throw null; + /// The data to parse. + /// The client options for reading and writing models. + OutputRecord IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => throw null; + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - public static explicit operator OutputRecord(ClientResult result) => throw null; + /// The to deserialize the from. + public static explicit operator OutputRecord(ClientResult result) + { + PipelineResponse response = result.GetRawResponse(); + using JsonDocument document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeOutputRecord(document.RootElement, ModelSerializationExtensions.WireOptions); + } - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; + /// The JSON writer. + /// The client options for reading and writing models. + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } - protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(OutputRecord)} does not support writing '{format}' format."); + } + writer.WritePropertyName("requiredProp"u8); + writer.WriteStringValue(RequiredProp); + if (options.Format != "W" && _additionalBinaryDataProperties != null) + { + foreach (var item in _additionalBinaryDataProperties) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } - OutputRecord IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => throw null; + /// The JSON reader. + /// The client options for reading and writing models. + OutputRecord IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); - protected virtual OutputRecord JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => throw null; + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual OutputRecord JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(OutputRecord)} does not support reading '{format}' format."); + } + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeOutputRecord(document.RootElement, options); + } + + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static OutputRecord DeserializeOutputRecord(JsonElement element, ModelReaderWriterOptions options) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string requiredProp = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) + { + if (prop.NameEquals("requiredProp"u8)) + { + requiredProp = prop.Value.GetString(); + continue; + } + if (options.Format != "W") + { + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); + } + } + return new OutputRecord(requiredProp, additionalBinaryDataProperties); + } } } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/usage/src/Generated/Models/OutputRecord.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/usage/src/Generated/Models/OutputRecord.cs index 9da1535e946..ce377a68b6e 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/usage/src/Generated/Models/OutputRecord.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/usage/src/Generated/Models/OutputRecord.cs @@ -2,10 +2,34 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace _Type.Model.Usage { + /// Record used in operation return type. public partial class OutputRecord { - public string RequiredProp => throw null; + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; + + /// Initializes a new instance of . + /// + internal OutputRecord(string requiredProp) + { + RequiredProp = requiredProp; + } + + /// Initializes a new instance of . + /// + /// Keeps track of any properties unknown to the library. + internal OutputRecord(string requiredProp, IDictionary additionalBinaryDataProperties) + { + RequiredProp = requiredProp; + _additionalBinaryDataProperties = additionalBinaryDataProperties; + } + + /// Gets the RequiredProp. + public string RequiredProp { get; } } } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/usage/src/Generated/Models/_TypeModelUsageContext.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/usage/src/Generated/Models/_TypeModelUsageContext.cs index ce0a2f8e119..d9cdb266381 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/usage/src/Generated/Models/_TypeModelUsageContext.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/usage/src/Generated/Models/_TypeModelUsageContext.cs @@ -6,6 +6,10 @@ namespace _Type.Model.Usage { + /// + /// Context class which will be filled in by the System.ClientModel.SourceGeneration. + /// For more information + /// [ModelReaderWriterBuildable(typeof(InputOutputRecord))] [ModelReaderWriterBuildable(typeof(InputRecord))] [ModelReaderWriterBuildable(typeof(OutputRecord))] diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/usage/src/Generated/TypeModelUsageModelFactory.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/usage/src/Generated/TypeModelUsageModelFactory.cs index da7f6114d87..523bdb11002 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/usage/src/Generated/TypeModelUsageModelFactory.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/usage/src/Generated/TypeModelUsageModelFactory.cs @@ -4,12 +4,31 @@ namespace _Type.Model.Usage { + /// A factory class for creating instances of the models for mocking. public static partial class TypeModelUsageModelFactory { - public static InputRecord InputRecord(string requiredProp = default) => throw null; + /// Record used in operation parameters. + /// + /// A new instance for mocking. + public static InputRecord InputRecord(string requiredProp = default) + { + return new InputRecord(requiredProp, additionalBinaryDataProperties: null); + } - public static OutputRecord OutputRecord(string requiredProp = default) => throw null; + /// Record used in operation return type. + /// + /// A new instance for mocking. + public static OutputRecord OutputRecord(string requiredProp = default) + { + return new OutputRecord(requiredProp, additionalBinaryDataProperties: null); + } - public static InputOutputRecord InputOutputRecord(string requiredProp = default) => throw null; + /// Record used both as operation parameter and return type. + /// + /// A new instance for mocking. + public static InputOutputRecord InputOutputRecord(string requiredProp = default) + { + return new InputOutputRecord(requiredProp, additionalBinaryDataProperties: null); + } } } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/usage/src/Generated/UsageClient.RestClient.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/usage/src/Generated/UsageClient.RestClient.cs new file mode 100644 index 00000000000..c0288ab208d --- /dev/null +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/usage/src/Generated/UsageClient.RestClient.cs @@ -0,0 +1,59 @@ +// + +#nullable disable + +using System.ClientModel; +using System.ClientModel.Primitives; + +namespace _Type.Model.Usage +{ + /// + public partial class UsageClient + { + private static PipelineMessageClassifier _pipelineMessageClassifier200; + private static PipelineMessageClassifier _pipelineMessageClassifier204; + + private static PipelineMessageClassifier PipelineMessageClassifier200 => _pipelineMessageClassifier200 ??= PipelineMessageClassifier.Create(stackalloc ushort[] { 200 }); + + private static PipelineMessageClassifier PipelineMessageClassifier204 => _pipelineMessageClassifier204 ??= PipelineMessageClassifier.Create(stackalloc ushort[] { 204 }); + + internal PipelineMessage CreateInputRequest(BinaryContent content, RequestOptions options) + { + ClientUriBuilder uri = new ClientUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/type/model/usage/input", false); + PipelineMessage message = Pipeline.CreateMessage(uri.ToUri(), "POST", PipelineMessageClassifier204); + PipelineRequest request = message.Request; + request.Headers.Set("Content-Type", "application/json"); + request.Content = content; + message.Apply(options); + return message; + } + + internal PipelineMessage CreateOutputRequest(RequestOptions options) + { + ClientUriBuilder uri = new ClientUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/type/model/usage/output", false); + PipelineMessage message = Pipeline.CreateMessage(uri.ToUri(), "GET", PipelineMessageClassifier200); + PipelineRequest request = message.Request; + request.Headers.Set("Accept", "application/json"); + message.Apply(options); + return message; + } + + internal PipelineMessage CreateInputAndOutputRequest(BinaryContent content, RequestOptions options) + { + ClientUriBuilder uri = new ClientUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/type/model/usage/input-output", false); + PipelineMessage message = Pipeline.CreateMessage(uri.ToUri(), "POST", PipelineMessageClassifier200); + PipelineRequest request = message.Request; + request.Headers.Set("Content-Type", "application/json"); + request.Headers.Set("Accept", "application/json"); + request.Content = content; + message.Apply(options); + return message; + } + } +} diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/usage/src/Generated/UsageClient.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/usage/src/Generated/UsageClient.cs index bdf727d844f..87ce8638faf 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/usage/src/Generated/UsageClient.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/usage/src/Generated/UsageClient.cs @@ -11,39 +11,230 @@ namespace _Type.Model.Usage { + /// Illustrates usage of Record in different places(Operation parameters, return type or both). public partial class UsageClient { - public UsageClient() => throw null; - - public UsageClient(Uri endpoint, UsageClientOptions options) => throw null; - + private readonly Uri _endpoint; + + /// Initializes a new instance of UsageClient. + public UsageClient() : this(new Uri("http://localhost:3000"), new UsageClientOptions()) + { + } + + /// Initializes a new instance of UsageClient. + /// The authentication policy to use for pipeline creation. + /// Service endpoint. + /// The options for configuring the client. + internal UsageClient(AuthenticationPolicy authenticationPolicy, Uri endpoint, UsageClientOptions options) + { + options ??= new UsageClientOptions(); + + _endpoint = endpoint; + Pipeline = ClientPipeline.Create(options, Array.Empty(), new PipelinePolicy[] { new UserAgentPolicy(typeof(UsageClient).Assembly) }, Array.Empty()); + } + + /// Initializes a new instance of UsageClient. + /// Service endpoint. + /// The options for configuring the client. + /// is null. + public UsageClient(Uri endpoint, UsageClientOptions options) : this(null, endpoint, options) + { + } + + /// Initializes a new instance of UsageClient from settings. + /// The settings for UsageClient. [Experimental("SCME0002")] - public UsageClient(UsageClientSettings settings) => throw null; - - public ClientPipeline Pipeline => throw null; - - public virtual ClientResult Input(BinaryContent content, RequestOptions options = null) => throw null; - - public virtual Task InputAsync(BinaryContent content, RequestOptions options = null) => throw null; - - public virtual ClientResult Input(InputRecord input, CancellationToken cancellationToken = default) => throw null; - - public virtual Task InputAsync(InputRecord input, CancellationToken cancellationToken = default) => throw null; - - public virtual ClientResult Output(RequestOptions options) => throw null; - - public virtual Task OutputAsync(RequestOptions options) => throw null; - - public virtual ClientResult Output(CancellationToken cancellationToken = default) => throw null; - - public virtual Task> OutputAsync(CancellationToken cancellationToken = default) => throw null; - - public virtual ClientResult InputAndOutput(BinaryContent content, RequestOptions options = null) => throw null; - - public virtual Task InputAndOutputAsync(BinaryContent content, RequestOptions options = null) => throw null; - - public virtual ClientResult InputAndOutput(InputOutputRecord body, CancellationToken cancellationToken = default) => throw null; - - public virtual Task> InputAndOutputAsync(InputOutputRecord body, CancellationToken cancellationToken = default) => throw null; + public UsageClient(UsageClientSettings settings) : this(AuthenticationPolicy.Create(settings), settings?.Endpoint, settings?.Options) + { + } + + /// The HTTP pipeline for sending and receiving REST requests and responses. + public ClientPipeline Pipeline { get; } + + /// + /// [Protocol Method] Input + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// The content to send as the body of the request. + /// The request options, which can override default behaviors of the client pipeline on a per-call basis. + /// is null. + /// Service returned a non-success status code. + /// The response returned from the service. + public virtual ClientResult Input(BinaryContent content, RequestOptions options = null) + { + Argument.AssertNotNull(content, nameof(content)); + + using PipelineMessage message = CreateInputRequest(content, options); + return ClientResult.FromResponse(Pipeline.ProcessMessage(message, options)); + } + + /// + /// [Protocol Method] Input + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// The content to send as the body of the request. + /// The request options, which can override default behaviors of the client pipeline on a per-call basis. + /// is null. + /// Service returned a non-success status code. + /// The response returned from the service. + public virtual async Task InputAsync(BinaryContent content, RequestOptions options = null) + { + Argument.AssertNotNull(content, nameof(content)); + + using PipelineMessage message = CreateInputRequest(content, options); + return ClientResult.FromResponse(await Pipeline.ProcessMessageAsync(message, options).ConfigureAwait(false)); + } + + /// Input. + /// + /// The cancellation token that can be used to cancel the operation. + /// is null. + /// Service returned a non-success status code. + public virtual ClientResult Input(InputRecord input, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(input, nameof(input)); + + return Input(input, cancellationToken.ToRequestOptions()); + } + + /// Input. + /// + /// The cancellation token that can be used to cancel the operation. + /// is null. + /// Service returned a non-success status code. + public virtual async Task InputAsync(InputRecord input, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(input, nameof(input)); + + return await InputAsync(input, cancellationToken.ToRequestOptions()).ConfigureAwait(false); + } + + /// + /// [Protocol Method] Output + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// The request options, which can override default behaviors of the client pipeline on a per-call basis. + /// Service returned a non-success status code. + /// The response returned from the service. + public virtual ClientResult Output(RequestOptions options) + { + using PipelineMessage message = CreateOutputRequest(options); + return ClientResult.FromResponse(Pipeline.ProcessMessage(message, options)); + } + + /// + /// [Protocol Method] Output + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// The request options, which can override default behaviors of the client pipeline on a per-call basis. + /// Service returned a non-success status code. + /// The response returned from the service. + public virtual async Task OutputAsync(RequestOptions options) + { + using PipelineMessage message = CreateOutputRequest(options); + return ClientResult.FromResponse(await Pipeline.ProcessMessageAsync(message, options).ConfigureAwait(false)); + } + + /// Output. + /// The cancellation token that can be used to cancel the operation. + /// Service returned a non-success status code. + public virtual ClientResult Output(CancellationToken cancellationToken = default) + { + ClientResult result = Output(cancellationToken.ToRequestOptions()); + return ClientResult.FromValue((OutputRecord)result, result.GetRawResponse()); + } + + /// Output. + /// The cancellation token that can be used to cancel the operation. + /// Service returned a non-success status code. + public virtual async Task> OutputAsync(CancellationToken cancellationToken = default) + { + ClientResult result = await OutputAsync(cancellationToken.ToRequestOptions()).ConfigureAwait(false); + return ClientResult.FromValue((OutputRecord)result, result.GetRawResponse()); + } + + /// + /// [Protocol Method] InputAndOutput + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// The content to send as the body of the request. + /// The request options, which can override default behaviors of the client pipeline on a per-call basis. + /// is null. + /// Service returned a non-success status code. + /// The response returned from the service. + public virtual ClientResult InputAndOutput(BinaryContent content, RequestOptions options = null) + { + Argument.AssertNotNull(content, nameof(content)); + + using PipelineMessage message = CreateInputAndOutputRequest(content, options); + return ClientResult.FromResponse(Pipeline.ProcessMessage(message, options)); + } + + /// + /// [Protocol Method] InputAndOutput + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// The content to send as the body of the request. + /// The request options, which can override default behaviors of the client pipeline on a per-call basis. + /// is null. + /// Service returned a non-success status code. + /// The response returned from the service. + public virtual async Task InputAndOutputAsync(BinaryContent content, RequestOptions options = null) + { + Argument.AssertNotNull(content, nameof(content)); + + using PipelineMessage message = CreateInputAndOutputRequest(content, options); + return ClientResult.FromResponse(await Pipeline.ProcessMessageAsync(message, options).ConfigureAwait(false)); + } + + /// InputAndOutput. + /// + /// The cancellation token that can be used to cancel the operation. + /// is null. + /// Service returned a non-success status code. + public virtual ClientResult InputAndOutput(InputOutputRecord body, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(body, nameof(body)); + + ClientResult result = InputAndOutput(body, cancellationToken.ToRequestOptions()); + return ClientResult.FromValue((InputOutputRecord)result, result.GetRawResponse()); + } + + /// InputAndOutput. + /// + /// The cancellation token that can be used to cancel the operation. + /// is null. + /// Service returned a non-success status code. + public virtual async Task> InputAndOutputAsync(InputOutputRecord body, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(body, nameof(body)); + + ClientResult result = await InputAndOutputAsync(body, cancellationToken.ToRequestOptions()).ConfigureAwait(false); + return ClientResult.FromValue((InputOutputRecord)result, result.GetRawResponse()); + } } } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/usage/src/Generated/UsageClientOptions.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/usage/src/Generated/UsageClientOptions.cs index d5df51bba00..dc39c6c81bf 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/usage/src/Generated/UsageClientOptions.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/usage/src/Generated/UsageClientOptions.cs @@ -8,11 +8,23 @@ namespace _Type.Model.Usage { + /// Client options for . public partial class UsageClientOptions : ClientPipelineOptions { - public UsageClientOptions() => throw null; + /// Initializes a new instance of UsageClientOptions. + public UsageClientOptions() + { + } + /// Initializes a new instance of UsageClientOptions from configuration. + /// The configuration section. [Experimental("SCME0002")] - internal UsageClientOptions(IConfigurationSection section) : base(section) => throw null; + internal UsageClientOptions(IConfigurationSection section) : base(section) + { + if (section is null || !section.Exists()) + { + return; + } + } } } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/usage/src/Generated/UsageClientSettings.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/usage/src/Generated/UsageClientSettings.cs index 1d813163af2..1df71610c39 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/usage/src/Generated/UsageClientSettings.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/usage/src/Generated/UsageClientSettings.cs @@ -9,21 +9,29 @@ namespace _Type.Model.Usage { + /// [Experimental("SCME0002")] public partial class UsageClientSettings : ClientSettings { - public Uri Endpoint - { - get => throw null; - set => throw null; - } + /// Gets or sets the Endpoint. + public Uri Endpoint { get; set; } - public UsageClientOptions Options + /// Gets or sets the Options. + public UsageClientOptions Options { get; set; } + + /// Binds configuration values from the given section. + /// The configuration section. + protected override void BindCore(IConfigurationSection section) { - get => throw null; - set => throw null; + if (Uri.TryCreate(section["Endpoint"], UriKind.Absolute, out Uri endpoint)) + { + Endpoint = endpoint; + } + IConfigurationSection optionsSection = section.GetSection("Options"); + if (optionsSection.Exists()) + { + Options = new UsageClientOptions(optionsSection); + } } - - protected override void BindCore(IConfigurationSection section) => throw null; } } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/visibility/src/Generated/VisibilityClient.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/visibility/src/Generated/VisibilityClient.cs index a087e048518..dfb167036d6 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/visibility/src/Generated/VisibilityClient.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/visibility/src/Generated/VisibilityClient.cs @@ -13,12 +13,14 @@ namespace _Type.Model.Visibility { public partial class VisibilityClient { - public VisibilityClient() => throw null; + public VisibilityClient() : this(new Uri("http://localhost:3000"), new VisibilityClientOptions()) => throw null; - public VisibilityClient(Uri endpoint, VisibilityClientOptions options) => throw null; + internal VisibilityClient(AuthenticationPolicy authenticationPolicy, Uri endpoint, VisibilityClientOptions options) => throw null; + + public VisibilityClient(Uri endpoint, VisibilityClientOptions options) : this(null, endpoint, options) => throw null; [Experimental("SCME0002")] - public VisibilityClient(VisibilityClientSettings settings) => throw null; + public VisibilityClient(VisibilityClientSettings settings) : this(AuthenticationPolicy.Create(settings), settings?.Endpoint, settings?.Options) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/AdditionalPropertiesClient.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/AdditionalPropertiesClient.cs index e9ff0b3e5de..237007e44d6 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/AdditionalPropertiesClient.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/AdditionalPropertiesClient.cs @@ -10,12 +10,14 @@ namespace _Type.Property.AdditionalProperties { public partial class AdditionalPropertiesClient { - public AdditionalPropertiesClient() => throw null; + public AdditionalPropertiesClient() : this(new Uri("http://localhost:3000"), new AdditionalPropertiesClientOptions()) => throw null; - public AdditionalPropertiesClient(Uri endpoint, AdditionalPropertiesClientOptions options) => throw null; + internal AdditionalPropertiesClient(AuthenticationPolicy authenticationPolicy, Uri endpoint, AdditionalPropertiesClientOptions options) => throw null; + + public AdditionalPropertiesClient(Uri endpoint, AdditionalPropertiesClientOptions options) : this(null, endpoint, options) => throw null; [Experimental("SCME0002")] - public AdditionalPropertiesClient(AdditionalPropertiesClientSettings settings) => throw null; + public AdditionalPropertiesClient(AdditionalPropertiesClientSettings settings) : this(AuthenticationPolicy.Create(settings), settings?.Endpoint, settings?.Options) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/ExtendsDifferentSpreadFloat.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/ExtendsDifferentSpreadFloat.cs index 3711caec903..aa298158cb9 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/ExtendsDifferentSpreadFloat.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/ExtendsDifferentSpreadFloat.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -13,6 +14,8 @@ public partial class ExtendsDifferentSpreadFloat { protected ExtendsDifferentSpreadFloat() => throw null; + internal ExtendsDifferentSpreadFloat(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult Get(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/ExtendsDifferentSpreadModel.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/ExtendsDifferentSpreadModel.cs index 16952422f03..eaf913f4276 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/ExtendsDifferentSpreadModel.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/ExtendsDifferentSpreadModel.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -13,6 +14,8 @@ public partial class ExtendsDifferentSpreadModel { protected ExtendsDifferentSpreadModel() => throw null; + internal ExtendsDifferentSpreadModel(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult Get(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/ExtendsDifferentSpreadModelArray.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/ExtendsDifferentSpreadModelArray.cs index cafdfaa177b..2aacfeb2d02 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/ExtendsDifferentSpreadModelArray.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/ExtendsDifferentSpreadModelArray.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -13,6 +14,8 @@ public partial class ExtendsDifferentSpreadModelArray { protected ExtendsDifferentSpreadModelArray() => throw null; + internal ExtendsDifferentSpreadModelArray(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult Get(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/ExtendsDifferentSpreadString.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/ExtendsDifferentSpreadString.cs index 14de43be0c4..3ee0ddc45c5 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/ExtendsDifferentSpreadString.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/ExtendsDifferentSpreadString.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -13,6 +14,8 @@ public partial class ExtendsDifferentSpreadString { protected ExtendsDifferentSpreadString() => throw null; + internal ExtendsDifferentSpreadString(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult Get(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/ExtendsFloat.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/ExtendsFloat.cs index db8c90aa883..6f55bee1976 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/ExtendsFloat.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/ExtendsFloat.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -13,6 +14,8 @@ public partial class ExtendsFloat { protected ExtendsFloat() => throw null; + internal ExtendsFloat(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult Get(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/ExtendsModel.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/ExtendsModel.cs index fc3605496dc..a3e6a49c40f 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/ExtendsModel.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/ExtendsModel.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -13,6 +14,8 @@ public partial class ExtendsModel { protected ExtendsModel() => throw null; + internal ExtendsModel(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult Get(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/ExtendsModelArray.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/ExtendsModelArray.cs index 9fac072dc49..1da8aae31d1 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/ExtendsModelArray.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/ExtendsModelArray.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -13,6 +14,8 @@ public partial class ExtendsModelArray { protected ExtendsModelArray() => throw null; + internal ExtendsModelArray(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult Get(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/ExtendsString.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/ExtendsString.cs index 25a8bce5e84..13a5fbf8c13 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/ExtendsString.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/ExtendsString.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -13,6 +14,8 @@ public partial class ExtendsString { protected ExtendsString() => throw null; + internal ExtendsString(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult Get(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/ExtendsUnknown.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/ExtendsUnknown.cs index 3beb5baea3f..6e539221d9b 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/ExtendsUnknown.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/ExtendsUnknown.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -13,6 +14,8 @@ public partial class ExtendsUnknown { protected ExtendsUnknown() => throw null; + internal ExtendsUnknown(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult Get(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/ExtendsUnknownDerived.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/ExtendsUnknownDerived.cs index 1ba9e2819a5..f1636a68905 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/ExtendsUnknownDerived.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/ExtendsUnknownDerived.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -13,6 +14,8 @@ public partial class ExtendsUnknownDerived { protected ExtendsUnknownDerived() => throw null; + internal ExtendsUnknownDerived(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult Get(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/ExtendsUnknownDiscriminated.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/ExtendsUnknownDiscriminated.cs index dddd20125ee..261d9de0a04 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/ExtendsUnknownDiscriminated.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/ExtendsUnknownDiscriminated.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -13,6 +14,8 @@ public partial class ExtendsUnknownDiscriminated { protected ExtendsUnknownDiscriminated() => throw null; + internal ExtendsUnknownDiscriminated(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult Get(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/IsFloat.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/IsFloat.cs index 74284e4cd58..8be79e2ef26 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/IsFloat.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/IsFloat.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -13,6 +14,8 @@ public partial class IsFloat { protected IsFloat() => throw null; + internal IsFloat(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult Get(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/IsModel.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/IsModel.cs index 035ee852f98..65a3fa72022 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/IsModel.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/IsModel.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -13,6 +14,8 @@ public partial class IsModel { protected IsModel() => throw null; + internal IsModel(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult Get(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/IsModelArray.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/IsModelArray.cs index cb2785116e5..a4a639ee799 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/IsModelArray.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/IsModelArray.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -13,6 +14,8 @@ public partial class IsModelArray { protected IsModelArray() => throw null; + internal IsModelArray(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult Get(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/IsString.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/IsString.cs index 6281cebe5bc..10718fca333 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/IsString.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/IsString.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -13,6 +14,8 @@ public partial class IsString { protected IsString() => throw null; + internal IsString(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult Get(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/IsUnknown.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/IsUnknown.cs index 756f70c38ba..19c46424094 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/IsUnknown.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/IsUnknown.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -13,6 +14,8 @@ public partial class IsUnknown { protected IsUnknown() => throw null; + internal IsUnknown(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult Get(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/IsUnknownDerived.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/IsUnknownDerived.cs index c60981109bc..50e217613ef 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/IsUnknownDerived.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/IsUnknownDerived.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -13,6 +14,8 @@ public partial class IsUnknownDerived { protected IsUnknownDerived() => throw null; + internal IsUnknownDerived(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult Get(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/IsUnknownDiscriminated.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/IsUnknownDiscriminated.cs index 3686c8c898c..f6470550016 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/IsUnknownDiscriminated.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/IsUnknownDiscriminated.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -13,6 +14,8 @@ public partial class IsUnknownDiscriminated { protected IsUnknownDiscriminated() => throw null; + internal IsUnknownDiscriminated(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult Get(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/MultipleSpread.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/MultipleSpread.cs index 9b081a1a362..47355266fd2 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/MultipleSpread.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/MultipleSpread.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -13,6 +14,8 @@ public partial class MultipleSpread { protected MultipleSpread() => throw null; + internal MultipleSpread(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult Get(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/SpreadDifferentFloat.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/SpreadDifferentFloat.cs index f86ae0c3e6e..33d2e052e33 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/SpreadDifferentFloat.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/SpreadDifferentFloat.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -13,6 +14,8 @@ public partial class SpreadDifferentFloat { protected SpreadDifferentFloat() => throw null; + internal SpreadDifferentFloat(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult Get(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/SpreadDifferentModel.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/SpreadDifferentModel.cs index 0ba5c6d4854..a69132c7526 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/SpreadDifferentModel.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/SpreadDifferentModel.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -13,6 +14,8 @@ public partial class SpreadDifferentModel { protected SpreadDifferentModel() => throw null; + internal SpreadDifferentModel(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult Get(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/SpreadDifferentModelArray.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/SpreadDifferentModelArray.cs index 0d1cd493e84..5c6d809aa7c 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/SpreadDifferentModelArray.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/SpreadDifferentModelArray.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -13,6 +14,8 @@ public partial class SpreadDifferentModelArray { protected SpreadDifferentModelArray() => throw null; + internal SpreadDifferentModelArray(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult Get(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/SpreadDifferentString.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/SpreadDifferentString.cs index d990d8ba2c3..4123898a1ec 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/SpreadDifferentString.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/SpreadDifferentString.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -13,6 +14,8 @@ public partial class SpreadDifferentString { protected SpreadDifferentString() => throw null; + internal SpreadDifferentString(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult Get(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/SpreadFloat.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/SpreadFloat.cs index a97ea7ff831..a529e2b406f 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/SpreadFloat.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/SpreadFloat.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -13,6 +14,8 @@ public partial class SpreadFloat { protected SpreadFloat() => throw null; + internal SpreadFloat(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult Get(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/SpreadModel.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/SpreadModel.cs index 3db2515a716..002a15917bc 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/SpreadModel.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/SpreadModel.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -13,6 +14,8 @@ public partial class SpreadModel { protected SpreadModel() => throw null; + internal SpreadModel(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult Get(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/SpreadModelArray.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/SpreadModelArray.cs index aec0c659e11..bdc347b9941 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/SpreadModelArray.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/SpreadModelArray.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -13,6 +14,8 @@ public partial class SpreadModelArray { protected SpreadModelArray() => throw null; + internal SpreadModelArray(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult Get(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/SpreadRecordNonDiscriminatedUnion.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/SpreadRecordNonDiscriminatedUnion.cs index 89de049334c..dfd6786a0ab 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/SpreadRecordNonDiscriminatedUnion.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/SpreadRecordNonDiscriminatedUnion.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -13,6 +14,8 @@ public partial class SpreadRecordNonDiscriminatedUnion { protected SpreadRecordNonDiscriminatedUnion() => throw null; + internal SpreadRecordNonDiscriminatedUnion(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult Get(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/SpreadRecordNonDiscriminatedUnion2.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/SpreadRecordNonDiscriminatedUnion2.cs index e78b2929cd9..d33e1a547dc 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/SpreadRecordNonDiscriminatedUnion2.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/SpreadRecordNonDiscriminatedUnion2.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -13,6 +14,8 @@ public partial class SpreadRecordNonDiscriminatedUnion2 { protected SpreadRecordNonDiscriminatedUnion2() => throw null; + internal SpreadRecordNonDiscriminatedUnion2(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult Get(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/SpreadRecordNonDiscriminatedUnion3.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/SpreadRecordNonDiscriminatedUnion3.cs index ecb9285fa4e..76b3cf8b1fe 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/SpreadRecordNonDiscriminatedUnion3.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/SpreadRecordNonDiscriminatedUnion3.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -13,6 +14,8 @@ public partial class SpreadRecordNonDiscriminatedUnion3 { protected SpreadRecordNonDiscriminatedUnion3() => throw null; + internal SpreadRecordNonDiscriminatedUnion3(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult Get(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/SpreadRecordUnion.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/SpreadRecordUnion.cs index 7cc11db7439..97de92c85f4 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/SpreadRecordUnion.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/SpreadRecordUnion.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -13,6 +14,8 @@ public partial class SpreadRecordUnion { protected SpreadRecordUnion() => throw null; + internal SpreadRecordUnion(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult Get(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/SpreadString.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/SpreadString.cs index 2c4d33288de..4864d532e5a 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/SpreadString.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/src/Generated/SpreadString.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -13,6 +14,8 @@ public partial class SpreadString { protected SpreadString() => throw null; + internal SpreadString(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult Get(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/nullable/src/Generated/Bytes.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/nullable/src/Generated/Bytes.cs index eacf8814b15..4e6ff0b6f10 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/nullable/src/Generated/Bytes.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/nullable/src/Generated/Bytes.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -13,6 +14,8 @@ public partial class Bytes { protected Bytes() => throw null; + internal Bytes(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult GetNonNull(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/nullable/src/Generated/CollectionsByte.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/nullable/src/Generated/CollectionsByte.cs index ad2cd996943..147ed22adef 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/nullable/src/Generated/CollectionsByte.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/nullable/src/Generated/CollectionsByte.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -13,6 +14,8 @@ public partial class CollectionsByte { protected CollectionsByte() => throw null; + internal CollectionsByte(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult GetNonNull(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/nullable/src/Generated/CollectionsModel.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/nullable/src/Generated/CollectionsModel.cs index a424dcc6309..a2cb3752dd3 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/nullable/src/Generated/CollectionsModel.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/nullable/src/Generated/CollectionsModel.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -13,6 +14,8 @@ public partial class CollectionsModel { protected CollectionsModel() => throw null; + internal CollectionsModel(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult GetNonNull(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/nullable/src/Generated/CollectionsString.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/nullable/src/Generated/CollectionsString.cs index 3481b5221d5..9ebdb4ed447 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/nullable/src/Generated/CollectionsString.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/nullable/src/Generated/CollectionsString.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -13,6 +14,8 @@ public partial class CollectionsString { protected CollectionsString() => throw null; + internal CollectionsString(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult GetNonNull(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/nullable/src/Generated/Datetime.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/nullable/src/Generated/Datetime.cs index 2d316f989b4..65fd66ab449 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/nullable/src/Generated/Datetime.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/nullable/src/Generated/Datetime.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -13,6 +14,8 @@ public partial class Datetime { protected Datetime() => throw null; + internal Datetime(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult GetNonNull(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/nullable/src/Generated/Duration.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/nullable/src/Generated/Duration.cs index 5436a4fda27..d1091acfe3d 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/nullable/src/Generated/Duration.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/nullable/src/Generated/Duration.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -13,6 +14,8 @@ public partial class Duration { protected Duration() => throw null; + internal Duration(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult GetNonNull(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/nullable/src/Generated/NullableClient.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/nullable/src/Generated/NullableClient.cs index f99a66ed7c2..af9921af400 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/nullable/src/Generated/NullableClient.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/nullable/src/Generated/NullableClient.cs @@ -10,12 +10,14 @@ namespace _Type.Property.Nullable { public partial class NullableClient { - public NullableClient() => throw null; + public NullableClient() : this(new Uri("http://localhost:3000"), new NullableClientOptions()) => throw null; - public NullableClient(Uri endpoint, NullableClientOptions options) => throw null; + internal NullableClient(AuthenticationPolicy authenticationPolicy, Uri endpoint, NullableClientOptions options) => throw null; + + public NullableClient(Uri endpoint, NullableClientOptions options) : this(null, endpoint, options) => throw null; [Experimental("SCME0002")] - public NullableClient(NullableClientSettings settings) => throw null; + public NullableClient(NullableClientSettings settings) : this(AuthenticationPolicy.Create(settings), settings?.Endpoint, settings?.Options) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/nullable/src/Generated/String.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/nullable/src/Generated/String.cs index 461ad9d615b..786c381fb0b 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/nullable/src/Generated/String.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/nullable/src/Generated/String.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -13,6 +14,8 @@ public partial class String { protected String() => throw null; + internal String(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult GetNonNull(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/optionality/src/Generated/BooleanLiteral.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/optionality/src/Generated/BooleanLiteral.cs index 593e92d4244..6dca0711f46 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/optionality/src/Generated/BooleanLiteral.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/optionality/src/Generated/BooleanLiteral.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -13,6 +14,8 @@ public partial class BooleanLiteral { protected BooleanLiteral() => throw null; + internal BooleanLiteral(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult GetAll(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/optionality/src/Generated/Bytes.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/optionality/src/Generated/Bytes.cs index b4d7e3788e8..44c535cc253 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/optionality/src/Generated/Bytes.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/optionality/src/Generated/Bytes.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -13,6 +14,8 @@ public partial class Bytes { protected Bytes() => throw null; + internal Bytes(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult GetAll(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/optionality/src/Generated/CollectionsByte.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/optionality/src/Generated/CollectionsByte.cs index 706f6515fc5..808a6ca8b49 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/optionality/src/Generated/CollectionsByte.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/optionality/src/Generated/CollectionsByte.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -13,6 +14,8 @@ public partial class CollectionsByte { protected CollectionsByte() => throw null; + internal CollectionsByte(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult GetAll(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/optionality/src/Generated/CollectionsModel.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/optionality/src/Generated/CollectionsModel.cs index dfe28feac96..00be1dcec43 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/optionality/src/Generated/CollectionsModel.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/optionality/src/Generated/CollectionsModel.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -13,6 +14,8 @@ public partial class CollectionsModel { protected CollectionsModel() => throw null; + internal CollectionsModel(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult GetAll(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/optionality/src/Generated/Datetime.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/optionality/src/Generated/Datetime.cs index 5e578c2da19..3b2e4f0017b 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/optionality/src/Generated/Datetime.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/optionality/src/Generated/Datetime.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -13,6 +14,8 @@ public partial class Datetime { protected Datetime() => throw null; + internal Datetime(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult GetAll(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/optionality/src/Generated/Duration.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/optionality/src/Generated/Duration.cs index 03d2758ff8a..9a9c63ae762 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/optionality/src/Generated/Duration.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/optionality/src/Generated/Duration.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -13,6 +14,8 @@ public partial class Duration { protected Duration() => throw null; + internal Duration(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult GetAll(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/optionality/src/Generated/FloatLiteral.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/optionality/src/Generated/FloatLiteral.cs index 7d71a102cd8..f7504a61cf2 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/optionality/src/Generated/FloatLiteral.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/optionality/src/Generated/FloatLiteral.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -13,6 +14,8 @@ public partial class FloatLiteral { protected FloatLiteral() => throw null; + internal FloatLiteral(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult GetAll(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/optionality/src/Generated/IntLiteral.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/optionality/src/Generated/IntLiteral.cs index 5f5db298391..3309e35bfe2 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/optionality/src/Generated/IntLiteral.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/optionality/src/Generated/IntLiteral.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -13,6 +14,8 @@ public partial class IntLiteral { protected IntLiteral() => throw null; + internal IntLiteral(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult GetAll(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/optionality/src/Generated/OptionalClient.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/optionality/src/Generated/OptionalClient.cs index e8c62cd3c3b..359640c4a3f 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/optionality/src/Generated/OptionalClient.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/optionality/src/Generated/OptionalClient.cs @@ -10,12 +10,14 @@ namespace _Type.Property.Optional { public partial class OptionalClient { - public OptionalClient() => throw null; + public OptionalClient() : this(new Uri("http://localhost:3000"), new OptionalClientOptions()) => throw null; - public OptionalClient(Uri endpoint, OptionalClientOptions options) => throw null; + internal OptionalClient(AuthenticationPolicy authenticationPolicy, Uri endpoint, OptionalClientOptions options) => throw null; + + public OptionalClient(Uri endpoint, OptionalClientOptions options) : this(null, endpoint, options) => throw null; [Experimental("SCME0002")] - public OptionalClient(OptionalClientSettings settings) => throw null; + public OptionalClient(OptionalClientSettings settings) : this(AuthenticationPolicy.Create(settings), settings?.Endpoint, settings?.Options) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/optionality/src/Generated/PlainDate.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/optionality/src/Generated/PlainDate.cs index 27c9d8c861b..f95ec369404 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/optionality/src/Generated/PlainDate.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/optionality/src/Generated/PlainDate.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -13,6 +14,8 @@ public partial class PlainDate { protected PlainDate() => throw null; + internal PlainDate(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult GetAll(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/optionality/src/Generated/PlainTime.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/optionality/src/Generated/PlainTime.cs index 733f618e280..91c30419caf 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/optionality/src/Generated/PlainTime.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/optionality/src/Generated/PlainTime.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -13,6 +14,8 @@ public partial class PlainTime { protected PlainTime() => throw null; + internal PlainTime(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult GetAll(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/optionality/src/Generated/RequiredAndOptional.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/optionality/src/Generated/RequiredAndOptional.cs index 94bf40cd0f3..3253e5b109d 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/optionality/src/Generated/RequiredAndOptional.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/optionality/src/Generated/RequiredAndOptional.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -13,6 +14,8 @@ public partial class RequiredAndOptional { protected RequiredAndOptional() => throw null; + internal RequiredAndOptional(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult GetAll(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/optionality/src/Generated/String.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/optionality/src/Generated/String.cs index 223187bfb1e..def30985883 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/optionality/src/Generated/String.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/optionality/src/Generated/String.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -13,6 +14,8 @@ public partial class String { protected String() => throw null; + internal String(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult GetAll(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/optionality/src/Generated/StringLiteral.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/optionality/src/Generated/StringLiteral.cs index d6fca1040c1..a60ba46a07e 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/optionality/src/Generated/StringLiteral.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/optionality/src/Generated/StringLiteral.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -13,6 +14,8 @@ public partial class StringLiteral { protected StringLiteral() => throw null; + internal StringLiteral(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult GetAll(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/optionality/src/Generated/UnionFloatLiteral.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/optionality/src/Generated/UnionFloatLiteral.cs index aa088f014e9..9471446beff 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/optionality/src/Generated/UnionFloatLiteral.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/optionality/src/Generated/UnionFloatLiteral.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -13,6 +14,8 @@ public partial class UnionFloatLiteral { protected UnionFloatLiteral() => throw null; + internal UnionFloatLiteral(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult GetAll(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/optionality/src/Generated/UnionIntLiteral.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/optionality/src/Generated/UnionIntLiteral.cs index 65a65dc54ce..45324fc4c4d 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/optionality/src/Generated/UnionIntLiteral.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/optionality/src/Generated/UnionIntLiteral.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -13,6 +14,8 @@ public partial class UnionIntLiteral { protected UnionIntLiteral() => throw null; + internal UnionIntLiteral(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult GetAll(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/optionality/src/Generated/UnionStringLiteral.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/optionality/src/Generated/UnionStringLiteral.cs index 1041ae1cf99..4a44db8c460 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/optionality/src/Generated/UnionStringLiteral.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/optionality/src/Generated/UnionStringLiteral.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -13,6 +14,8 @@ public partial class UnionStringLiteral { protected UnionStringLiteral() => throw null; + internal UnionStringLiteral(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult GetAll(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/Boolean.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/Boolean.cs index 3f6b9d2df7c..f4e93d97aa5 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/Boolean.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/Boolean.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -13,6 +14,8 @@ public partial class Boolean { protected Boolean() => throw null; + internal Boolean(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult Get(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/BooleanLiteral.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/BooleanLiteral.cs index 679f7a738e3..e2bdc72c983 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/BooleanLiteral.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/BooleanLiteral.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -13,6 +14,8 @@ public partial class BooleanLiteral { protected BooleanLiteral() => throw null; + internal BooleanLiteral(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult Get(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/Bytes.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/Bytes.cs index b0a807a9c6d..428e3397974 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/Bytes.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/Bytes.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -13,6 +14,8 @@ public partial class Bytes { protected Bytes() => throw null; + internal Bytes(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult Get(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/CollectionsInt.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/CollectionsInt.cs index 3e6cc227cf5..f49bb79df44 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/CollectionsInt.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/CollectionsInt.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -13,6 +14,8 @@ public partial class CollectionsInt { protected CollectionsInt() => throw null; + internal CollectionsInt(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult Get(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/CollectionsModel.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/CollectionsModel.cs index 2a9ffb958a8..e40359c230c 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/CollectionsModel.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/CollectionsModel.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -13,6 +14,8 @@ public partial class CollectionsModel { protected CollectionsModel() => throw null; + internal CollectionsModel(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult Get(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/CollectionsString.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/CollectionsString.cs index c1dd5d23c45..18a7083e450 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/CollectionsString.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/CollectionsString.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -13,6 +14,8 @@ public partial class CollectionsString { protected CollectionsString() => throw null; + internal CollectionsString(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult Get(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/Datetime.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/Datetime.cs index b8f6983712b..9b6385a11da 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/Datetime.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/Datetime.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -13,6 +14,8 @@ public partial class Datetime { protected Datetime() => throw null; + internal Datetime(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult Get(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/Decimal.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/Decimal.cs index cfc5fa3fc48..90ac68ab77b 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/Decimal.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/Decimal.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -13,6 +14,8 @@ public partial class Decimal { protected Decimal() => throw null; + internal Decimal(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult Get(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/Decimal128.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/Decimal128.cs index 553501b9bdd..06b87e33722 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/Decimal128.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/Decimal128.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -13,6 +14,8 @@ public partial class Decimal128 { protected Decimal128() => throw null; + internal Decimal128(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult Get(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/DictionaryString.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/DictionaryString.cs index 0da288b589b..d1d5dc8e06e 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/DictionaryString.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/DictionaryString.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -13,6 +14,8 @@ public partial class DictionaryString { protected DictionaryString() => throw null; + internal DictionaryString(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult Get(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/Duration.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/Duration.cs index fb81d1ff2de..304ea7ce05e 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/Duration.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/Duration.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -13,6 +14,8 @@ public partial class Duration { protected Duration() => throw null; + internal Duration(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult Get(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/Enum.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/Enum.cs index 082585a6b1b..6ee002b6a38 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/Enum.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/Enum.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -13,6 +14,8 @@ public partial class Enum { protected Enum() => throw null; + internal Enum(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult Get(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/ExtensibleEnum.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/ExtensibleEnum.cs index 1d39d6232b2..05e0b19b4c5 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/ExtensibleEnum.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/ExtensibleEnum.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -13,6 +14,8 @@ public partial class ExtensibleEnum { protected ExtensibleEnum() => throw null; + internal ExtensibleEnum(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult Get(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/Float.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/Float.cs index 89917bd0d67..31ca39d2378 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/Float.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/Float.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -13,6 +14,8 @@ public partial class Float { protected Float() => throw null; + internal Float(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult Get(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/FloatLiteral.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/FloatLiteral.cs index 89f86508d9d..272147c3f79 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/FloatLiteral.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/FloatLiteral.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -13,6 +14,8 @@ public partial class FloatLiteral { protected FloatLiteral() => throw null; + internal FloatLiteral(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult Get(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/Int.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/Int.cs index e4e359014ea..42d5cab9109 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/Int.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/Int.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -13,6 +14,8 @@ public partial class Int { protected Int() => throw null; + internal Int(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult Get(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/IntLiteral.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/IntLiteral.cs index 75851545805..1504957189f 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/IntLiteral.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/IntLiteral.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -13,6 +14,8 @@ public partial class IntLiteral { protected IntLiteral() => throw null; + internal IntLiteral(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult Get(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/Model.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/Model.cs index 83467e85608..1c306e46d07 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/Model.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/Model.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -13,6 +14,8 @@ public partial class Model { protected Model() => throw null; + internal Model(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult Get(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/Never.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/Never.cs index 92ff671d14a..8e08e0fa31e 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/Never.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/Never.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -13,6 +14,8 @@ public partial class Never { protected Never() => throw null; + internal Never(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult Get(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/String.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/String.cs index 750373bbcfc..c49f8856b95 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/String.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/String.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -13,6 +14,8 @@ public partial class String { protected String() => throw null; + internal String(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult Get(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/StringLiteral.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/StringLiteral.cs index d02b76d3dd6..4e4108e032f 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/StringLiteral.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/StringLiteral.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -13,6 +14,8 @@ public partial class StringLiteral { protected StringLiteral() => throw null; + internal StringLiteral(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult Get(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/UnionEnumValue.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/UnionEnumValue.cs index 69962b5cd3f..bc5592782ce 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/UnionEnumValue.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/UnionEnumValue.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -13,6 +14,8 @@ public partial class UnionEnumValue { protected UnionEnumValue() => throw null; + internal UnionEnumValue(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult Get(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/UnionFloatLiteral.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/UnionFloatLiteral.cs index 620ccef7d9d..b722ec14e86 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/UnionFloatLiteral.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/UnionFloatLiteral.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -13,6 +14,8 @@ public partial class UnionFloatLiteral { protected UnionFloatLiteral() => throw null; + internal UnionFloatLiteral(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult Get(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/UnionIntLiteral.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/UnionIntLiteral.cs index 64b2d1651f8..32e42a85f40 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/UnionIntLiteral.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/UnionIntLiteral.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -13,6 +14,8 @@ public partial class UnionIntLiteral { protected UnionIntLiteral() => throw null; + internal UnionIntLiteral(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult Get(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/UnionStringLiteral.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/UnionStringLiteral.cs index 8dbaa7dec43..fde1c748c4d 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/UnionStringLiteral.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/UnionStringLiteral.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -13,6 +14,8 @@ public partial class UnionStringLiteral { protected UnionStringLiteral() => throw null; + internal UnionStringLiteral(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult Get(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/UnknownArray.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/UnknownArray.cs index b8e85f2c700..f40c76b820a 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/UnknownArray.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/UnknownArray.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -13,6 +14,8 @@ public partial class UnknownArray { protected UnknownArray() => throw null; + internal UnknownArray(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult Get(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/UnknownDict.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/UnknownDict.cs index 6c050d94eff..81fdff22645 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/UnknownDict.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/UnknownDict.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -13,6 +14,8 @@ public partial class UnknownDict { protected UnknownDict() => throw null; + internal UnknownDict(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult Get(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/UnknownInt.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/UnknownInt.cs index 222c28277e7..fb2f59c1cc5 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/UnknownInt.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/UnknownInt.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -13,6 +14,8 @@ public partial class UnknownInt { protected UnknownInt() => throw null; + internal UnknownInt(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult Get(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/UnknownString.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/UnknownString.cs index 2af9c5e7276..bb587ae7036 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/UnknownString.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/UnknownString.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -13,6 +14,8 @@ public partial class UnknownString { protected UnknownString() => throw null; + internal UnknownString(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult Get(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/ValueTypesClient.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/ValueTypesClient.cs index 200181ea7f9..f0d9d59fb35 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/ValueTypesClient.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/src/Generated/ValueTypesClient.cs @@ -10,12 +10,14 @@ namespace _Type.Property.ValueTypes { public partial class ValueTypesClient { - public ValueTypesClient() => throw null; + public ValueTypesClient() : this(new Uri("http://localhost:3000"), new ValueTypesClientOptions()) => throw null; - public ValueTypesClient(Uri endpoint, ValueTypesClientOptions options) => throw null; + internal ValueTypesClient(AuthenticationPolicy authenticationPolicy, Uri endpoint, ValueTypesClientOptions options) => throw null; + + public ValueTypesClient(Uri endpoint, ValueTypesClientOptions options) : this(null, endpoint, options) => throw null; [Experimental("SCME0002")] - public ValueTypesClient(ValueTypesClientSettings settings) => throw null; + public ValueTypesClient(ValueTypesClientSettings settings) : this(AuthenticationPolicy.Create(settings), settings?.Endpoint, settings?.Options) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/scalar/src/Generated/Boolean.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/scalar/src/Generated/Boolean.cs index 12a173aba7d..f3a074a4c57 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/scalar/src/Generated/Boolean.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/scalar/src/Generated/Boolean.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -13,6 +14,8 @@ public partial class Boolean { protected Boolean() => throw null; + internal Boolean(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult Get(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/scalar/src/Generated/Decimal128Type.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/scalar/src/Generated/Decimal128Type.cs index 941ee7e41dc..6e3566ea66a 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/scalar/src/Generated/Decimal128Type.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/scalar/src/Generated/Decimal128Type.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -13,6 +14,8 @@ public partial class Decimal128Type { protected Decimal128Type() => throw null; + internal Decimal128Type(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult ResponseBody(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/scalar/src/Generated/Decimal128Verify.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/scalar/src/Generated/Decimal128Verify.cs index 01200f453d3..11e138c5ac3 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/scalar/src/Generated/Decimal128Verify.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/scalar/src/Generated/Decimal128Verify.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Collections.Generic; @@ -14,6 +15,8 @@ public partial class Decimal128Verify { protected Decimal128Verify() => throw null; + internal Decimal128Verify(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult PrepareVerify(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/scalar/src/Generated/DecimalType.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/scalar/src/Generated/DecimalType.cs index 281338de6ca..c225451e654 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/scalar/src/Generated/DecimalType.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/scalar/src/Generated/DecimalType.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -13,6 +14,8 @@ public partial class DecimalType { protected DecimalType() => throw null; + internal DecimalType(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult ResponseBody(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/scalar/src/Generated/DecimalVerify.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/scalar/src/Generated/DecimalVerify.cs index 3c38a946f65..6b00b6964ac 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/scalar/src/Generated/DecimalVerify.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/scalar/src/Generated/DecimalVerify.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Collections.Generic; @@ -14,6 +15,8 @@ public partial class DecimalVerify { protected DecimalVerify() => throw null; + internal DecimalVerify(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult PrepareVerify(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/scalar/src/Generated/ScalarClient.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/scalar/src/Generated/ScalarClient.cs index 5c0e973bec4..c446fb20afc 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/scalar/src/Generated/ScalarClient.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/scalar/src/Generated/ScalarClient.cs @@ -10,12 +10,14 @@ namespace _Type.Scalar { public partial class ScalarClient { - public ScalarClient() => throw null; + public ScalarClient() : this(new Uri("http://localhost:3000"), new ScalarClientOptions()) => throw null; - public ScalarClient(Uri endpoint, ScalarClientOptions options) => throw null; + internal ScalarClient(AuthenticationPolicy authenticationPolicy, Uri endpoint, ScalarClientOptions options) => throw null; + + public ScalarClient(Uri endpoint, ScalarClientOptions options) : this(null, endpoint, options) => throw null; [Experimental("SCME0002")] - public ScalarClient(ScalarClientSettings settings) => throw null; + public ScalarClient(ScalarClientSettings settings) : this(AuthenticationPolicy.Create(settings), settings?.Endpoint, settings?.Options) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/scalar/src/Generated/String.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/scalar/src/Generated/String.cs index b1b7388d369..e58e6a99949 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/scalar/src/Generated/String.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/scalar/src/Generated/String.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -13,6 +14,8 @@ public partial class String { protected String() => throw null; + internal String(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult Get(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/scalar/src/Generated/Unknown.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/scalar/src/Generated/Unknown.cs index 39e08fd7025..ad255b77e27 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/scalar/src/Generated/Unknown.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/scalar/src/Generated/Unknown.cs @@ -14,6 +14,8 @@ public partial class Unknown { protected Unknown() => throw null; + internal Unknown(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult Get(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/union/src/Generated/EnumsOnly.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/union/src/Generated/EnumsOnly.cs index 5ea24aef091..326e87184ee 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/union/src/Generated/EnumsOnly.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/union/src/Generated/EnumsOnly.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -13,6 +14,8 @@ public partial class EnumsOnly { protected EnumsOnly() => throw null; + internal EnumsOnly(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult Get(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/union/src/Generated/FloatsOnly.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/union/src/Generated/FloatsOnly.cs index 6165e15eb36..687ca26b9d4 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/union/src/Generated/FloatsOnly.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/union/src/Generated/FloatsOnly.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -13,6 +14,8 @@ public partial class FloatsOnly { protected FloatsOnly() => throw null; + internal FloatsOnly(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult Get(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/union/src/Generated/IntsOnly.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/union/src/Generated/IntsOnly.cs index abb9c25fba4..d9e64843d11 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/union/src/Generated/IntsOnly.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/union/src/Generated/IntsOnly.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -13,6 +14,8 @@ public partial class IntsOnly { protected IntsOnly() => throw null; + internal IntsOnly(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult Get(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/union/src/Generated/MixedLiterals.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/union/src/Generated/MixedLiterals.cs index dc60eb0f3ab..7ee7a6ee49c 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/union/src/Generated/MixedLiterals.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/union/src/Generated/MixedLiterals.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -13,6 +14,8 @@ public partial class MixedLiterals { protected MixedLiterals() => throw null; + internal MixedLiterals(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult Get(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/union/src/Generated/MixedTypes.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/union/src/Generated/MixedTypes.cs index 72608045240..b7ae1cff2e4 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/union/src/Generated/MixedTypes.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/union/src/Generated/MixedTypes.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -13,6 +14,8 @@ public partial class MixedTypes { protected MixedTypes() => throw null; + internal MixedTypes(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult Get(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/union/src/Generated/ModelsOnly.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/union/src/Generated/ModelsOnly.cs index 9d638303f32..ebb37812dc0 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/union/src/Generated/ModelsOnly.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/union/src/Generated/ModelsOnly.cs @@ -14,6 +14,8 @@ public partial class ModelsOnly { protected ModelsOnly() => throw null; + internal ModelsOnly(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult Get(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/union/src/Generated/StringAndArray.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/union/src/Generated/StringAndArray.cs index 914985be3eb..0a470dd358d 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/union/src/Generated/StringAndArray.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/union/src/Generated/StringAndArray.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -13,6 +14,8 @@ public partial class StringAndArray { protected StringAndArray() => throw null; + internal StringAndArray(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult Get(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/union/src/Generated/StringExtensible.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/union/src/Generated/StringExtensible.cs index 04035a679a9..c6d886ad068 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/union/src/Generated/StringExtensible.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/union/src/Generated/StringExtensible.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -13,6 +14,8 @@ public partial class StringExtensible { protected StringExtensible() => throw null; + internal StringExtensible(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult Get(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/union/src/Generated/StringExtensibleNamed.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/union/src/Generated/StringExtensibleNamed.cs index e4299a80a88..85a4d399263 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/union/src/Generated/StringExtensibleNamed.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/union/src/Generated/StringExtensibleNamed.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -13,6 +14,8 @@ public partial class StringExtensibleNamed { protected StringExtensibleNamed() => throw null; + internal StringExtensibleNamed(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult Get(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/union/src/Generated/StringsOnly.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/union/src/Generated/StringsOnly.cs index e94cb73e42f..fb8ec122f24 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/union/src/Generated/StringsOnly.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/union/src/Generated/StringsOnly.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -13,6 +14,8 @@ public partial class StringsOnly { protected StringsOnly() => throw null; + internal StringsOnly(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult Get(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/union/src/Generated/UnionClient.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/union/src/Generated/UnionClient.cs index 683766a96c1..48df18bf7cc 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/union/src/Generated/UnionClient.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/union/src/Generated/UnionClient.cs @@ -10,12 +10,14 @@ namespace _Type.Union { public partial class UnionClient { - public UnionClient() => throw null; + public UnionClient() : this(new Uri("http://localhost:3000"), new UnionClientOptions()) => throw null; - public UnionClient(Uri endpoint, UnionClientOptions options) => throw null; + internal UnionClient(AuthenticationPolicy authenticationPolicy, Uri endpoint, UnionClientOptions options) => throw null; + + public UnionClient(Uri endpoint, UnionClientOptions options) : this(null, endpoint, options) => throw null; [Experimental("SCME0002")] - public UnionClient(UnionClientSettings settings) => throw null; + public UnionClient(UnionClientSettings settings) : this(AuthenticationPolicy.Create(settings), settings?.Endpoint, settings?.Options) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/added/v1/src/Generated/AddedClient.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/added/v1/src/Generated/AddedClient.cs index feb0007feaa..d3cfcb5aa70 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/added/v1/src/Generated/AddedClient.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/added/v1/src/Generated/AddedClient.cs @@ -15,12 +15,14 @@ public partial class AddedClient { protected AddedClient() => throw null; - public AddedClient(Uri endpoint) => throw null; + public AddedClient(Uri endpoint) : this(endpoint, new AddedClientOptions()) => throw null; - public AddedClient(Uri endpoint, AddedClientOptions options) => throw null; + internal AddedClient(AuthenticationPolicy authenticationPolicy, Uri endpoint, AddedClientOptions options) => throw null; + + public AddedClient(Uri endpoint, AddedClientOptions options) : this(null, endpoint, options) => throw null; [Experimental("SCME0002")] - public AddedClient(AddedClientSettings settings) => throw null; + public AddedClient(AddedClientSettings settings) : this(AuthenticationPolicy.Create(settings), settings?.Endpoint, settings?.Options) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/added/v2/src/Generated/AddedClient.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/added/v2/src/Generated/AddedClient.cs index 68a95455006..6f27070b32e 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/added/v2/src/Generated/AddedClient.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/added/v2/src/Generated/AddedClient.cs @@ -15,12 +15,14 @@ public partial class AddedClient { protected AddedClient() => throw null; - public AddedClient(Uri endpoint) => throw null; + public AddedClient(Uri endpoint) : this(endpoint, new AddedClientOptions()) => throw null; - public AddedClient(Uri endpoint, AddedClientOptions options) => throw null; + internal AddedClient(AuthenticationPolicy authenticationPolicy, Uri endpoint, AddedClientOptions options) => throw null; + + public AddedClient(Uri endpoint, AddedClientOptions options) : this(null, endpoint, options) => throw null; [Experimental("SCME0002")] - public AddedClient(AddedClientSettings settings) => throw null; + public AddedClient(AddedClientSettings settings) : this(AuthenticationPolicy.Create(settings), settings?.Endpoint, settings?.Options) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/added/v2/src/Generated/InterfaceV2.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/added/v2/src/Generated/InterfaceV2.cs index cef6e78f45d..09e38898e24 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/added/v2/src/Generated/InterfaceV2.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/added/v2/src/Generated/InterfaceV2.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -13,6 +14,8 @@ public partial class InterfaceV2 { protected InterfaceV2() => throw null; + internal InterfaceV2(ClientPipeline pipeline, Uri endpoint, string version) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult V2InInterface(BinaryContent content, RequestOptions options = null) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/madeOptional/v1/src/Generated/MadeOptionalClient.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/madeOptional/v1/src/Generated/MadeOptionalClient.cs index 93178fd9cfa..d78e1fe494b 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/madeOptional/v1/src/Generated/MadeOptionalClient.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/madeOptional/v1/src/Generated/MadeOptionalClient.cs @@ -15,12 +15,14 @@ public partial class MadeOptionalClient { protected MadeOptionalClient() => throw null; - public MadeOptionalClient(Uri endpoint) => throw null; + public MadeOptionalClient(Uri endpoint) : this(endpoint, new MadeOptionalClientOptions()) => throw null; - public MadeOptionalClient(Uri endpoint, MadeOptionalClientOptions options) => throw null; + internal MadeOptionalClient(AuthenticationPolicy authenticationPolicy, Uri endpoint, MadeOptionalClientOptions options) => throw null; + + public MadeOptionalClient(Uri endpoint, MadeOptionalClientOptions options) : this(null, endpoint, options) => throw null; [Experimental("SCME0002")] - public MadeOptionalClient(MadeOptionalClientSettings settings) => throw null; + public MadeOptionalClient(MadeOptionalClientSettings settings) : this(AuthenticationPolicy.Create(settings), settings?.Endpoint, settings?.Options) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/madeOptional/v2/src/Generated/MadeOptionalClient.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/madeOptional/v2/src/Generated/MadeOptionalClient.cs index 5a112a2e15c..a7c5df86c22 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/madeOptional/v2/src/Generated/MadeOptionalClient.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/madeOptional/v2/src/Generated/MadeOptionalClient.cs @@ -15,12 +15,14 @@ public partial class MadeOptionalClient { protected MadeOptionalClient() => throw null; - public MadeOptionalClient(Uri endpoint) => throw null; + public MadeOptionalClient(Uri endpoint) : this(endpoint, new MadeOptionalClientOptions()) => throw null; - public MadeOptionalClient(Uri endpoint, MadeOptionalClientOptions options) => throw null; + internal MadeOptionalClient(AuthenticationPolicy authenticationPolicy, Uri endpoint, MadeOptionalClientOptions options) => throw null; + + public MadeOptionalClient(Uri endpoint, MadeOptionalClientOptions options) : this(null, endpoint, options) => throw null; [Experimental("SCME0002")] - public MadeOptionalClient(MadeOptionalClientSettings settings) => throw null; + public MadeOptionalClient(MadeOptionalClientSettings settings) : this(AuthenticationPolicy.Create(settings), settings?.Endpoint, settings?.Options) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/removed/v1/src/Generated/InterfaceV1.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/removed/v1/src/Generated/InterfaceV1.cs index d3656e7c8d6..65f7690e6d9 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/removed/v1/src/Generated/InterfaceV1.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/removed/v1/src/Generated/InterfaceV1.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -13,6 +14,8 @@ public partial class InterfaceV1 { protected InterfaceV1() => throw null; + internal InterfaceV1(ClientPipeline pipeline, Uri endpoint, string version) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult V1InInterface(BinaryContent content, RequestOptions options = null) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/removed/v1/src/Generated/RemovedClient.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/removed/v1/src/Generated/RemovedClient.cs index d5997ec0e7a..3dfd35529a9 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/removed/v1/src/Generated/RemovedClient.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/removed/v1/src/Generated/RemovedClient.cs @@ -15,12 +15,14 @@ public partial class RemovedClient { protected RemovedClient() => throw null; - public RemovedClient(Uri endpoint) => throw null; + public RemovedClient(Uri endpoint) : this(endpoint, new RemovedClientOptions()) => throw null; - public RemovedClient(Uri endpoint, RemovedClientOptions options) => throw null; + internal RemovedClient(AuthenticationPolicy authenticationPolicy, Uri endpoint, RemovedClientOptions options) => throw null; + + public RemovedClient(Uri endpoint, RemovedClientOptions options) : this(null, endpoint, options) => throw null; [Experimental("SCME0002")] - public RemovedClient(RemovedClientSettings settings) => throw null; + public RemovedClient(RemovedClientSettings settings) : this(AuthenticationPolicy.Create(settings), settings?.Endpoint, settings?.Options) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/removed/v2/src/Generated/RemovedClient.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/removed/v2/src/Generated/RemovedClient.cs index fcbbf6f3ae9..d07a44fd254 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/removed/v2/src/Generated/RemovedClient.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/removed/v2/src/Generated/RemovedClient.cs @@ -15,12 +15,14 @@ public partial class RemovedClient { protected RemovedClient() => throw null; - public RemovedClient(Uri endpoint) => throw null; + public RemovedClient(Uri endpoint) : this(endpoint, new RemovedClientOptions()) => throw null; - public RemovedClient(Uri endpoint, RemovedClientOptions options) => throw null; + internal RemovedClient(AuthenticationPolicy authenticationPolicy, Uri endpoint, RemovedClientOptions options) => throw null; + + public RemovedClient(Uri endpoint, RemovedClientOptions options) : this(null, endpoint, options) => throw null; [Experimental("SCME0002")] - public RemovedClient(RemovedClientSettings settings) => throw null; + public RemovedClient(RemovedClientSettings settings) : this(AuthenticationPolicy.Create(settings), settings?.Endpoint, settings?.Options) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/removed/v2Preview/src/Generated/InterfaceV1.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/removed/v2Preview/src/Generated/InterfaceV1.cs index d3656e7c8d6..65f7690e6d9 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/removed/v2Preview/src/Generated/InterfaceV1.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/removed/v2Preview/src/Generated/InterfaceV1.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -13,6 +14,8 @@ public partial class InterfaceV1 { protected InterfaceV1() => throw null; + internal InterfaceV1(ClientPipeline pipeline, Uri endpoint, string version) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult V1InInterface(BinaryContent content, RequestOptions options = null) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/removed/v2Preview/src/Generated/RemovedClient.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/removed/v2Preview/src/Generated/RemovedClient.cs index d5997ec0e7a..3dfd35529a9 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/removed/v2Preview/src/Generated/RemovedClient.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/removed/v2Preview/src/Generated/RemovedClient.cs @@ -15,12 +15,14 @@ public partial class RemovedClient { protected RemovedClient() => throw null; - public RemovedClient(Uri endpoint) => throw null; + public RemovedClient(Uri endpoint) : this(endpoint, new RemovedClientOptions()) => throw null; - public RemovedClient(Uri endpoint, RemovedClientOptions options) => throw null; + internal RemovedClient(AuthenticationPolicy authenticationPolicy, Uri endpoint, RemovedClientOptions options) => throw null; + + public RemovedClient(Uri endpoint, RemovedClientOptions options) : this(null, endpoint, options) => throw null; [Experimental("SCME0002")] - public RemovedClient(RemovedClientSettings settings) => throw null; + public RemovedClient(RemovedClientSettings settings) : this(AuthenticationPolicy.Create(settings), settings?.Endpoint, settings?.Options) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/renamedFrom/v1/src/Generated/OldInterface.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/renamedFrom/v1/src/Generated/OldInterface.cs index 27d6fdcc629..165af44a376 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/renamedFrom/v1/src/Generated/OldInterface.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/renamedFrom/v1/src/Generated/OldInterface.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -13,6 +14,8 @@ public partial class OldInterface { protected OldInterface() => throw null; + internal OldInterface(ClientPipeline pipeline, Uri endpoint, string version) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult NewOpInNewInterface(BinaryContent content, RequestOptions options = null) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/renamedFrom/v1/src/Generated/RenamedFromClient.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/renamedFrom/v1/src/Generated/RenamedFromClient.cs index b8d95317eab..936e395e08f 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/renamedFrom/v1/src/Generated/RenamedFromClient.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/renamedFrom/v1/src/Generated/RenamedFromClient.cs @@ -15,12 +15,14 @@ public partial class RenamedFromClient { protected RenamedFromClient() => throw null; - public RenamedFromClient(Uri endpoint) => throw null; + public RenamedFromClient(Uri endpoint) : this(endpoint, new RenamedFromClientOptions()) => throw null; - public RenamedFromClient(Uri endpoint, RenamedFromClientOptions options) => throw null; + internal RenamedFromClient(AuthenticationPolicy authenticationPolicy, Uri endpoint, RenamedFromClientOptions options) => throw null; + + public RenamedFromClient(Uri endpoint, RenamedFromClientOptions options) : this(null, endpoint, options) => throw null; [Experimental("SCME0002")] - public RenamedFromClient(RenamedFromClientSettings settings) => throw null; + public RenamedFromClient(RenamedFromClientSettings settings) : this(AuthenticationPolicy.Create(settings), settings?.Endpoint, settings?.Options) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/renamedFrom/v2/src/Generated/NewInterface.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/renamedFrom/v2/src/Generated/NewInterface.cs index 959c7a48106..5a2e1c3333e 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/renamedFrom/v2/src/Generated/NewInterface.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/renamedFrom/v2/src/Generated/NewInterface.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -13,6 +14,8 @@ public partial class NewInterface { protected NewInterface() => throw null; + internal NewInterface(ClientPipeline pipeline, Uri endpoint, string version) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult NewOpInNewInterface(BinaryContent content, RequestOptions options = null) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/renamedFrom/v2/src/Generated/RenamedFromClient.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/renamedFrom/v2/src/Generated/RenamedFromClient.cs index f5573f5d524..18dab03d399 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/renamedFrom/v2/src/Generated/RenamedFromClient.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/renamedFrom/v2/src/Generated/RenamedFromClient.cs @@ -15,12 +15,14 @@ public partial class RenamedFromClient { protected RenamedFromClient() => throw null; - public RenamedFromClient(Uri endpoint) => throw null; + public RenamedFromClient(Uri endpoint) : this(endpoint, new RenamedFromClientOptions()) => throw null; - public RenamedFromClient(Uri endpoint, RenamedFromClientOptions options) => throw null; + internal RenamedFromClient(AuthenticationPolicy authenticationPolicy, Uri endpoint, RenamedFromClientOptions options) => throw null; + + public RenamedFromClient(Uri endpoint, RenamedFromClientOptions options) : this(null, endpoint, options) => throw null; [Experimental("SCME0002")] - public RenamedFromClient(RenamedFromClientSettings settings) => throw null; + public RenamedFromClient(RenamedFromClientSettings settings) : this(AuthenticationPolicy.Create(settings), settings?.Endpoint, settings?.Options) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/returnTypeChangedFrom/v1/src/Generated/ReturnTypeChangedFromClient.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/returnTypeChangedFrom/v1/src/Generated/ReturnTypeChangedFromClient.cs index 4f81dd6e61e..60b54b0ab97 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/returnTypeChangedFrom/v1/src/Generated/ReturnTypeChangedFromClient.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/returnTypeChangedFrom/v1/src/Generated/ReturnTypeChangedFromClient.cs @@ -15,12 +15,14 @@ public partial class ReturnTypeChangedFromClient { protected ReturnTypeChangedFromClient() => throw null; - public ReturnTypeChangedFromClient(Uri endpoint) => throw null; + public ReturnTypeChangedFromClient(Uri endpoint) : this(endpoint, new ReturnTypeChangedFromClientOptions()) => throw null; - public ReturnTypeChangedFromClient(Uri endpoint, ReturnTypeChangedFromClientOptions options) => throw null; + internal ReturnTypeChangedFromClient(AuthenticationPolicy authenticationPolicy, Uri endpoint, ReturnTypeChangedFromClientOptions options) => throw null; + + public ReturnTypeChangedFromClient(Uri endpoint, ReturnTypeChangedFromClientOptions options) : this(null, endpoint, options) => throw null; [Experimental("SCME0002")] - public ReturnTypeChangedFromClient(ReturnTypeChangedFromClientSettings settings) => throw null; + public ReturnTypeChangedFromClient(ReturnTypeChangedFromClientSettings settings) : this(AuthenticationPolicy.Create(settings), settings?.Endpoint, settings?.Options) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/returnTypeChangedFrom/v2/src/Generated/ReturnTypeChangedFromClient.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/returnTypeChangedFrom/v2/src/Generated/ReturnTypeChangedFromClient.cs index 6d5f8a4f8bb..5a20ae37bc3 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/returnTypeChangedFrom/v2/src/Generated/ReturnTypeChangedFromClient.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/returnTypeChangedFrom/v2/src/Generated/ReturnTypeChangedFromClient.cs @@ -15,12 +15,14 @@ public partial class ReturnTypeChangedFromClient { protected ReturnTypeChangedFromClient() => throw null; - public ReturnTypeChangedFromClient(Uri endpoint) => throw null; + public ReturnTypeChangedFromClient(Uri endpoint) : this(endpoint, new ReturnTypeChangedFromClientOptions()) => throw null; - public ReturnTypeChangedFromClient(Uri endpoint, ReturnTypeChangedFromClientOptions options) => throw null; + internal ReturnTypeChangedFromClient(AuthenticationPolicy authenticationPolicy, Uri endpoint, ReturnTypeChangedFromClientOptions options) => throw null; + + public ReturnTypeChangedFromClient(Uri endpoint, ReturnTypeChangedFromClientOptions options) : this(null, endpoint, options) => throw null; [Experimental("SCME0002")] - public ReturnTypeChangedFromClient(ReturnTypeChangedFromClientSettings settings) => throw null; + public ReturnTypeChangedFromClient(ReturnTypeChangedFromClientSettings settings) : this(AuthenticationPolicy.Create(settings), settings?.Endpoint, settings?.Options) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/typeChangedFrom/v1/src/Generated/TypeChangedFromClient.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/typeChangedFrom/v1/src/Generated/TypeChangedFromClient.cs index 8357ba551ed..fc0dde04309 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/typeChangedFrom/v1/src/Generated/TypeChangedFromClient.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/typeChangedFrom/v1/src/Generated/TypeChangedFromClient.cs @@ -15,12 +15,14 @@ public partial class TypeChangedFromClient { protected TypeChangedFromClient() => throw null; - public TypeChangedFromClient(Uri endpoint) => throw null; + public TypeChangedFromClient(Uri endpoint) : this(endpoint, new TypeChangedFromClientOptions()) => throw null; - public TypeChangedFromClient(Uri endpoint, TypeChangedFromClientOptions options) => throw null; + internal TypeChangedFromClient(AuthenticationPolicy authenticationPolicy, Uri endpoint, TypeChangedFromClientOptions options) => throw null; + + public TypeChangedFromClient(Uri endpoint, TypeChangedFromClientOptions options) : this(null, endpoint, options) => throw null; [Experimental("SCME0002")] - public TypeChangedFromClient(TypeChangedFromClientSettings settings) => throw null; + public TypeChangedFromClient(TypeChangedFromClientSettings settings) : this(AuthenticationPolicy.Create(settings), settings?.Endpoint, settings?.Options) => throw null; public ClientPipeline Pipeline => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/typeChangedFrom/v2/src/Generated/TypeChangedFromClient.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/typeChangedFrom/v2/src/Generated/TypeChangedFromClient.cs index fffac602195..bbb62a54e1a 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/typeChangedFrom/v2/src/Generated/TypeChangedFromClient.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/typeChangedFrom/v2/src/Generated/TypeChangedFromClient.cs @@ -15,12 +15,14 @@ public partial class TypeChangedFromClient { protected TypeChangedFromClient() => throw null; - public TypeChangedFromClient(Uri endpoint) => throw null; + public TypeChangedFromClient(Uri endpoint) : this(endpoint, new TypeChangedFromClientOptions()) => throw null; - public TypeChangedFromClient(Uri endpoint, TypeChangedFromClientOptions options) => throw null; + internal TypeChangedFromClient(AuthenticationPolicy authenticationPolicy, Uri endpoint, TypeChangedFromClientOptions options) => throw null; + + public TypeChangedFromClient(Uri endpoint, TypeChangedFromClientOptions options) : this(null, endpoint, options) => throw null; [Experimental("SCME0002")] - public TypeChangedFromClient(TypeChangedFromClientSettings settings) => throw null; + public TypeChangedFromClient(TypeChangedFromClientSettings settings) : this(AuthenticationPolicy.Create(settings), settings?.Endpoint, settings?.Options) => throw null; public ClientPipeline Pipeline => throw null; From ee7e432a59b704a32b14d824d6211185f4972317 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 11 Mar 2026 16:50:59 +0000 Subject: [PATCH 15/38] fix: address code review nits - use snippets, optimize ClientSettingsProvider ctor, restore global.json Co-authored-by: jorgerangel-msft <54595583+jorgerangel-msft@users.noreply.github.com> --- .../src/Providers/ClientOptionsProvider.cs | 5 ++- .../src/Providers/ClientProvider.cs | 4 +-- .../src/Providers/ClientSettingsProvider.cs | 33 +++++++++---------- packages/http-client-csharp/global.json | 7 +++- 4 files changed, 26 insertions(+), 23 deletions(-) diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Providers/ClientOptionsProvider.cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Providers/ClientOptionsProvider.cs index 1e418c24eb6..16e9ea5bb65 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Providers/ClientOptionsProvider.cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Providers/ClientOptionsProvider.cs @@ -318,8 +318,7 @@ private ConstructorProvider BuildConfigurationSectionConstructor() // if (section is null || !section.Exists()) { return; } var guardCondition = sectionParam.Is(Null).Or(Not(sectionParam.Invoke("Exists"))); - var guardStatement = new IfStatement(guardCondition); - guardStatement.Add(Return()); + var guardStatement = new IfStatement(guardCondition) { Return() }; body.Add(guardStatement); @@ -355,7 +354,7 @@ private ConstructorProvider BuildConfigurationSectionConstructor() body.Add(Declare(propValueVar, new IndexerExpression(sectionParam, Literal(property.Name)))); // if (!string.IsNullOrEmpty(propValue)) { Property = propValue; } - var ifProp = new IfStatement(Not(Static(typeof(string)).Invoke("IsNullOrEmpty", propValueVar))); + var ifProp = new IfStatement(Not(StringSnippets.IsNullOrEmpty(propValueVar.As()))); ifProp.Add(This.Property(property.Name).Assign(propValueVar).Terminate()); body.Add(ifProp); } diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Providers/ClientProvider.cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Providers/ClientProvider.cs index bce3f3b9579..3cb74431dc1 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Providers/ClientProvider.cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Providers/ClientProvider.cs @@ -686,7 +686,7 @@ private IEnumerable BuildSettingsConstructors() var propAccess = new MemberExpression(new NullConditionalExpression(settingsParam), propName); // Value types (enums, primitives) need ?? default since null-conditional returns T? ValueExpression arg = param.Type.IsValueType - ? new BinaryOperatorExpression("??", propAccess, new KeywordExpression("default", null)) + ? propAccess.NullCoalesce(new KeywordExpression("default", null)) : propAccess; args.Add(arg); } @@ -934,7 +934,7 @@ private ValueExpression BuildAuthPolicyArgument(AuthFields? authFields, IReadOnl // new BearerTokenPolicy(tokenProvider, AuthorizationScopes) // The param name is derived from the field name: _tokenProvider → tokenProvider, _tokenCredential → credential var credParam = requiredParameters.FirstOrDefault(p => - p.Name == TokenProviderFieldName.TrimStart('_') || + p.Name == TokenProviderFieldName.ToVariableName() || p.Name == "credential"); if (credParam != null) { diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Providers/ClientSettingsProvider.cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Providers/ClientSettingsProvider.cs index febe6ca2e90..300fe966f72 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Providers/ClientSettingsProvider.cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Providers/ClientSettingsProvider.cs @@ -13,6 +13,7 @@ using Microsoft.TypeSpec.Generator.Input.Extensions; using Microsoft.TypeSpec.Generator.Primitives; using Microsoft.TypeSpec.Generator.Providers; +using Microsoft.TypeSpec.Generator.Snippets; using Microsoft.TypeSpec.Generator.Statements; using static Microsoft.TypeSpec.Generator.Snippets.Snippet; @@ -23,8 +24,6 @@ public class ClientSettingsProvider : TypeProvider internal const string ClientSettingsDiagnosticId = "SCME0002"; private readonly ClientProvider _clientProvider; - private readonly InputEndpointParameter? _inputEndpointParam; - private readonly IReadOnlyList _otherRequiredParams; #pragma warning disable SCME0002 // ClientSettings is for evaluation purposes only internal static readonly CSharpType ClientSettingsType = typeof(ClientSettings); @@ -35,11 +34,13 @@ public class ClientSettingsProvider : TypeProvider internal ClientSettingsProvider(InputClient inputClient, ClientProvider clientProvider) { _clientProvider = clientProvider; - _inputEndpointParam = inputClient.Parameters + + var inputEndpointParam = inputClient.Parameters .FirstOrDefault(p => p is InputEndpointParameter ep && ep.IsEndpoint) as InputEndpointParameter; + EndpointPropertyName = inputEndpointParam?.Name.ToIdentifierName(); // Collect non-endpoint, non-apiVersion required parameters (auth params come separately via InputClient.Auth) - _otherRequiredParams = inputClient.Parameters + OtherRequiredParams = inputClient.Parameters .Where(p => p.IsRequired && !p.IsApiVersion && !(p is InputEndpointParameter ep && ep.IsEndpoint)) .Select(p => ScmCodeModelGenerator.Instance.TypeFactory.CreateParameter(p)) @@ -48,10 +49,10 @@ internal ClientSettingsProvider(InputClient inputClient, ClientProvider clientPr .ToList(); } - internal string? EndpointPropertyName => _inputEndpointParam?.Name.ToIdentifierName(); + internal string? EndpointPropertyName { get; } /// Gets non-endpoint, non-auth required parameters that have settings properties. - internal IReadOnlyList OtherRequiredParams => _otherRequiredParams; + internal IReadOnlyList OtherRequiredParams { get; } protected override string BuildRelativeFilePath() => Path.Combine("src", "Generated", $"{Name}.cs"); @@ -70,18 +71,18 @@ protected override PropertyProvider[] BuildProperties() { var properties = new List(); - if (_inputEndpointParam != null) + if (EndpointPropertyName != null) { properties.Add(new PropertyProvider( null, MethodSignatureModifiers.Public, new CSharpType(typeof(Uri), isNullable: true), - EndpointPropertyName!, + EndpointPropertyName, new AutoPropertyBody(true), this)); } - foreach (var param in _otherRequiredParams) + foreach (var param in OtherRequiredParams) { properties.Add(new PropertyProvider( null, @@ -111,24 +112,22 @@ protected override MethodProvider[] BuildMethods() var sectionParam = new ParameterProvider("section", $"The configuration section.", IConfigurationSectionType); var body = new List(); - if (_inputEndpointParam != null) + if (EndpointPropertyName != null) { - var endpointPropertyName = EndpointPropertyName!; - // if (Uri.TryCreate(section["EndpointPropertyName"], UriKind.Absolute, out Uri varName)) { EndpointProperty = varName; } - var outUriDecl = new DeclarationExpression(typeof(Uri), endpointPropertyName.ToVariableName(), out var uriVar, isOut: true); + var outUriDecl = new DeclarationExpression(typeof(Uri), EndpointPropertyName.ToVariableName(), out var uriVar, isOut: true); var ifStatement = new IfStatement(Static(typeof(Uri)).Invoke("TryCreate", new ValueExpression[] { - new IndexerExpression(sectionParam, Literal(endpointPropertyName)), + new IndexerExpression(sectionParam, Literal(EndpointPropertyName)), new MemberExpression(typeof(UriKind), nameof(UriKind.Absolute)), outUriDecl })); - ifStatement.Add(This.Property(endpointPropertyName).Assign(uriVar).Terminate()); + ifStatement.Add(This.Property(EndpointPropertyName).Assign(uriVar).Terminate()); body.Add(ifStatement); } - foreach (var param in _otherRequiredParams) + foreach (var param in OtherRequiredParams) { var propName = param.Name.ToIdentifierName(); // For string types: if (section[propName] is string val) PropName = val; @@ -136,7 +135,7 @@ protected override MethodProvider[] BuildMethods() { var valVar = new VariableExpression(new CSharpType(typeof(string), isNullable: true), param.Name.ToVariableName()); body.Add(Declare(valVar, new IndexerExpression(sectionParam, Literal(propName)))); - var ifStatement = new IfStatement(Not(Static(typeof(string)).Invoke("IsNullOrEmpty", valVar))); + var ifStatement = new IfStatement(Not(StringSnippets.IsNullOrEmpty(valVar.As()))); ifStatement.Add(This.Property(propName).Assign(valVar).Terminate()); body.Add(ifStatement); } diff --git a/packages/http-client-csharp/global.json b/packages/http-client-csharp/global.json index d3d8f44dafe..311edc2181a 100644 --- a/packages/http-client-csharp/global.json +++ b/packages/http-client-csharp/global.json @@ -1 +1,6 @@ -{"sdk":{"version":"10.0.102","rollForward":"feature"}} +{ + "sdk": { + "version": "10.0.103", + "rollForward": "feature" + } +} From d4ee3a5acb0e7991f303de751382695319476be7 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 11 Mar 2026 17:33:42 +0000 Subject: [PATCH 16/38] Co-authored-by: jorgerangel-msft <54595583+jorgerangel-msft@users.noreply.github.com> --- .../v1/src/Generated/MadeOptionalClient.cs | 37 ------------------ .../Generated/MadeOptionalClientOptions.cs | 26 ------------- .../Generated/MadeOptionalClientSettings.cs | 29 -------------- .../Models/TestModel.Serialization.cs | 38 ------------------- .../v1/src/Generated/Models/TestModel.cs | 23 ----------- .../Models/VersioningMadeOptionalV1Context.cs | 14 ------- .../VersioningMadeOptionalV1ModelFactory.cs | 13 ------- 7 files changed, 180 deletions(-) delete mode 100644 packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/madeOptional/v1/src/Generated/MadeOptionalClient.cs delete mode 100644 packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/madeOptional/v1/src/Generated/MadeOptionalClientOptions.cs delete mode 100644 packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/madeOptional/v1/src/Generated/MadeOptionalClientSettings.cs delete mode 100644 packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/madeOptional/v1/src/Generated/Models/TestModel.Serialization.cs delete mode 100644 packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/madeOptional/v1/src/Generated/Models/TestModel.cs delete mode 100644 packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/madeOptional/v1/src/Generated/Models/VersioningMadeOptionalV1Context.cs delete mode 100644 packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/madeOptional/v1/src/Generated/VersioningMadeOptionalV1ModelFactory.cs diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/madeOptional/v1/src/Generated/MadeOptionalClient.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/madeOptional/v1/src/Generated/MadeOptionalClient.cs deleted file mode 100644 index d78e1fe494b..00000000000 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/madeOptional/v1/src/Generated/MadeOptionalClient.cs +++ /dev/null @@ -1,37 +0,0 @@ -// - -#nullable disable - -using System; -using System.ClientModel; -using System.ClientModel.Primitives; -using System.Diagnostics.CodeAnalysis; -using System.Threading; -using System.Threading.Tasks; - -namespace Versioning.MadeOptional -{ - public partial class MadeOptionalClient - { - protected MadeOptionalClient() => throw null; - - public MadeOptionalClient(Uri endpoint) : this(endpoint, new MadeOptionalClientOptions()) => throw null; - - internal MadeOptionalClient(AuthenticationPolicy authenticationPolicy, Uri endpoint, MadeOptionalClientOptions options) => throw null; - - public MadeOptionalClient(Uri endpoint, MadeOptionalClientOptions options) : this(null, endpoint, options) => throw null; - - [Experimental("SCME0002")] - public MadeOptionalClient(MadeOptionalClientSettings settings) : this(AuthenticationPolicy.Create(settings), settings?.Endpoint, settings?.Options) => throw null; - - public ClientPipeline Pipeline => throw null; - - public virtual ClientResult Test(string @param, BinaryContent content, RequestOptions options = null) => throw null; - - public virtual Task TestAsync(string @param, BinaryContent content, RequestOptions options = null) => throw null; - - public virtual ClientResult Test(string @param, TestModel body, CancellationToken cancellationToken = default) => throw null; - - public virtual Task> TestAsync(string @param, TestModel body, CancellationToken cancellationToken = default) => throw null; - } -} diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/madeOptional/v1/src/Generated/MadeOptionalClientOptions.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/madeOptional/v1/src/Generated/MadeOptionalClientOptions.cs deleted file mode 100644 index d26fc936f07..00000000000 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/madeOptional/v1/src/Generated/MadeOptionalClientOptions.cs +++ /dev/null @@ -1,26 +0,0 @@ -// - -#nullable disable - -using System.ClientModel.Primitives; -using System.Diagnostics.CodeAnalysis; -using Microsoft.Extensions.Configuration; - -namespace Versioning.MadeOptional -{ - public partial class MadeOptionalClientOptions : ClientPipelineOptions - { - private const ServiceVersion LatestVersion = ServiceVersion.V1; - - public MadeOptionalClientOptions(ServiceVersion version = LatestVersion) => throw null; - - [Experimental("SCME0002")] - internal MadeOptionalClientOptions(IConfigurationSection section) : base(section) => throw null; - - public enum ServiceVersion - { - /// The version v1. - V1 = 1 - } - } -} diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/madeOptional/v1/src/Generated/MadeOptionalClientSettings.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/madeOptional/v1/src/Generated/MadeOptionalClientSettings.cs deleted file mode 100644 index 4773765707d..00000000000 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/madeOptional/v1/src/Generated/MadeOptionalClientSettings.cs +++ /dev/null @@ -1,29 +0,0 @@ -// - -#nullable disable - -using System; -using System.ClientModel.Primitives; -using System.Diagnostics.CodeAnalysis; -using Microsoft.Extensions.Configuration; - -namespace Versioning.MadeOptional -{ - [Experimental("SCME0002")] - public partial class MadeOptionalClientSettings : ClientSettings - { - public Uri Endpoint - { - get => throw null; - set => throw null; - } - - public MadeOptionalClientOptions Options - { - get => throw null; - set => throw null; - } - - protected override void BindCore(IConfigurationSection section) => throw null; - } -} diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/madeOptional/v1/src/Generated/Models/TestModel.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/madeOptional/v1/src/Generated/Models/TestModel.Serialization.cs deleted file mode 100644 index 331346c4851..00000000000 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/madeOptional/v1/src/Generated/Models/TestModel.Serialization.cs +++ /dev/null @@ -1,38 +0,0 @@ -// - -#nullable disable - -using System; -using System.ClientModel; -using System.ClientModel.Primitives; -using System.Text.Json; - -namespace Versioning.MadeOptional -{ - public partial class TestModel : IJsonModel - { - internal TestModel() => throw null; - - protected virtual TestModel PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; - - protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) => throw null; - - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => throw null; - - TestModel IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => throw null; - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => throw null; - - public static implicit operator BinaryContent(TestModel testModel) => throw null; - - public static explicit operator TestModel(ClientResult result) => throw null; - - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; - - protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; - - TestModel IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => throw null; - - protected virtual TestModel JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => throw null; - } -} diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/madeOptional/v1/src/Generated/Models/TestModel.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/madeOptional/v1/src/Generated/Models/TestModel.cs deleted file mode 100644 index eca2fc80f1d..00000000000 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/madeOptional/v1/src/Generated/Models/TestModel.cs +++ /dev/null @@ -1,23 +0,0 @@ -// - -#nullable disable - -namespace Versioning.MadeOptional -{ - public partial class TestModel - { - public TestModel(string prop, string changedProp) => throw null; - - public string Prop - { - get => throw null; - set => throw null; - } - - public string ChangedProp - { - get => throw null; - set => throw null; - } - } -} diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/madeOptional/v1/src/Generated/Models/VersioningMadeOptionalV1Context.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/madeOptional/v1/src/Generated/Models/VersioningMadeOptionalV1Context.cs deleted file mode 100644 index 7c7a9e4744b..00000000000 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/madeOptional/v1/src/Generated/Models/VersioningMadeOptionalV1Context.cs +++ /dev/null @@ -1,14 +0,0 @@ -// - -#nullable disable - -using System.ClientModel.Primitives; -using Versioning.MadeOptional; - -namespace Versioning.MadeOptional.V1 -{ - [ModelReaderWriterBuildable(typeof(TestModel))] - public partial class VersioningMadeOptionalV1Context : ModelReaderWriterContext - { - } -} diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/madeOptional/v1/src/Generated/VersioningMadeOptionalV1ModelFactory.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/madeOptional/v1/src/Generated/VersioningMadeOptionalV1ModelFactory.cs deleted file mode 100644 index 9b1ab90857d..00000000000 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/madeOptional/v1/src/Generated/VersioningMadeOptionalV1ModelFactory.cs +++ /dev/null @@ -1,13 +0,0 @@ -// - -#nullable disable - -using Versioning.MadeOptional; - -namespace Versioning.MadeOptional.V1 -{ - public static partial class VersioningMadeOptionalV1ModelFactory - { - public static TestModel TestModel(string prop = default, string changedProp = default) => throw null; - } -} From 88b42e2830233fb698c7d3ff4daa3c648a7f0960 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 11 Mar 2026 18:17:41 +0000 Subject: [PATCH 17/38] fix: regenerate Spector specs to fix build - restore missing v1 files, remove incorrectly committed unstubbed artifacts Co-authored-by: JoshLove-msft <54595583+JoshLove-msft@users.noreply.github.com> --- .../CollectionFormatClient.RestClient.cs | 11 - .../src/Generated/CollectionFormatClient.cs | 52 +--- .../CollectionFormatClientOptions.cs | 16 +- .../CollectionFormatClientSettings.cs | 28 +- .../src/Generated/Header.RestClient.cs | 33 -- .../collection-format/src/Generated/Header.cs | 87 +----- .../src/Generated/Internal/Argument.cs | 110 ------- .../Internal/CancellationTokenExtensions.cs | 14 - .../Generated/Internal/ChangeTrackingList.cs | 165 ---------- .../Internal/ClientPipelineExtensions.cs | 67 ---- .../Generated/Internal/ClientUriBuilder.cs | 181 ----------- .../Internal/CodeGenMemberAttribute.cs | 17 -- .../Internal/CodeGenSerializationAttribute.cs | 45 --- .../Internal/CodeGenSuppressAttribute.cs | 26 -- .../Internal/CodeGenTypeAttribute.cs | 21 -- .../src/Generated/Internal/ErrorResult.cs | 24 -- .../PipelineRequestHeadersExtensions.cs | 45 --- .../Generated/Internal/SerializationFormat.cs | 46 --- .../src/Generated/Internal/TypeFormatters.cs | 178 ----------- .../ParametersCollectionFormatContext.cs | 4 - .../src/Generated/Query.RestClient.cs | 81 ----- .../collection-format/src/Generated/Query.cs | 285 ++---------------- .../usage/src/Generated/Internal/Argument.cs | 110 ------- .../Internal/CancellationTokenExtensions.cs | 14 - .../Internal/ChangeTrackingDictionary.cs | 186 ------------ .../Internal/ClientPipelineExtensions.cs | 67 ---- .../Generated/Internal/ClientUriBuilder.cs | 181 ----------- .../Internal/CodeGenMemberAttribute.cs | 17 -- .../Internal/CodeGenSerializationAttribute.cs | 45 --- .../Internal/CodeGenSuppressAttribute.cs | 26 -- .../Internal/CodeGenTypeAttribute.cs | 21 -- .../src/Generated/Internal/ErrorResult.cs | 24 -- .../Internal/ModelSerializationExtensions.cs | 265 ---------------- .../Generated/Internal/SerializationFormat.cs | 46 --- .../src/Generated/Internal/TypeFormatters.cs | 178 ----------- .../Models/InputOutputRecord.Serialization.cs | 144 +-------- .../src/Generated/Models/InputOutputRecord.cs | 29 +- .../Models/InputRecord.Serialization.cs | 136 +-------- .../usage/src/Generated/Models/InputRecord.cs | 29 +- .../Models/OutputRecord.Serialization.cs | 134 +------- .../src/Generated/Models/OutputRecord.cs | 26 +- .../Models/_TypeModelUsageContext.cs | 4 - .../Generated/TypeModelUsageModelFactory.cs | 25 +- .../src/Generated/UsageClient.RestClient.cs | 59 ---- .../model/usage/src/Generated/UsageClient.cs | 255 ++-------------- .../usage/src/Generated/UsageClientOptions.cs | 16 +- .../src/Generated/UsageClientSettings.cs | 28 +- .../v1/src/Generated/MadeOptionalClient.cs | 37 +++ .../Generated/MadeOptionalClientOptions.cs | 26 ++ .../Generated/MadeOptionalClientSettings.cs | 29 ++ .../Models/TestModel.Serialization.cs | 38 +++ .../v1/src/Generated/Models/TestModel.cs | 23 ++ .../Models/VersioningMadeOptionalV1Context.cs | 14 + .../VersioningMadeOptionalV1ModelFactory.cs | 13 + 54 files changed, 314 insertions(+), 3467 deletions(-) delete mode 100644 packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/collection-format/src/Generated/CollectionFormatClient.RestClient.cs delete mode 100644 packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/collection-format/src/Generated/Header.RestClient.cs delete mode 100644 packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/collection-format/src/Generated/Internal/Argument.cs delete mode 100644 packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/collection-format/src/Generated/Internal/CancellationTokenExtensions.cs delete mode 100644 packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/collection-format/src/Generated/Internal/ChangeTrackingList.cs delete mode 100644 packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/collection-format/src/Generated/Internal/ClientPipelineExtensions.cs delete mode 100644 packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/collection-format/src/Generated/Internal/ClientUriBuilder.cs delete mode 100644 packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/collection-format/src/Generated/Internal/CodeGenMemberAttribute.cs delete mode 100644 packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/collection-format/src/Generated/Internal/CodeGenSerializationAttribute.cs delete mode 100644 packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/collection-format/src/Generated/Internal/CodeGenSuppressAttribute.cs delete mode 100644 packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/collection-format/src/Generated/Internal/CodeGenTypeAttribute.cs delete mode 100644 packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/collection-format/src/Generated/Internal/ErrorResult.cs delete mode 100644 packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/collection-format/src/Generated/Internal/PipelineRequestHeadersExtensions.cs delete mode 100644 packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/collection-format/src/Generated/Internal/SerializationFormat.cs delete mode 100644 packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/collection-format/src/Generated/Internal/TypeFormatters.cs delete mode 100644 packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/collection-format/src/Generated/Query.RestClient.cs delete mode 100644 packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/usage/src/Generated/Internal/Argument.cs delete mode 100644 packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/usage/src/Generated/Internal/CancellationTokenExtensions.cs delete mode 100644 packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/usage/src/Generated/Internal/ChangeTrackingDictionary.cs delete mode 100644 packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/usage/src/Generated/Internal/ClientPipelineExtensions.cs delete mode 100644 packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/usage/src/Generated/Internal/ClientUriBuilder.cs delete mode 100644 packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/usage/src/Generated/Internal/CodeGenMemberAttribute.cs delete mode 100644 packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/usage/src/Generated/Internal/CodeGenSerializationAttribute.cs delete mode 100644 packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/usage/src/Generated/Internal/CodeGenSuppressAttribute.cs delete mode 100644 packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/usage/src/Generated/Internal/CodeGenTypeAttribute.cs delete mode 100644 packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/usage/src/Generated/Internal/ErrorResult.cs delete mode 100644 packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/usage/src/Generated/Internal/ModelSerializationExtensions.cs delete mode 100644 packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/usage/src/Generated/Internal/SerializationFormat.cs delete mode 100644 packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/usage/src/Generated/Internal/TypeFormatters.cs delete mode 100644 packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/usage/src/Generated/UsageClient.RestClient.cs create mode 100644 packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/madeOptional/v1/src/Generated/MadeOptionalClient.cs create mode 100644 packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/madeOptional/v1/src/Generated/MadeOptionalClientOptions.cs create mode 100644 packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/madeOptional/v1/src/Generated/MadeOptionalClientSettings.cs create mode 100644 packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/madeOptional/v1/src/Generated/Models/TestModel.Serialization.cs create mode 100644 packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/madeOptional/v1/src/Generated/Models/TestModel.cs create mode 100644 packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/madeOptional/v1/src/Generated/Models/VersioningMadeOptionalV1Context.cs create mode 100644 packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/madeOptional/v1/src/Generated/VersioningMadeOptionalV1ModelFactory.cs diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/collection-format/src/Generated/CollectionFormatClient.RestClient.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/collection-format/src/Generated/CollectionFormatClient.RestClient.cs deleted file mode 100644 index f8bc1c1579a..00000000000 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/collection-format/src/Generated/CollectionFormatClient.RestClient.cs +++ /dev/null @@ -1,11 +0,0 @@ -// - -#nullable disable - -namespace Parameters.CollectionFormat -{ - /// - public partial class CollectionFormatClient - { - } -} diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/collection-format/src/Generated/CollectionFormatClient.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/collection-format/src/Generated/CollectionFormatClient.cs index 59a7b5a2fef..cfac396e5f9 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/collection-format/src/Generated/CollectionFormatClient.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/collection-format/src/Generated/CollectionFormatClient.cs @@ -5,64 +5,26 @@ using System; using System.ClientModel.Primitives; using System.Diagnostics.CodeAnalysis; -using System.Threading; using Parameters.CollectionFormat._Header; using Parameters.CollectionFormat._Query; namespace Parameters.CollectionFormat { - /// Test for collectionFormat. public partial class CollectionFormatClient { - private readonly Uri _endpoint; - private Query _cachedQuery; - private Header _cachedHeader; + public CollectionFormatClient() : this(new Uri("http://localhost:3000"), new CollectionFormatClientOptions()) => throw null; - /// Initializes a new instance of CollectionFormatClient. - public CollectionFormatClient() : this(new Uri("http://localhost:3000"), new CollectionFormatClientOptions()) - { - } + internal CollectionFormatClient(AuthenticationPolicy authenticationPolicy, Uri endpoint, CollectionFormatClientOptions options) => throw null; - /// Initializes a new instance of CollectionFormatClient. - /// The authentication policy to use for pipeline creation. - /// Service endpoint. - /// The options for configuring the client. - internal CollectionFormatClient(AuthenticationPolicy authenticationPolicy, Uri endpoint, CollectionFormatClientOptions options) - { - options ??= new CollectionFormatClientOptions(); + public CollectionFormatClient(Uri endpoint, CollectionFormatClientOptions options) : this(null, endpoint, options) => throw null; - _endpoint = endpoint; - Pipeline = ClientPipeline.Create(options, Array.Empty(), new PipelinePolicy[] { new UserAgentPolicy(typeof(CollectionFormatClient).Assembly) }, Array.Empty()); - } - - /// Initializes a new instance of CollectionFormatClient. - /// Service endpoint. - /// The options for configuring the client. - /// is null. - public CollectionFormatClient(Uri endpoint, CollectionFormatClientOptions options) : this(null, endpoint, options) - { - } - - /// Initializes a new instance of CollectionFormatClient from settings. - /// The settings for CollectionFormatClient. [Experimental("SCME0002")] - public CollectionFormatClient(CollectionFormatClientSettings settings) : this(AuthenticationPolicy.Create(settings), settings?.Endpoint, settings?.Options) - { - } + public CollectionFormatClient(CollectionFormatClientSettings settings) : this(AuthenticationPolicy.Create(settings), settings?.Endpoint, settings?.Options) => throw null; - /// The HTTP pipeline for sending and receiving REST requests and responses. - public ClientPipeline Pipeline { get; } + public ClientPipeline Pipeline => throw null; - /// Initializes a new instance of Query. - public virtual Query GetQueryClient() - { - return Volatile.Read(ref _cachedQuery) ?? Interlocked.CompareExchange(ref _cachedQuery, new Query(Pipeline, _endpoint), null) ?? _cachedQuery; - } + public virtual Query GetQueryClient() => throw null; - /// Initializes a new instance of Header. - public virtual Header GetHeaderClient() - { - return Volatile.Read(ref _cachedHeader) ?? Interlocked.CompareExchange(ref _cachedHeader, new Header(Pipeline, _endpoint), null) ?? _cachedHeader; - } + public virtual Header GetHeaderClient() => throw null; } } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/collection-format/src/Generated/CollectionFormatClientOptions.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/collection-format/src/Generated/CollectionFormatClientOptions.cs index bdf3fd004d8..227d9ffd344 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/collection-format/src/Generated/CollectionFormatClientOptions.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/collection-format/src/Generated/CollectionFormatClientOptions.cs @@ -8,23 +8,11 @@ namespace Parameters.CollectionFormat { - /// Client options for . public partial class CollectionFormatClientOptions : ClientPipelineOptions { - /// Initializes a new instance of CollectionFormatClientOptions. - public CollectionFormatClientOptions() - { - } + public CollectionFormatClientOptions() => throw null; - /// Initializes a new instance of CollectionFormatClientOptions from configuration. - /// The configuration section. [Experimental("SCME0002")] - internal CollectionFormatClientOptions(IConfigurationSection section) : base(section) - { - if (section is null || !section.Exists()) - { - return; - } - } + internal CollectionFormatClientOptions(IConfigurationSection section) : base(section) => throw null; } } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/collection-format/src/Generated/CollectionFormatClientSettings.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/collection-format/src/Generated/CollectionFormatClientSettings.cs index 774ade49d99..ae7b80aa260 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/collection-format/src/Generated/CollectionFormatClientSettings.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/collection-format/src/Generated/CollectionFormatClientSettings.cs @@ -9,29 +9,21 @@ namespace Parameters.CollectionFormat { - /// [Experimental("SCME0002")] public partial class CollectionFormatClientSettings : ClientSettings { - /// Gets or sets the Endpoint. - public Uri Endpoint { get; set; } - - /// Gets or sets the Options. - public CollectionFormatClientOptions Options { get; set; } + public Uri Endpoint + { + get => throw null; + set => throw null; + } - /// Binds configuration values from the given section. - /// The configuration section. - protected override void BindCore(IConfigurationSection section) + public CollectionFormatClientOptions Options { - if (Uri.TryCreate(section["Endpoint"], UriKind.Absolute, out Uri endpoint)) - { - Endpoint = endpoint; - } - IConfigurationSection optionsSection = section.GetSection("Options"); - if (optionsSection.Exists()) - { - Options = new CollectionFormatClientOptions(optionsSection); - } + get => throw null; + set => throw null; } + + protected override void BindCore(IConfigurationSection section) => throw null; } } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/collection-format/src/Generated/Header.RestClient.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/collection-format/src/Generated/Header.RestClient.cs deleted file mode 100644 index 76128f9bb8f..00000000000 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/collection-format/src/Generated/Header.RestClient.cs +++ /dev/null @@ -1,33 +0,0 @@ -// - -#nullable disable - -using System.ClientModel.Primitives; -using System.Collections.Generic; -using Parameters.CollectionFormat; - -namespace Parameters.CollectionFormat._Header -{ - /// - public partial class Header - { - private static PipelineMessageClassifier _pipelineMessageClassifier204; - - private static PipelineMessageClassifier PipelineMessageClassifier204 => _pipelineMessageClassifier204 ??= PipelineMessageClassifier.Create(stackalloc ushort[] { 204 }); - - internal PipelineMessage CreateCsvRequest(IEnumerable colors, RequestOptions options) - { - ClientUriBuilder uri = new ClientUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/parameters/collection-format/header/csv", false); - PipelineMessage message = Pipeline.CreateMessage(uri.ToUri(), "GET", PipelineMessageClassifier204); - PipelineRequest request = message.Request; - if (colors != null && !(colors is ChangeTrackingList changeTrackingList && changeTrackingList.IsUndefined)) - { - request.Headers.SetDelimited("colors", colors, ","); - } - message.Apply(options); - return message; - } - } -} diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/collection-format/src/Generated/Header.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/collection-format/src/Generated/Header.cs index 7ca7fd04f98..e29a1876bcd 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/collection-format/src/Generated/Header.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/collection-format/src/Generated/Header.cs @@ -8,96 +8,23 @@ using System.Collections.Generic; using System.Threading; using System.Threading.Tasks; -using Parameters.CollectionFormat; namespace Parameters.CollectionFormat._Header { - /// The Header sub-client. public partial class Header { - private readonly Uri _endpoint; + protected Header() => throw null; - /// Initializes a new instance of Header for mocking. - protected Header() - { - } + internal Header(ClientPipeline pipeline, Uri endpoint) => throw null; - /// Initializes a new instance of Header. - /// The HTTP pipeline for sending and receiving REST requests and responses. - /// Service endpoint. - internal Header(ClientPipeline pipeline, Uri endpoint) - { - _endpoint = endpoint; - Pipeline = pipeline; - } + public ClientPipeline Pipeline => throw null; - /// The HTTP pipeline for sending and receiving REST requests and responses. - public ClientPipeline Pipeline { get; } + public virtual ClientResult Csv(IEnumerable colors, RequestOptions options) => throw null; - /// - /// [Protocol Method] Csv - /// - /// - /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. - /// - /// - /// - /// Possible values for colors are [blue,red,green]. - /// The request options, which can override default behaviors of the client pipeline on a per-call basis. - /// is null. - /// Service returned a non-success status code. - /// The response returned from the service. - public virtual ClientResult Csv(IEnumerable colors, RequestOptions options) - { - Argument.AssertNotNull(colors, nameof(colors)); + public virtual Task CsvAsync(IEnumerable colors, RequestOptions options) => throw null; - using PipelineMessage message = CreateCsvRequest(colors, options); - return ClientResult.FromResponse(Pipeline.ProcessMessage(message, options)); - } + public virtual ClientResult Csv(IEnumerable colors, CancellationToken cancellationToken = default) => throw null; - /// - /// [Protocol Method] Csv - /// - /// - /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. - /// - /// - /// - /// Possible values for colors are [blue,red,green]. - /// The request options, which can override default behaviors of the client pipeline on a per-call basis. - /// is null. - /// Service returned a non-success status code. - /// The response returned from the service. - public virtual async Task CsvAsync(IEnumerable colors, RequestOptions options) - { - Argument.AssertNotNull(colors, nameof(colors)); - - using PipelineMessage message = CreateCsvRequest(colors, options); - return ClientResult.FromResponse(await Pipeline.ProcessMessageAsync(message, options).ConfigureAwait(false)); - } - - /// Csv. - /// Possible values for colors are [blue,red,green]. - /// The cancellation token that can be used to cancel the operation. - /// is null. - /// Service returned a non-success status code. - public virtual ClientResult Csv(IEnumerable colors, CancellationToken cancellationToken = default) - { - Argument.AssertNotNull(colors, nameof(colors)); - - return Csv(colors, cancellationToken.ToRequestOptions()); - } - - /// Csv. - /// Possible values for colors are [blue,red,green]. - /// The cancellation token that can be used to cancel the operation. - /// is null. - /// Service returned a non-success status code. - public virtual async Task CsvAsync(IEnumerable colors, CancellationToken cancellationToken = default) - { - Argument.AssertNotNull(colors, nameof(colors)); - - return await CsvAsync(colors, cancellationToken.ToRequestOptions()).ConfigureAwait(false); - } + public virtual Task CsvAsync(IEnumerable colors, CancellationToken cancellationToken = default) => throw null; } } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/collection-format/src/Generated/Internal/Argument.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/collection-format/src/Generated/Internal/Argument.cs deleted file mode 100644 index 372041ef3bb..00000000000 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/collection-format/src/Generated/Internal/Argument.cs +++ /dev/null @@ -1,110 +0,0 @@ -// - -#nullable disable - -using System; -using System.Collections; -using System.Collections.Generic; - -namespace Parameters.CollectionFormat -{ - internal static partial class Argument - { - /// The value. - /// The name. - public static void AssertNotNull(T value, string name) - { - if (value is null) - { - throw new ArgumentNullException(name); - } - } - - /// The value. - /// The name. - public static void AssertNotNull(T? value, string name) - where T : struct - { - if (!value.HasValue) - { - throw new ArgumentNullException(name); - } - } - - /// The value. - /// The name. - public static void AssertNotNullOrEmpty(IEnumerable value, string name) - { - if (value is null) - { - throw new ArgumentNullException(name); - } - if (value is ICollection collectionOfT && collectionOfT.Count == 0) - { - throw new ArgumentException("Value cannot be an empty collection.", name); - } - if (value is ICollection collection && collection.Count == 0) - { - throw new ArgumentException("Value cannot be an empty collection.", name); - } - using IEnumerator e = value.GetEnumerator(); - if (!e.MoveNext()) - { - throw new ArgumentException("Value cannot be an empty collection.", name); - } - } - - /// The value. - /// The name. - public static void AssertNotNullOrEmpty(string value, string name) - { - if (value is null) - { - throw new ArgumentNullException(name); - } - if (value.Length == 0) - { - throw new ArgumentException("Value cannot be an empty string.", name); - } - } - - /// The value. - /// The name. - public static void AssertNotNullOrWhiteSpace(string value, string name) - { - if (value is null) - { - throw new ArgumentNullException(name); - } - if (string.IsNullOrWhiteSpace(value)) - { - throw new ArgumentException("Value cannot be empty or contain only white-space characters.", name); - } - } - - /// The value. - /// The minimum value. - /// The maximum value. - /// The name. - public static void AssertInRange(T value, T minimum, T maximum, string name) - where T : notnull, IComparable - { - if (minimum.CompareTo(value) > 0) - { - throw new ArgumentOutOfRangeException(name, "Value is less than the minimum allowed."); - } - if (maximum.CompareTo(value) < 0) - { - throw new ArgumentOutOfRangeException(name, "Value is greater than the maximum allowed."); - } - } - - /// The value. - /// The name. - public static string CheckNotNullOrEmpty(string value, string name) - { - AssertNotNullOrEmpty(value, name); - return value; - } - } -} diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/collection-format/src/Generated/Internal/CancellationTokenExtensions.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/collection-format/src/Generated/Internal/CancellationTokenExtensions.cs deleted file mode 100644 index 61fe9a65092..00000000000 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/collection-format/src/Generated/Internal/CancellationTokenExtensions.cs +++ /dev/null @@ -1,14 +0,0 @@ -// - -#nullable disable - -using System.ClientModel.Primitives; -using System.Threading; - -namespace Parameters.CollectionFormat -{ - internal static partial class CancellationTokenExtensions - { - public static RequestOptions ToRequestOptions(this CancellationToken cancellationToken) => cancellationToken.CanBeCanceled ? new RequestOptions { CancellationToken = cancellationToken } : null; - } -} diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/collection-format/src/Generated/Internal/ChangeTrackingList.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/collection-format/src/Generated/Internal/ChangeTrackingList.cs deleted file mode 100644 index cb476372d09..00000000000 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/collection-format/src/Generated/Internal/ChangeTrackingList.cs +++ /dev/null @@ -1,165 +0,0 @@ -// - -#nullable disable - -using System; -using System.Collections; -using System.Collections.Generic; -using System.Linq; - -namespace Parameters.CollectionFormat -{ - internal partial class ChangeTrackingList : IList, IReadOnlyList - { - private IList _innerList; - - public ChangeTrackingList() - { - } - - /// The inner list. - public ChangeTrackingList(IList innerList) - { - if (innerList != null) - { - _innerList = innerList; - } - } - - /// The inner list. - public ChangeTrackingList(IReadOnlyList innerList) - { - if (innerList != null) - { - _innerList = innerList.ToList(); - } - } - - /// Gets the IsUndefined. - public bool IsUndefined => _innerList == null; - - /// Gets the Count. - public int Count => IsUndefined ? 0 : EnsureList().Count; - - /// Gets the IsReadOnly. - public bool IsReadOnly => IsUndefined ? false : EnsureList().IsReadOnly; - - /// Gets or sets the value associated with the specified key. - public T this[int index] - { - get - { - if (IsUndefined) - { - throw new ArgumentOutOfRangeException(nameof(index)); - } - return EnsureList()[index]; - } - set - { - if (IsUndefined) - { - throw new ArgumentOutOfRangeException(nameof(index)); - } - EnsureList()[index] = value; - } - } - - public void Reset() - { - _innerList = null; - } - - public IEnumerator GetEnumerator() - { - if (IsUndefined) - { - IEnumerator enumerateEmpty() - { - yield break; - } - return enumerateEmpty(); - } - return EnsureList().GetEnumerator(); - } - - IEnumerator IEnumerable.GetEnumerator() - { - return GetEnumerator(); - } - - /// The item to add. - public void Add(T item) - { - EnsureList().Add(item); - } - - public void Clear() - { - EnsureList().Clear(); - } - - /// The item. - public bool Contains(T item) - { - if (IsUndefined) - { - return false; - } - return EnsureList().Contains(item); - } - - /// The array to copy to. - /// The array index. - public void CopyTo(T[] array, int arrayIndex) - { - if (IsUndefined) - { - return; - } - EnsureList().CopyTo(array, arrayIndex); - } - - /// The item. - public bool Remove(T item) - { - if (IsUndefined) - { - return false; - } - return EnsureList().Remove(item); - } - - /// The item. - public int IndexOf(T item) - { - if (IsUndefined) - { - return -1; - } - return EnsureList().IndexOf(item); - } - - /// The inner list. - /// The item. - public void Insert(int index, T item) - { - EnsureList().Insert(index, item); - } - - /// The inner list. - public void RemoveAt(int index) - { - if (IsUndefined) - { - throw new ArgumentOutOfRangeException(nameof(index)); - } - EnsureList().RemoveAt(index); - } - - public IList EnsureList() - { - return _innerList ??= new List(); - } - } -} diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/collection-format/src/Generated/Internal/ClientPipelineExtensions.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/collection-format/src/Generated/Internal/ClientPipelineExtensions.cs deleted file mode 100644 index d7c3a3e9661..00000000000 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/collection-format/src/Generated/Internal/ClientPipelineExtensions.cs +++ /dev/null @@ -1,67 +0,0 @@ -// - -#nullable disable - -using System.ClientModel; -using System.ClientModel.Primitives; -using System.Threading.Tasks; - -namespace Parameters.CollectionFormat -{ - internal static partial class ClientPipelineExtensions - { - public static async ValueTask ProcessMessageAsync(this ClientPipeline pipeline, PipelineMessage message, RequestOptions options) - { - await pipeline.SendAsync(message).ConfigureAwait(false); - - if (message.Response.IsError && (options?.ErrorOptions & ClientErrorBehaviors.NoThrow) != ClientErrorBehaviors.NoThrow) - { - throw await ClientResultException.CreateAsync(message.Response).ConfigureAwait(false); - } - - PipelineResponse response = message.BufferResponse ? message.Response : message.ExtractResponse(); - return response; - } - - public static PipelineResponse ProcessMessage(this ClientPipeline pipeline, PipelineMessage message, RequestOptions options) - { - pipeline.Send(message); - - if (message.Response.IsError && (options?.ErrorOptions & ClientErrorBehaviors.NoThrow) != ClientErrorBehaviors.NoThrow) - { - throw new ClientResultException(message.Response); - } - - PipelineResponse response = message.BufferResponse ? message.Response : message.ExtractResponse(); - return response; - } - - public static async ValueTask> ProcessHeadAsBoolMessageAsync(this ClientPipeline pipeline, PipelineMessage message, RequestOptions options) - { - PipelineResponse response = await pipeline.ProcessMessageAsync(message, options).ConfigureAwait(false); - switch (response.Status) - { - case >= 200 and < 300: - return ClientResult.FromValue(true, response); - case >= 400 and < 500: - return ClientResult.FromValue(false, response); - default: - return new ErrorResult(response, new ClientResultException(response)); - } - } - - public static ClientResult ProcessHeadAsBoolMessage(this ClientPipeline pipeline, PipelineMessage message, RequestOptions options) - { - PipelineResponse response = pipeline.ProcessMessage(message, options); - switch (response.Status) - { - case >= 200 and < 300: - return ClientResult.FromValue(true, response); - case >= 400 and < 500: - return ClientResult.FromValue(false, response); - default: - return new ErrorResult(response, new ClientResultException(response)); - } - } - } -} diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/collection-format/src/Generated/Internal/ClientUriBuilder.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/collection-format/src/Generated/Internal/ClientUriBuilder.cs deleted file mode 100644 index 3483a54e490..00000000000 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/collection-format/src/Generated/Internal/ClientUriBuilder.cs +++ /dev/null @@ -1,181 +0,0 @@ -// - -#nullable disable - -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; - -namespace Parameters.CollectionFormat -{ - internal partial class ClientUriBuilder - { - private UriBuilder _uriBuilder; - private StringBuilder _pathAndQuery; - private int _pathLength; - - public ClientUriBuilder() - { - } - - private UriBuilder UriBuilder => _uriBuilder ??= new UriBuilder(); - - private StringBuilder PathAndQuery => _pathAndQuery ??= new StringBuilder(); - - public void Reset(Uri uri) - { - _uriBuilder = new UriBuilder(uri); - PathAndQuery.Clear(); - PathAndQuery.Append(UriBuilder.Path); - _pathLength = PathAndQuery.Length; - PathAndQuery.Append(UriBuilder.Query); - } - - public void AppendPath(string value, bool escape) - { - if (escape) - { - value = Uri.EscapeDataString(value); - } - if (_pathLength > 0 && PathAndQuery[_pathLength - 1] == '/' && value[0] == '/') - { - PathAndQuery.Remove(_pathLength - 1, 1); - _pathLength = _pathLength - 1; - } - PathAndQuery.Insert(_pathLength, value); - _pathLength = _pathLength + value.Length; - } - - public void AppendPath(bool value, bool escape = false) => AppendPath(TypeFormatters.ConvertToString(value), escape); - - public void AppendPath(float value, bool escape = true) => AppendPath(TypeFormatters.ConvertToString(value), escape); - - public void AppendPath(double value, bool escape = true) => AppendPath(TypeFormatters.ConvertToString(value), escape); - - public void AppendPath(int value, bool escape = true) => AppendPath(TypeFormatters.ConvertToString(value), escape); - - public void AppendPath(byte[] value, SerializationFormat format = SerializationFormat.Default, bool escape = true) => AppendPath(TypeFormatters.ConvertToString(value, format), escape); - - public void AppendPath(DateTimeOffset value, SerializationFormat format = SerializationFormat.Default, bool escape = true) => AppendPath(TypeFormatters.ConvertToString(value, format), escape); - - public void AppendPath(TimeSpan value, SerializationFormat format = SerializationFormat.Default, bool escape = true) => AppendPath(TypeFormatters.ConvertToString(value, format), escape); - - public void AppendPath(Guid value, bool escape = true) => AppendPath(TypeFormatters.ConvertToString(value), escape); - - public void AppendPath(long value, bool escape = true) => AppendPath(TypeFormatters.ConvertToString(value), escape); - - public void AppendPathDelimited(IEnumerable value, string delimiter, SerializationFormat format = SerializationFormat.Default, bool escape = true) - { - delimiter ??= ","; - IEnumerable stringValues = value.Select(v => TypeFormatters.ConvertToString(v, format)); - AppendPath(string.Join(delimiter, stringValues), escape); - } - - public void AppendQuery(string name, string value, bool escape) - { - if (PathAndQuery.Length == _pathLength) - { - PathAndQuery.Append('?'); - } - if (PathAndQuery.Length > _pathLength && PathAndQuery[PathAndQuery.Length - 1] != '?') - { - PathAndQuery.Append('&'); - } - if (escape) - { - value = Uri.EscapeDataString(value); - } - PathAndQuery.Append(name); - PathAndQuery.Append('='); - PathAndQuery.Append(value); - } - - public void AppendQuery(string name, bool value, bool escape = false) => AppendQuery(name, TypeFormatters.ConvertToString(value), escape); - - public void AppendQuery(string name, float value, bool escape = true) => AppendQuery(name, TypeFormatters.ConvertToString(value), escape); - - public void AppendQuery(string name, DateTimeOffset value, SerializationFormat format = SerializationFormat.Default, bool escape = true) => AppendQuery(name, TypeFormatters.ConvertToString(value, format), escape); - - public void AppendQuery(string name, TimeSpan value, SerializationFormat format = SerializationFormat.Default, bool escape = true) => AppendQuery(name, TypeFormatters.ConvertToString(value, format), escape); - - public void AppendQuery(string name, double value, bool escape = true) => AppendQuery(name, TypeFormatters.ConvertToString(value), escape); - - public void AppendQuery(string name, decimal value, bool escape = true) => AppendQuery(name, TypeFormatters.ConvertToString(value), escape); - - public void AppendQuery(string name, int value, bool escape = true) => AppendQuery(name, TypeFormatters.ConvertToString(value), escape); - - public void AppendQuery(string name, long value, bool escape = true) => AppendQuery(name, TypeFormatters.ConvertToString(value), escape); - - public void AppendQuery(string name, TimeSpan value, bool escape = true) => AppendQuery(name, TypeFormatters.ConvertToString(value), escape); - - public void AppendQuery(string name, byte[] value, SerializationFormat format = SerializationFormat.Default, bool escape = true) => AppendQuery(name, TypeFormatters.ConvertToString(value, format), escape); - - public void AppendQuery(string name, Guid value, bool escape = true) => AppendQuery(name, TypeFormatters.ConvertToString(value), escape); - - public void AppendQueryDelimited(string name, IEnumerable value, string delimiter, SerializationFormat format = SerializationFormat.Default, bool escape = true) - { - delimiter ??= ","; - IEnumerable stringValues = value.Select(v => TypeFormatters.ConvertToString(v, format)); - AppendQuery(name, string.Join(delimiter, stringValues), escape); - } - - public void UpdateQuery(string name, string value) - { - if (PathAndQuery.Length == _pathLength) - { - AppendQuery(name, value, false); - } - else - { - int queryStartIndex = _pathLength + 1; - string searchPattern = name + "="; - string queryString = PathAndQuery.ToString(queryStartIndex, PathAndQuery.Length - queryStartIndex); - int paramStartIndex = -1; - if (queryString.StartsWith(searchPattern)) - { - paramStartIndex = 0; - } - if (paramStartIndex == -1) - { - int prefixedIndex = queryString.IndexOf("&" + searchPattern); - if (prefixedIndex >= 0) - { - paramStartIndex = prefixedIndex + 1; - } - } - if (paramStartIndex >= 0) - { - int valueStartIndex = paramStartIndex + searchPattern.Length; - int valueEndIndex = queryString.IndexOf('&', valueStartIndex); - if (valueEndIndex == -1) - { - valueEndIndex = queryString.Length; - } - int globalStart = queryStartIndex + valueStartIndex; - int globalEnd = queryStartIndex + valueEndIndex; - PathAndQuery.Remove(globalStart, globalEnd - globalStart); - PathAndQuery.Insert(globalStart, value); - } - else - { - AppendQuery(name, value, false); - } - } - } - - public Uri ToUri() - { - UriBuilder.Path = PathAndQuery.ToString(0, _pathLength); - if (PathAndQuery.Length > _pathLength) - { - UriBuilder.Query = PathAndQuery.ToString(_pathLength + 1, PathAndQuery.Length - _pathLength - 1); - } - if (PathAndQuery.Length == _pathLength) - { - UriBuilder.Query = ""; - } - return UriBuilder.Uri; - } - } -} diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/collection-format/src/Generated/Internal/CodeGenMemberAttribute.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/collection-format/src/Generated/Internal/CodeGenMemberAttribute.cs deleted file mode 100644 index 044dfe314c5..00000000000 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/collection-format/src/Generated/Internal/CodeGenMemberAttribute.cs +++ /dev/null @@ -1,17 +0,0 @@ -// - -#nullable disable - -using System; - -namespace Microsoft.TypeSpec.Generator.Customizations -{ - [AttributeUsage((AttributeTargets.Property | AttributeTargets.Field))] - internal partial class CodeGenMemberAttribute : CodeGenTypeAttribute - { - /// The original name of the member. - public CodeGenMemberAttribute(string originalName) : base(originalName) - { - } - } -} diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/collection-format/src/Generated/Internal/CodeGenSerializationAttribute.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/collection-format/src/Generated/Internal/CodeGenSerializationAttribute.cs deleted file mode 100644 index aedb8b359b8..00000000000 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/collection-format/src/Generated/Internal/CodeGenSerializationAttribute.cs +++ /dev/null @@ -1,45 +0,0 @@ -// - -#nullable disable - -using System; - -namespace Microsoft.TypeSpec.Generator.Customizations -{ - [AttributeUsage((AttributeTargets.Class | AttributeTargets.Struct), AllowMultiple = true, Inherited = true)] - internal partial class CodeGenSerializationAttribute : Attribute - { - /// The property name which these hooks apply to. - public CodeGenSerializationAttribute(string propertyName) - { - PropertyName = propertyName; - } - - /// The property name which these hooks apply to. - /// The serialization name of the property. - public CodeGenSerializationAttribute(string propertyName, string serializationName) - { - PropertyName = propertyName; - SerializationName = serializationName; - } - - /// Gets or sets the property name which these hooks should apply to. - public string PropertyName { get; } - - /// Gets or sets the serialization name of the property. - public string SerializationName { get; set; } - - /// - /// Gets or sets the method name to use when serializing the property value (property name excluded). - /// The signature of the serialization hook method must be or compatible with when invoking: private void SerializeHook(Utf8JsonWriter writer); - /// - public string SerializationValueHook { get; set; } - - /// - /// Gets or sets the method name to use when deserializing the property value from the JSON. - /// private static void DeserializationHook(JsonProperty property, ref TypeOfTheProperty propertyValue); // if the property is required - /// private static void DeserializationHook(JsonProperty property, ref Optional<TypeOfTheProperty> propertyValue); // if the property is optional - /// - public string DeserializationValueHook { get; set; } - } -} diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/collection-format/src/Generated/Internal/CodeGenSuppressAttribute.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/collection-format/src/Generated/Internal/CodeGenSuppressAttribute.cs deleted file mode 100644 index 601ded913ab..00000000000 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/collection-format/src/Generated/Internal/CodeGenSuppressAttribute.cs +++ /dev/null @@ -1,26 +0,0 @@ -// - -#nullable disable - -using System; - -namespace Microsoft.TypeSpec.Generator.Customizations -{ - [AttributeUsage((AttributeTargets.Class | AttributeTargets.Enum | AttributeTargets.Struct), AllowMultiple = true)] - internal partial class CodeGenSuppressAttribute : Attribute - { - /// The member to suppress. - /// The types of the parameters of the member. - public CodeGenSuppressAttribute(string member, params Type[] parameters) - { - Member = member; - Parameters = parameters; - } - - /// Gets the Member. - public string Member { get; } - - /// Gets the Parameters. - public Type[] Parameters { get; } - } -} diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/collection-format/src/Generated/Internal/CodeGenTypeAttribute.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/collection-format/src/Generated/Internal/CodeGenTypeAttribute.cs deleted file mode 100644 index d7b56bdccdf..00000000000 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/collection-format/src/Generated/Internal/CodeGenTypeAttribute.cs +++ /dev/null @@ -1,21 +0,0 @@ -// - -#nullable disable - -using System; - -namespace Microsoft.TypeSpec.Generator.Customizations -{ - [AttributeUsage((AttributeTargets.Class | AttributeTargets.Enum | AttributeTargets.Struct))] - internal partial class CodeGenTypeAttribute : Attribute - { - /// The original name of the type. - public CodeGenTypeAttribute(string originalName) - { - OriginalName = originalName; - } - - /// Gets the OriginalName. - public string OriginalName { get; } - } -} diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/collection-format/src/Generated/Internal/ErrorResult.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/collection-format/src/Generated/Internal/ErrorResult.cs deleted file mode 100644 index 0c834723df0..00000000000 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/collection-format/src/Generated/Internal/ErrorResult.cs +++ /dev/null @@ -1,24 +0,0 @@ -// - -#nullable disable - -using System.ClientModel; -using System.ClientModel.Primitives; - -namespace Parameters.CollectionFormat -{ - internal partial class ErrorResult : ClientResult - { - private readonly PipelineResponse _response; - private readonly ClientResultException _exception; - - public ErrorResult(PipelineResponse response, ClientResultException exception) : base(default, response) - { - _response = response; - _exception = exception; - } - - /// Gets the Value. - public override T Value => throw _exception; - } -} diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/collection-format/src/Generated/Internal/PipelineRequestHeadersExtensions.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/collection-format/src/Generated/Internal/PipelineRequestHeadersExtensions.cs deleted file mode 100644 index a967deea84f..00000000000 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/collection-format/src/Generated/Internal/PipelineRequestHeadersExtensions.cs +++ /dev/null @@ -1,45 +0,0 @@ -// - -#nullable disable - -using System.ClientModel.Primitives; -using System.Collections.Generic; -using System.Linq; - -namespace Parameters.CollectionFormat -{ - internal static partial class PipelineRequestHeadersExtensions - { - /// - /// The name. - /// The value. - /// The delimiter. - public static void SetDelimited(this PipelineRequestHeaders headers, string name, IEnumerable value, string delimiter) - { - IEnumerable stringValues = value.Select(v => TypeFormatters.ConvertToString(v)); - headers.Set(name, string.Join(delimiter, stringValues)); - } - - /// - /// The name. - /// The value. - /// The delimiter. - /// The format. - public static void SetDelimited(this PipelineRequestHeaders headers, string name, IEnumerable value, string delimiter, SerializationFormat format) - { - IEnumerable stringValues = value.Select(v => TypeFormatters.ConvertToString(v, format)); - headers.Set(name, string.Join(delimiter, stringValues)); - } - - /// - /// The prefix to prepend to each header key. - /// The dictionary of headers to add. - public static void Add(this PipelineRequestHeaders headers, string prefix, IDictionary value) - { - foreach (var header in value) - { - headers.Add(prefix + header.Key, header.Value); - } - } - } -} diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/collection-format/src/Generated/Internal/SerializationFormat.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/collection-format/src/Generated/Internal/SerializationFormat.cs deleted file mode 100644 index cfae3ec3f50..00000000000 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/collection-format/src/Generated/Internal/SerializationFormat.cs +++ /dev/null @@ -1,46 +0,0 @@ -// - -#nullable disable - -namespace Parameters.CollectionFormat -{ - internal enum SerializationFormat - { - /// The default serialization format. - Default = 0, - /// The RFC1123 date time format. - DateTime_RFC1123 = 1, - /// The RFC3339 date time format. - DateTime_RFC3339 = 2, - /// The RFC7231 date time format. - DateTime_RFC7231 = 3, - /// The ISO8601 date time format. - DateTime_ISO8601 = 4, - /// The Unix date time format. - DateTime_Unix = 5, - /// The ISO8601 date format. - Date_ISO8601 = 6, - /// The ISO8601 duration format. - Duration_ISO8601 = 7, - /// The constant duration format. - Duration_Constant = 8, - /// The seconds duration format. - Duration_Seconds = 9, - /// The seconds duration format with float precision. - Duration_Seconds_Float = 10, - /// The seconds duration format with double precision. - Duration_Seconds_Double = 11, - /// The milliseconds duration format. - Duration_Milliseconds = 12, - /// The milliseconds duration format with float precision. - Duration_Milliseconds_Float = 13, - /// The milliseconds duration format with double precision. - Duration_Milliseconds_Double = 14, - /// The ISO8601 time format. - Time_ISO8601 = 15, - /// The Base64Url bytes format. - Bytes_Base64Url = 16, - /// The Base64 bytes format. - Bytes_Base64 = 17 - } -} diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/collection-format/src/Generated/Internal/TypeFormatters.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/collection-format/src/Generated/Internal/TypeFormatters.cs deleted file mode 100644 index 4e6e433db70..00000000000 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/collection-format/src/Generated/Internal/TypeFormatters.cs +++ /dev/null @@ -1,178 +0,0 @@ -// - -#nullable disable - -using System; -using System.Collections.Generic; -using System.Globalization; -using System.Xml; - -namespace Parameters.CollectionFormat -{ - internal static partial class TypeFormatters - { - private const string RoundtripZFormat = "yyyy-MM-ddTHH:mm:ss.fffffffZ"; - public const string DefaultNumberFormat = "G"; - - public static string ToString(bool value) => value ? "true" : "false"; - - public static string ToString(DateTime value, string format) => value.Kind switch - { - DateTimeKind.Utc => ToString((DateTimeOffset)value, format), - _ => throw new NotSupportedException($"DateTime {value} has a Kind of {value.Kind}. Generated clients require it to be UTC. You can call DateTime.SpecifyKind to change Kind property value to DateTimeKind.Utc.") - }; - - public static string ToString(DateTimeOffset value, string format) => format switch - { - "D" => value.ToString("yyyy-MM-dd", CultureInfo.InvariantCulture), - "U" => value.ToUnixTimeSeconds().ToString(CultureInfo.InvariantCulture), - "O" => value.ToUniversalTime().ToString(RoundtripZFormat, CultureInfo.InvariantCulture), - "o" => value.ToUniversalTime().ToString(RoundtripZFormat, CultureInfo.InvariantCulture), - "R" => value.ToString("r", CultureInfo.InvariantCulture), - _ => value.ToString(format, CultureInfo.InvariantCulture) - }; - - public static string ToString(TimeSpan value, string format) => format switch - { - "P" => XmlConvert.ToString(value), - _ => value.ToString(format, CultureInfo.InvariantCulture) - }; - - public static string ToString(byte[] value, string format) => format switch - { - "U" => ToBase64UrlString(value), - "D" => Convert.ToBase64String(value), - _ => throw new ArgumentException($"Format is not supported: '{format}'", nameof(format)) - }; - - public static string ToBase64UrlString(byte[] value) - { - int numWholeOrPartialInputBlocks = checked (value.Length + 2) / 3; - int size = checked (numWholeOrPartialInputBlocks * 4); - char[] output = new char[size]; - - int numBase64Chars = Convert.ToBase64CharArray(value, 0, value.Length, output, 0); - - int i = 0; - for (; i < numBase64Chars; i++) - { - char ch = output[i]; - if (ch == '+') - { - output[i] = '-'; - } - else - { - if (ch == '/') - { - output[i] = '_'; - } - else - { - if (ch == '=') - { - break; - } - } - } - } - - return new string(output, 0, i); - } - - public static byte[] FromBase64UrlString(string value) - { - int paddingCharsToAdd = (value.Length % 4) switch - { - 0 => 0, - 2 => 2, - 3 => 1, - _ => throw new InvalidOperationException("Malformed input") - }; - char[] output = new char[(value.Length + paddingCharsToAdd)]; - int i = 0; - for (; i < value.Length; i++) - { - char ch = value[i]; - if (ch == '-') - { - output[i] = '+'; - } - else - { - if (ch == '_') - { - output[i] = '/'; - } - else - { - output[i] = ch; - } - } - } - - for (; i < output.Length; i++) - { - output[i] = '='; - } - - return Convert.FromBase64CharArray(output, 0, output.Length); - } - - public static DateTimeOffset ParseDateTimeOffset(string value, string format) => format switch - { - "U" => DateTimeOffset.FromUnixTimeSeconds(long.Parse(value, CultureInfo.InvariantCulture)), - _ => DateTimeOffset.Parse(value, CultureInfo.InvariantCulture, DateTimeStyles.AssumeUniversal) - }; - - public static TimeSpan ParseTimeSpan(string value, string format) => format switch - { - "P" => XmlConvert.ToTimeSpan(value), - _ => TimeSpan.ParseExact(value, format, CultureInfo.InvariantCulture) - }; - - public static string ToFormatSpecifier(SerializationFormat format) => format switch - { - SerializationFormat.DateTime_RFC1123 => "R", - SerializationFormat.DateTime_RFC3339 => "O", - SerializationFormat.DateTime_RFC7231 => "R", - SerializationFormat.DateTime_ISO8601 => "O", - SerializationFormat.Date_ISO8601 => "D", - SerializationFormat.DateTime_Unix => "U", - SerializationFormat.Bytes_Base64Url => "U", - SerializationFormat.Bytes_Base64 => "D", - SerializationFormat.Duration_ISO8601 => "P", - SerializationFormat.Duration_Constant => "c", - SerializationFormat.Duration_Seconds => "%s", - SerializationFormat.Duration_Seconds_Float => "s\\.FFF", - SerializationFormat.Duration_Seconds_Double => "s\\.FFFFFF", - SerializationFormat.Time_ISO8601 => "T", - _ => null - }; - - public static string ConvertToString(object value, SerializationFormat format = SerializationFormat.Default) - { - string formatSpecifier = ToFormatSpecifier(format); - - return value switch - { - null => "null", - string s => s, - bool b => ToString(b), - int or float or double or long or decimal => ((IFormattable)value).ToString(DefaultNumberFormat, CultureInfo.InvariantCulture), - byte[] b0 when formatSpecifier != null => ToString(b0, formatSpecifier), - IEnumerable s0 => string.Join(",", s0), - DateTimeOffset dateTime when formatSpecifier != null => ToString(dateTime, formatSpecifier), - TimeSpan timeSpan when format == SerializationFormat.Duration_Seconds => Convert.ToInt32(timeSpan.TotalSeconds).ToString(CultureInfo.InvariantCulture), - TimeSpan timeSpan0 when format == SerializationFormat.Duration_Seconds_Float || format == SerializationFormat.Duration_Seconds_Double => timeSpan0.TotalSeconds.ToString(CultureInfo.InvariantCulture), - TimeSpan timeSpan1 when format == SerializationFormat.Duration_Milliseconds => Convert.ToInt32(timeSpan1.TotalMilliseconds).ToString(CultureInfo.InvariantCulture), - TimeSpan timeSpan2 when format == SerializationFormat.Duration_Milliseconds_Float || format == SerializationFormat.Duration_Milliseconds_Double => timeSpan2.TotalMilliseconds.ToString(CultureInfo.InvariantCulture), - TimeSpan timeSpan3 when formatSpecifier != null => ToString(timeSpan3, formatSpecifier), - TimeSpan timeSpan4 => XmlConvert.ToString(timeSpan4), - Guid guid => guid.ToString(), - BinaryData binaryData => ConvertToString(binaryData.ToArray(), format), - _ => value.ToString() - }; - } - } -} diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/collection-format/src/Generated/Models/ParametersCollectionFormatContext.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/collection-format/src/Generated/Models/ParametersCollectionFormatContext.cs index 14f36e4eacf..51eb41ca60a 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/collection-format/src/Generated/Models/ParametersCollectionFormatContext.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/collection-format/src/Generated/Models/ParametersCollectionFormatContext.cs @@ -6,10 +6,6 @@ namespace Parameters.CollectionFormat { - /// - /// Context class which will be filled in by the System.ClientModel.SourceGeneration. - /// For more information - /// public partial class ParametersCollectionFormatContext : ModelReaderWriterContext { } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/collection-format/src/Generated/Query.RestClient.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/collection-format/src/Generated/Query.RestClient.cs deleted file mode 100644 index 49f73f3781e..00000000000 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/collection-format/src/Generated/Query.RestClient.cs +++ /dev/null @@ -1,81 +0,0 @@ -// - -#nullable disable - -using System.ClientModel.Primitives; -using System.Collections.Generic; -using Parameters.CollectionFormat; - -namespace Parameters.CollectionFormat._Query -{ - /// - public partial class Query - { - private static PipelineMessageClassifier _pipelineMessageClassifier204; - - private static PipelineMessageClassifier PipelineMessageClassifier204 => _pipelineMessageClassifier204 ??= PipelineMessageClassifier.Create(stackalloc ushort[] { 204 }); - - internal PipelineMessage CreateMultiRequest(IEnumerable colors, RequestOptions options) - { - ClientUriBuilder uri = new ClientUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/parameters/collection-format/query/multi", false); - if (colors != null && !(colors is ChangeTrackingList changeTrackingList && changeTrackingList.IsUndefined)) - { - foreach (var @param in colors) - { - uri.AppendQuery("colors", @param, true); - } - } - PipelineMessage message = Pipeline.CreateMessage(uri.ToUri(), "GET", PipelineMessageClassifier204); - PipelineRequest request = message.Request; - message.Apply(options); - return message; - } - - internal PipelineMessage CreateSsvRequest(IEnumerable colors, RequestOptions options) - { - ClientUriBuilder uri = new ClientUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/parameters/collection-format/query/ssv", false); - if (colors != null && !(colors is ChangeTrackingList changeTrackingList && changeTrackingList.IsUndefined)) - { - uri.AppendQueryDelimited("colors", colors, " ", escape: true); - } - PipelineMessage message = Pipeline.CreateMessage(uri.ToUri(), "GET", PipelineMessageClassifier204); - PipelineRequest request = message.Request; - message.Apply(options); - return message; - } - - internal PipelineMessage CreatePipesRequest(IEnumerable colors, RequestOptions options) - { - ClientUriBuilder uri = new ClientUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/parameters/collection-format/query/pipes", false); - if (colors != null && !(colors is ChangeTrackingList changeTrackingList && changeTrackingList.IsUndefined)) - { - uri.AppendQueryDelimited("colors", colors, "|", escape: true); - } - PipelineMessage message = Pipeline.CreateMessage(uri.ToUri(), "GET", PipelineMessageClassifier204); - PipelineRequest request = message.Request; - message.Apply(options); - return message; - } - - internal PipelineMessage CreateCsvRequest(IEnumerable colors, RequestOptions options) - { - ClientUriBuilder uri = new ClientUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/parameters/collection-format/query/csv", false); - if (colors != null && !(colors is ChangeTrackingList changeTrackingList && changeTrackingList.IsUndefined)) - { - uri.AppendQueryDelimited("colors", colors, ",", escape: true); - } - PipelineMessage message = Pipeline.CreateMessage(uri.ToUri(), "GET", PipelineMessageClassifier204); - PipelineRequest request = message.Request; - message.Apply(options); - return message; - } - } -} diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/collection-format/src/Generated/Query.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/collection-format/src/Generated/Query.cs index 026fee33cdb..f0d37525882 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/collection-format/src/Generated/Query.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/collection-format/src/Generated/Query.cs @@ -8,294 +8,47 @@ using System.Collections.Generic; using System.Threading; using System.Threading.Tasks; -using Parameters.CollectionFormat; namespace Parameters.CollectionFormat._Query { - /// The Query sub-client. public partial class Query { - private readonly Uri _endpoint; + protected Query() => throw null; - /// Initializes a new instance of Query for mocking. - protected Query() - { - } + internal Query(ClientPipeline pipeline, Uri endpoint) => throw null; - /// Initializes a new instance of Query. - /// The HTTP pipeline for sending and receiving REST requests and responses. - /// Service endpoint. - internal Query(ClientPipeline pipeline, Uri endpoint) - { - _endpoint = endpoint; - Pipeline = pipeline; - } + public ClientPipeline Pipeline => throw null; - /// The HTTP pipeline for sending and receiving REST requests and responses. - public ClientPipeline Pipeline { get; } + public virtual ClientResult Multi(IEnumerable colors, RequestOptions options) => throw null; - /// - /// [Protocol Method] Multi - /// - /// - /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. - /// - /// - /// - /// Possible values for colors are [blue,red,green]. - /// The request options, which can override default behaviors of the client pipeline on a per-call basis. - /// is null. - /// Service returned a non-success status code. - /// The response returned from the service. - public virtual ClientResult Multi(IEnumerable colors, RequestOptions options) - { - Argument.AssertNotNull(colors, nameof(colors)); + public virtual Task MultiAsync(IEnumerable colors, RequestOptions options) => throw null; - using PipelineMessage message = CreateMultiRequest(colors, options); - return ClientResult.FromResponse(Pipeline.ProcessMessage(message, options)); - } + public virtual ClientResult Multi(IEnumerable colors, CancellationToken cancellationToken = default) => throw null; - /// - /// [Protocol Method] Multi - /// - /// - /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. - /// - /// - /// - /// Possible values for colors are [blue,red,green]. - /// The request options, which can override default behaviors of the client pipeline on a per-call basis. - /// is null. - /// Service returned a non-success status code. - /// The response returned from the service. - public virtual async Task MultiAsync(IEnumerable colors, RequestOptions options) - { - Argument.AssertNotNull(colors, nameof(colors)); + public virtual Task MultiAsync(IEnumerable colors, CancellationToken cancellationToken = default) => throw null; - using PipelineMessage message = CreateMultiRequest(colors, options); - return ClientResult.FromResponse(await Pipeline.ProcessMessageAsync(message, options).ConfigureAwait(false)); - } + public virtual ClientResult Ssv(IEnumerable colors, RequestOptions options) => throw null; - /// Multi. - /// Possible values for colors are [blue,red,green]. - /// The cancellation token that can be used to cancel the operation. - /// is null. - /// Service returned a non-success status code. - public virtual ClientResult Multi(IEnumerable colors, CancellationToken cancellationToken = default) - { - Argument.AssertNotNull(colors, nameof(colors)); + public virtual Task SsvAsync(IEnumerable colors, RequestOptions options) => throw null; - return Multi(colors, cancellationToken.ToRequestOptions()); - } + public virtual ClientResult Ssv(IEnumerable colors, CancellationToken cancellationToken = default) => throw null; - /// Multi. - /// Possible values for colors are [blue,red,green]. - /// The cancellation token that can be used to cancel the operation. - /// is null. - /// Service returned a non-success status code. - public virtual async Task MultiAsync(IEnumerable colors, CancellationToken cancellationToken = default) - { - Argument.AssertNotNull(colors, nameof(colors)); + public virtual Task SsvAsync(IEnumerable colors, CancellationToken cancellationToken = default) => throw null; - return await MultiAsync(colors, cancellationToken.ToRequestOptions()).ConfigureAwait(false); - } + public virtual ClientResult Pipes(IEnumerable colors, RequestOptions options) => throw null; - /// - /// [Protocol Method] Ssv - /// - /// - /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. - /// - /// - /// - /// Possible values for colors are [blue,red,green]. - /// The request options, which can override default behaviors of the client pipeline on a per-call basis. - /// is null. - /// Service returned a non-success status code. - /// The response returned from the service. - public virtual ClientResult Ssv(IEnumerable colors, RequestOptions options) - { - Argument.AssertNotNull(colors, nameof(colors)); + public virtual Task PipesAsync(IEnumerable colors, RequestOptions options) => throw null; - using PipelineMessage message = CreateSsvRequest(colors, options); - return ClientResult.FromResponse(Pipeline.ProcessMessage(message, options)); - } + public virtual ClientResult Pipes(IEnumerable colors, CancellationToken cancellationToken = default) => throw null; - /// - /// [Protocol Method] Ssv - /// - /// - /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. - /// - /// - /// - /// Possible values for colors are [blue,red,green]. - /// The request options, which can override default behaviors of the client pipeline on a per-call basis. - /// is null. - /// Service returned a non-success status code. - /// The response returned from the service. - public virtual async Task SsvAsync(IEnumerable colors, RequestOptions options) - { - Argument.AssertNotNull(colors, nameof(colors)); + public virtual Task PipesAsync(IEnumerable colors, CancellationToken cancellationToken = default) => throw null; - using PipelineMessage message = CreateSsvRequest(colors, options); - return ClientResult.FromResponse(await Pipeline.ProcessMessageAsync(message, options).ConfigureAwait(false)); - } + public virtual ClientResult Csv(IEnumerable colors, RequestOptions options) => throw null; - /// Ssv. - /// Possible values for colors are [blue,red,green]. - /// The cancellation token that can be used to cancel the operation. - /// is null. - /// Service returned a non-success status code. - public virtual ClientResult Ssv(IEnumerable colors, CancellationToken cancellationToken = default) - { - Argument.AssertNotNull(colors, nameof(colors)); + public virtual Task CsvAsync(IEnumerable colors, RequestOptions options) => throw null; - return Ssv(colors, cancellationToken.ToRequestOptions()); - } + public virtual ClientResult Csv(IEnumerable colors, CancellationToken cancellationToken = default) => throw null; - /// Ssv. - /// Possible values for colors are [blue,red,green]. - /// The cancellation token that can be used to cancel the operation. - /// is null. - /// Service returned a non-success status code. - public virtual async Task SsvAsync(IEnumerable colors, CancellationToken cancellationToken = default) - { - Argument.AssertNotNull(colors, nameof(colors)); - - return await SsvAsync(colors, cancellationToken.ToRequestOptions()).ConfigureAwait(false); - } - - /// - /// [Protocol Method] Pipes - /// - /// - /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. - /// - /// - /// - /// Possible values for colors are [blue,red,green]. - /// The request options, which can override default behaviors of the client pipeline on a per-call basis. - /// is null. - /// Service returned a non-success status code. - /// The response returned from the service. - public virtual ClientResult Pipes(IEnumerable colors, RequestOptions options) - { - Argument.AssertNotNull(colors, nameof(colors)); - - using PipelineMessage message = CreatePipesRequest(colors, options); - return ClientResult.FromResponse(Pipeline.ProcessMessage(message, options)); - } - - /// - /// [Protocol Method] Pipes - /// - /// - /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. - /// - /// - /// - /// Possible values for colors are [blue,red,green]. - /// The request options, which can override default behaviors of the client pipeline on a per-call basis. - /// is null. - /// Service returned a non-success status code. - /// The response returned from the service. - public virtual async Task PipesAsync(IEnumerable colors, RequestOptions options) - { - Argument.AssertNotNull(colors, nameof(colors)); - - using PipelineMessage message = CreatePipesRequest(colors, options); - return ClientResult.FromResponse(await Pipeline.ProcessMessageAsync(message, options).ConfigureAwait(false)); - } - - /// Pipes. - /// Possible values for colors are [blue,red,green]. - /// The cancellation token that can be used to cancel the operation. - /// is null. - /// Service returned a non-success status code. - public virtual ClientResult Pipes(IEnumerable colors, CancellationToken cancellationToken = default) - { - Argument.AssertNotNull(colors, nameof(colors)); - - return Pipes(colors, cancellationToken.ToRequestOptions()); - } - - /// Pipes. - /// Possible values for colors are [blue,red,green]. - /// The cancellation token that can be used to cancel the operation. - /// is null. - /// Service returned a non-success status code. - public virtual async Task PipesAsync(IEnumerable colors, CancellationToken cancellationToken = default) - { - Argument.AssertNotNull(colors, nameof(colors)); - - return await PipesAsync(colors, cancellationToken.ToRequestOptions()).ConfigureAwait(false); - } - - /// - /// [Protocol Method] Csv - /// - /// - /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. - /// - /// - /// - /// Possible values for colors are [blue,red,green]. - /// The request options, which can override default behaviors of the client pipeline on a per-call basis. - /// is null. - /// Service returned a non-success status code. - /// The response returned from the service. - public virtual ClientResult Csv(IEnumerable colors, RequestOptions options) - { - Argument.AssertNotNull(colors, nameof(colors)); - - using PipelineMessage message = CreateCsvRequest(colors, options); - return ClientResult.FromResponse(Pipeline.ProcessMessage(message, options)); - } - - /// - /// [Protocol Method] Csv - /// - /// - /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. - /// - /// - /// - /// Possible values for colors are [blue,red,green]. - /// The request options, which can override default behaviors of the client pipeline on a per-call basis. - /// is null. - /// Service returned a non-success status code. - /// The response returned from the service. - public virtual async Task CsvAsync(IEnumerable colors, RequestOptions options) - { - Argument.AssertNotNull(colors, nameof(colors)); - - using PipelineMessage message = CreateCsvRequest(colors, options); - return ClientResult.FromResponse(await Pipeline.ProcessMessageAsync(message, options).ConfigureAwait(false)); - } - - /// Csv. - /// Possible values for colors are [blue,red,green]. - /// The cancellation token that can be used to cancel the operation. - /// is null. - /// Service returned a non-success status code. - public virtual ClientResult Csv(IEnumerable colors, CancellationToken cancellationToken = default) - { - Argument.AssertNotNull(colors, nameof(colors)); - - return Csv(colors, cancellationToken.ToRequestOptions()); - } - - /// Csv. - /// Possible values for colors are [blue,red,green]. - /// The cancellation token that can be used to cancel the operation. - /// is null. - /// Service returned a non-success status code. - public virtual async Task CsvAsync(IEnumerable colors, CancellationToken cancellationToken = default) - { - Argument.AssertNotNull(colors, nameof(colors)); - - return await CsvAsync(colors, cancellationToken.ToRequestOptions()).ConfigureAwait(false); - } + public virtual Task CsvAsync(IEnumerable colors, CancellationToken cancellationToken = default) => throw null; } } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/usage/src/Generated/Internal/Argument.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/usage/src/Generated/Internal/Argument.cs deleted file mode 100644 index 2f3abd47bd9..00000000000 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/usage/src/Generated/Internal/Argument.cs +++ /dev/null @@ -1,110 +0,0 @@ -// - -#nullable disable - -using System; -using System.Collections; -using System.Collections.Generic; - -namespace _Type.Model.Usage -{ - internal static partial class Argument - { - /// The value. - /// The name. - public static void AssertNotNull(T value, string name) - { - if (value is null) - { - throw new ArgumentNullException(name); - } - } - - /// The value. - /// The name. - public static void AssertNotNull(T? value, string name) - where T : struct - { - if (!value.HasValue) - { - throw new ArgumentNullException(name); - } - } - - /// The value. - /// The name. - public static void AssertNotNullOrEmpty(IEnumerable value, string name) - { - if (value is null) - { - throw new ArgumentNullException(name); - } - if (value is ICollection collectionOfT && collectionOfT.Count == 0) - { - throw new ArgumentException("Value cannot be an empty collection.", name); - } - if (value is ICollection collection && collection.Count == 0) - { - throw new ArgumentException("Value cannot be an empty collection.", name); - } - using IEnumerator e = value.GetEnumerator(); - if (!e.MoveNext()) - { - throw new ArgumentException("Value cannot be an empty collection.", name); - } - } - - /// The value. - /// The name. - public static void AssertNotNullOrEmpty(string value, string name) - { - if (value is null) - { - throw new ArgumentNullException(name); - } - if (value.Length == 0) - { - throw new ArgumentException("Value cannot be an empty string.", name); - } - } - - /// The value. - /// The name. - public static void AssertNotNullOrWhiteSpace(string value, string name) - { - if (value is null) - { - throw new ArgumentNullException(name); - } - if (string.IsNullOrWhiteSpace(value)) - { - throw new ArgumentException("Value cannot be empty or contain only white-space characters.", name); - } - } - - /// The value. - /// The minimum value. - /// The maximum value. - /// The name. - public static void AssertInRange(T value, T minimum, T maximum, string name) - where T : notnull, IComparable - { - if (minimum.CompareTo(value) > 0) - { - throw new ArgumentOutOfRangeException(name, "Value is less than the minimum allowed."); - } - if (maximum.CompareTo(value) < 0) - { - throw new ArgumentOutOfRangeException(name, "Value is greater than the maximum allowed."); - } - } - - /// The value. - /// The name. - public static string CheckNotNullOrEmpty(string value, string name) - { - AssertNotNullOrEmpty(value, name); - return value; - } - } -} diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/usage/src/Generated/Internal/CancellationTokenExtensions.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/usage/src/Generated/Internal/CancellationTokenExtensions.cs deleted file mode 100644 index 8b42fe0a958..00000000000 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/usage/src/Generated/Internal/CancellationTokenExtensions.cs +++ /dev/null @@ -1,14 +0,0 @@ -// - -#nullable disable - -using System.ClientModel.Primitives; -using System.Threading; - -namespace _Type.Model.Usage -{ - internal static partial class CancellationTokenExtensions - { - public static RequestOptions ToRequestOptions(this CancellationToken cancellationToken) => cancellationToken.CanBeCanceled ? new RequestOptions { CancellationToken = cancellationToken } : null; - } -} diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/usage/src/Generated/Internal/ChangeTrackingDictionary.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/usage/src/Generated/Internal/ChangeTrackingDictionary.cs deleted file mode 100644 index 5480d573b70..00000000000 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/usage/src/Generated/Internal/ChangeTrackingDictionary.cs +++ /dev/null @@ -1,186 +0,0 @@ -// - -#nullable disable - -using System; -using System.Collections; -using System.Collections.Generic; - -namespace _Type.Model.Usage -{ - internal partial class ChangeTrackingDictionary : IDictionary, IReadOnlyDictionary - where TKey : notnull - { - private IDictionary _innerDictionary; - - public ChangeTrackingDictionary() - { - } - - /// The inner dictionary. - public ChangeTrackingDictionary(IDictionary dictionary) - { - if (dictionary == null) - { - return; - } - _innerDictionary = new Dictionary(dictionary); - } - - /// The inner dictionary. - public ChangeTrackingDictionary(IReadOnlyDictionary dictionary) - { - if (dictionary == null) - { - return; - } - _innerDictionary = new Dictionary(); - foreach (var pair in dictionary) - { - _innerDictionary.Add(pair); - } - } - - /// Gets the IsUndefined. - public bool IsUndefined => _innerDictionary == null; - - /// Gets the Count. - public int Count => IsUndefined ? 0 : EnsureDictionary().Count; - - /// Gets the IsReadOnly. - public bool IsReadOnly => IsUndefined ? false : EnsureDictionary().IsReadOnly; - - /// Gets the Keys. - public ICollection Keys => IsUndefined ? Array.Empty() : EnsureDictionary().Keys; - - /// Gets the Values. - public ICollection Values => IsUndefined ? Array.Empty() : EnsureDictionary().Values; - - /// Gets or sets the value associated with the specified key. - public TValue this[TKey key] - { - get - { - if (IsUndefined) - { - throw new KeyNotFoundException(nameof(key)); - } - return EnsureDictionary()[key]; - } - set - { - EnsureDictionary()[key] = value; - } - } - - /// Gets the Keys. - IEnumerable IReadOnlyDictionary.Keys => Keys; - - /// Gets the Values. - IEnumerable IReadOnlyDictionary.Values => Values; - - public IEnumerator> GetEnumerator() - { - if (IsUndefined) - { - IEnumerator> enumerateEmpty() - { - yield break; - } - return enumerateEmpty(); - } - return EnsureDictionary().GetEnumerator(); - } - - IEnumerator IEnumerable.GetEnumerator() - { - return GetEnumerator(); - } - - /// The item to add. - public void Add(KeyValuePair item) - { - EnsureDictionary().Add(item); - } - - public void Clear() - { - EnsureDictionary().Clear(); - } - - /// The item to search for. - public bool Contains(KeyValuePair item) - { - if (IsUndefined) - { - return false; - } - return EnsureDictionary().Contains(item); - } - - /// The array to copy. - /// The index. - public void CopyTo(KeyValuePair[] array, int index) - { - if (IsUndefined) - { - return; - } - EnsureDictionary().CopyTo(array, index); - } - - /// The item to remove. - public bool Remove(KeyValuePair item) - { - if (IsUndefined) - { - return false; - } - return EnsureDictionary().Remove(item); - } - - /// The key. - /// The value to add. - public void Add(TKey key, TValue value) - { - EnsureDictionary().Add(key, value); - } - - /// The key to search for. - public bool ContainsKey(TKey key) - { - if (IsUndefined) - { - return false; - } - return EnsureDictionary().ContainsKey(key); - } - - /// The key. - public bool Remove(TKey key) - { - if (IsUndefined) - { - return false; - } - return EnsureDictionary().Remove(key); - } - - /// The key to search for. - /// The value. - public bool TryGetValue(TKey key, out TValue value) - { - if (IsUndefined) - { - value = default; - return false; - } - return EnsureDictionary().TryGetValue(key, out value); - } - - public IDictionary EnsureDictionary() - { - return _innerDictionary ??= new Dictionary(); - } - } -} diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/usage/src/Generated/Internal/ClientPipelineExtensions.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/usage/src/Generated/Internal/ClientPipelineExtensions.cs deleted file mode 100644 index fdb5a9e7b3c..00000000000 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/usage/src/Generated/Internal/ClientPipelineExtensions.cs +++ /dev/null @@ -1,67 +0,0 @@ -// - -#nullable disable - -using System.ClientModel; -using System.ClientModel.Primitives; -using System.Threading.Tasks; - -namespace _Type.Model.Usage -{ - internal static partial class ClientPipelineExtensions - { - public static async ValueTask ProcessMessageAsync(this ClientPipeline pipeline, PipelineMessage message, RequestOptions options) - { - await pipeline.SendAsync(message).ConfigureAwait(false); - - if (message.Response.IsError && (options?.ErrorOptions & ClientErrorBehaviors.NoThrow) != ClientErrorBehaviors.NoThrow) - { - throw await ClientResultException.CreateAsync(message.Response).ConfigureAwait(false); - } - - PipelineResponse response = message.BufferResponse ? message.Response : message.ExtractResponse(); - return response; - } - - public static PipelineResponse ProcessMessage(this ClientPipeline pipeline, PipelineMessage message, RequestOptions options) - { - pipeline.Send(message); - - if (message.Response.IsError && (options?.ErrorOptions & ClientErrorBehaviors.NoThrow) != ClientErrorBehaviors.NoThrow) - { - throw new ClientResultException(message.Response); - } - - PipelineResponse response = message.BufferResponse ? message.Response : message.ExtractResponse(); - return response; - } - - public static async ValueTask> ProcessHeadAsBoolMessageAsync(this ClientPipeline pipeline, PipelineMessage message, RequestOptions options) - { - PipelineResponse response = await pipeline.ProcessMessageAsync(message, options).ConfigureAwait(false); - switch (response.Status) - { - case >= 200 and < 300: - return ClientResult.FromValue(true, response); - case >= 400 and < 500: - return ClientResult.FromValue(false, response); - default: - return new ErrorResult(response, new ClientResultException(response)); - } - } - - public static ClientResult ProcessHeadAsBoolMessage(this ClientPipeline pipeline, PipelineMessage message, RequestOptions options) - { - PipelineResponse response = pipeline.ProcessMessage(message, options); - switch (response.Status) - { - case >= 200 and < 300: - return ClientResult.FromValue(true, response); - case >= 400 and < 500: - return ClientResult.FromValue(false, response); - default: - return new ErrorResult(response, new ClientResultException(response)); - } - } - } -} diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/usage/src/Generated/Internal/ClientUriBuilder.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/usage/src/Generated/Internal/ClientUriBuilder.cs deleted file mode 100644 index 968cfc1020f..00000000000 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/usage/src/Generated/Internal/ClientUriBuilder.cs +++ /dev/null @@ -1,181 +0,0 @@ -// - -#nullable disable - -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; - -namespace _Type.Model.Usage -{ - internal partial class ClientUriBuilder - { - private UriBuilder _uriBuilder; - private StringBuilder _pathAndQuery; - private int _pathLength; - - public ClientUriBuilder() - { - } - - private UriBuilder UriBuilder => _uriBuilder ??= new UriBuilder(); - - private StringBuilder PathAndQuery => _pathAndQuery ??= new StringBuilder(); - - public void Reset(Uri uri) - { - _uriBuilder = new UriBuilder(uri); - PathAndQuery.Clear(); - PathAndQuery.Append(UriBuilder.Path); - _pathLength = PathAndQuery.Length; - PathAndQuery.Append(UriBuilder.Query); - } - - public void AppendPath(string value, bool escape) - { - if (escape) - { - value = Uri.EscapeDataString(value); - } - if (_pathLength > 0 && PathAndQuery[_pathLength - 1] == '/' && value[0] == '/') - { - PathAndQuery.Remove(_pathLength - 1, 1); - _pathLength = _pathLength - 1; - } - PathAndQuery.Insert(_pathLength, value); - _pathLength = _pathLength + value.Length; - } - - public void AppendPath(bool value, bool escape = false) => AppendPath(TypeFormatters.ConvertToString(value), escape); - - public void AppendPath(float value, bool escape = true) => AppendPath(TypeFormatters.ConvertToString(value), escape); - - public void AppendPath(double value, bool escape = true) => AppendPath(TypeFormatters.ConvertToString(value), escape); - - public void AppendPath(int value, bool escape = true) => AppendPath(TypeFormatters.ConvertToString(value), escape); - - public void AppendPath(byte[] value, SerializationFormat format = SerializationFormat.Default, bool escape = true) => AppendPath(TypeFormatters.ConvertToString(value, format), escape); - - public void AppendPath(DateTimeOffset value, SerializationFormat format = SerializationFormat.Default, bool escape = true) => AppendPath(TypeFormatters.ConvertToString(value, format), escape); - - public void AppendPath(TimeSpan value, SerializationFormat format = SerializationFormat.Default, bool escape = true) => AppendPath(TypeFormatters.ConvertToString(value, format), escape); - - public void AppendPath(Guid value, bool escape = true) => AppendPath(TypeFormatters.ConvertToString(value), escape); - - public void AppendPath(long value, bool escape = true) => AppendPath(TypeFormatters.ConvertToString(value), escape); - - public void AppendPathDelimited(IEnumerable value, string delimiter, SerializationFormat format = SerializationFormat.Default, bool escape = true) - { - delimiter ??= ","; - IEnumerable stringValues = value.Select(v => TypeFormatters.ConvertToString(v, format)); - AppendPath(string.Join(delimiter, stringValues), escape); - } - - public void AppendQuery(string name, string value, bool escape) - { - if (PathAndQuery.Length == _pathLength) - { - PathAndQuery.Append('?'); - } - if (PathAndQuery.Length > _pathLength && PathAndQuery[PathAndQuery.Length - 1] != '?') - { - PathAndQuery.Append('&'); - } - if (escape) - { - value = Uri.EscapeDataString(value); - } - PathAndQuery.Append(name); - PathAndQuery.Append('='); - PathAndQuery.Append(value); - } - - public void AppendQuery(string name, bool value, bool escape = false) => AppendQuery(name, TypeFormatters.ConvertToString(value), escape); - - public void AppendQuery(string name, float value, bool escape = true) => AppendQuery(name, TypeFormatters.ConvertToString(value), escape); - - public void AppendQuery(string name, DateTimeOffset value, SerializationFormat format = SerializationFormat.Default, bool escape = true) => AppendQuery(name, TypeFormatters.ConvertToString(value, format), escape); - - public void AppendQuery(string name, TimeSpan value, SerializationFormat format = SerializationFormat.Default, bool escape = true) => AppendQuery(name, TypeFormatters.ConvertToString(value, format), escape); - - public void AppendQuery(string name, double value, bool escape = true) => AppendQuery(name, TypeFormatters.ConvertToString(value), escape); - - public void AppendQuery(string name, decimal value, bool escape = true) => AppendQuery(name, TypeFormatters.ConvertToString(value), escape); - - public void AppendQuery(string name, int value, bool escape = true) => AppendQuery(name, TypeFormatters.ConvertToString(value), escape); - - public void AppendQuery(string name, long value, bool escape = true) => AppendQuery(name, TypeFormatters.ConvertToString(value), escape); - - public void AppendQuery(string name, TimeSpan value, bool escape = true) => AppendQuery(name, TypeFormatters.ConvertToString(value), escape); - - public void AppendQuery(string name, byte[] value, SerializationFormat format = SerializationFormat.Default, bool escape = true) => AppendQuery(name, TypeFormatters.ConvertToString(value, format), escape); - - public void AppendQuery(string name, Guid value, bool escape = true) => AppendQuery(name, TypeFormatters.ConvertToString(value), escape); - - public void AppendQueryDelimited(string name, IEnumerable value, string delimiter, SerializationFormat format = SerializationFormat.Default, bool escape = true) - { - delimiter ??= ","; - IEnumerable stringValues = value.Select(v => TypeFormatters.ConvertToString(v, format)); - AppendQuery(name, string.Join(delimiter, stringValues), escape); - } - - public void UpdateQuery(string name, string value) - { - if (PathAndQuery.Length == _pathLength) - { - AppendQuery(name, value, false); - } - else - { - int queryStartIndex = _pathLength + 1; - string searchPattern = name + "="; - string queryString = PathAndQuery.ToString(queryStartIndex, PathAndQuery.Length - queryStartIndex); - int paramStartIndex = -1; - if (queryString.StartsWith(searchPattern)) - { - paramStartIndex = 0; - } - if (paramStartIndex == -1) - { - int prefixedIndex = queryString.IndexOf("&" + searchPattern); - if (prefixedIndex >= 0) - { - paramStartIndex = prefixedIndex + 1; - } - } - if (paramStartIndex >= 0) - { - int valueStartIndex = paramStartIndex + searchPattern.Length; - int valueEndIndex = queryString.IndexOf('&', valueStartIndex); - if (valueEndIndex == -1) - { - valueEndIndex = queryString.Length; - } - int globalStart = queryStartIndex + valueStartIndex; - int globalEnd = queryStartIndex + valueEndIndex; - PathAndQuery.Remove(globalStart, globalEnd - globalStart); - PathAndQuery.Insert(globalStart, value); - } - else - { - AppendQuery(name, value, false); - } - } - } - - public Uri ToUri() - { - UriBuilder.Path = PathAndQuery.ToString(0, _pathLength); - if (PathAndQuery.Length > _pathLength) - { - UriBuilder.Query = PathAndQuery.ToString(_pathLength + 1, PathAndQuery.Length - _pathLength - 1); - } - if (PathAndQuery.Length == _pathLength) - { - UriBuilder.Query = ""; - } - return UriBuilder.Uri; - } - } -} diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/usage/src/Generated/Internal/CodeGenMemberAttribute.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/usage/src/Generated/Internal/CodeGenMemberAttribute.cs deleted file mode 100644 index 044dfe314c5..00000000000 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/usage/src/Generated/Internal/CodeGenMemberAttribute.cs +++ /dev/null @@ -1,17 +0,0 @@ -// - -#nullable disable - -using System; - -namespace Microsoft.TypeSpec.Generator.Customizations -{ - [AttributeUsage((AttributeTargets.Property | AttributeTargets.Field))] - internal partial class CodeGenMemberAttribute : CodeGenTypeAttribute - { - /// The original name of the member. - public CodeGenMemberAttribute(string originalName) : base(originalName) - { - } - } -} diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/usage/src/Generated/Internal/CodeGenSerializationAttribute.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/usage/src/Generated/Internal/CodeGenSerializationAttribute.cs deleted file mode 100644 index aedb8b359b8..00000000000 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/usage/src/Generated/Internal/CodeGenSerializationAttribute.cs +++ /dev/null @@ -1,45 +0,0 @@ -// - -#nullable disable - -using System; - -namespace Microsoft.TypeSpec.Generator.Customizations -{ - [AttributeUsage((AttributeTargets.Class | AttributeTargets.Struct), AllowMultiple = true, Inherited = true)] - internal partial class CodeGenSerializationAttribute : Attribute - { - /// The property name which these hooks apply to. - public CodeGenSerializationAttribute(string propertyName) - { - PropertyName = propertyName; - } - - /// The property name which these hooks apply to. - /// The serialization name of the property. - public CodeGenSerializationAttribute(string propertyName, string serializationName) - { - PropertyName = propertyName; - SerializationName = serializationName; - } - - /// Gets or sets the property name which these hooks should apply to. - public string PropertyName { get; } - - /// Gets or sets the serialization name of the property. - public string SerializationName { get; set; } - - /// - /// Gets or sets the method name to use when serializing the property value (property name excluded). - /// The signature of the serialization hook method must be or compatible with when invoking: private void SerializeHook(Utf8JsonWriter writer); - /// - public string SerializationValueHook { get; set; } - - /// - /// Gets or sets the method name to use when deserializing the property value from the JSON. - /// private static void DeserializationHook(JsonProperty property, ref TypeOfTheProperty propertyValue); // if the property is required - /// private static void DeserializationHook(JsonProperty property, ref Optional<TypeOfTheProperty> propertyValue); // if the property is optional - /// - public string DeserializationValueHook { get; set; } - } -} diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/usage/src/Generated/Internal/CodeGenSuppressAttribute.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/usage/src/Generated/Internal/CodeGenSuppressAttribute.cs deleted file mode 100644 index 601ded913ab..00000000000 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/usage/src/Generated/Internal/CodeGenSuppressAttribute.cs +++ /dev/null @@ -1,26 +0,0 @@ -// - -#nullable disable - -using System; - -namespace Microsoft.TypeSpec.Generator.Customizations -{ - [AttributeUsage((AttributeTargets.Class | AttributeTargets.Enum | AttributeTargets.Struct), AllowMultiple = true)] - internal partial class CodeGenSuppressAttribute : Attribute - { - /// The member to suppress. - /// The types of the parameters of the member. - public CodeGenSuppressAttribute(string member, params Type[] parameters) - { - Member = member; - Parameters = parameters; - } - - /// Gets the Member. - public string Member { get; } - - /// Gets the Parameters. - public Type[] Parameters { get; } - } -} diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/usage/src/Generated/Internal/CodeGenTypeAttribute.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/usage/src/Generated/Internal/CodeGenTypeAttribute.cs deleted file mode 100644 index d7b56bdccdf..00000000000 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/usage/src/Generated/Internal/CodeGenTypeAttribute.cs +++ /dev/null @@ -1,21 +0,0 @@ -// - -#nullable disable - -using System; - -namespace Microsoft.TypeSpec.Generator.Customizations -{ - [AttributeUsage((AttributeTargets.Class | AttributeTargets.Enum | AttributeTargets.Struct))] - internal partial class CodeGenTypeAttribute : Attribute - { - /// The original name of the type. - public CodeGenTypeAttribute(string originalName) - { - OriginalName = originalName; - } - - /// Gets the OriginalName. - public string OriginalName { get; } - } -} diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/usage/src/Generated/Internal/ErrorResult.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/usage/src/Generated/Internal/ErrorResult.cs deleted file mode 100644 index 92d71fb1f24..00000000000 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/usage/src/Generated/Internal/ErrorResult.cs +++ /dev/null @@ -1,24 +0,0 @@ -// - -#nullable disable - -using System.ClientModel; -using System.ClientModel.Primitives; - -namespace _Type.Model.Usage -{ - internal partial class ErrorResult : ClientResult - { - private readonly PipelineResponse _response; - private readonly ClientResultException _exception; - - public ErrorResult(PipelineResponse response, ClientResultException exception) : base(default, response) - { - _response = response; - _exception = exception; - } - - /// Gets the Value. - public override T Value => throw _exception; - } -} diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/usage/src/Generated/Internal/ModelSerializationExtensions.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/usage/src/Generated/Internal/ModelSerializationExtensions.cs deleted file mode 100644 index aa9e0733a67..00000000000 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/usage/src/Generated/Internal/ModelSerializationExtensions.cs +++ /dev/null @@ -1,265 +0,0 @@ -// - -#nullable disable - -using System; -using System.ClientModel.Primitives; -using System.Collections.Generic; -using System.Diagnostics; -using System.Globalization; -using System.Runtime.InteropServices; -using System.Text.Json; - -namespace _Type.Model.Usage -{ - internal static partial class ModelSerializationExtensions - { - internal static readonly ModelReaderWriterOptions WireOptions = new ModelReaderWriterOptions("W"); - internal static readonly JsonDocumentOptions JsonDocumentOptions = new JsonDocumentOptions - { - MaxDepth = 256 - }; - - public static object GetObject(this JsonElement element) - { - switch (element.ValueKind) - { - case JsonValueKind.String: - return element.GetString(); - case JsonValueKind.Number: - if (element.TryGetInt32(out int intValue)) - { - return intValue; - } - if (element.TryGetInt64(out long longValue)) - { - return longValue; - } - return element.GetDouble(); - case JsonValueKind.True: - return true; - case JsonValueKind.False: - return false; - case JsonValueKind.Undefined: - case JsonValueKind.Null: - return null; - case JsonValueKind.Object: - Dictionary dictionary = new Dictionary(); - foreach (var jsonProperty in element.EnumerateObject()) - { - dictionary.Add(jsonProperty.Name, jsonProperty.Value.GetObject()); - } - return dictionary; - case JsonValueKind.Array: - List list = new List(); - foreach (var item in element.EnumerateArray()) - { - list.Add(item.GetObject()); - } - return list.ToArray(); - default: - throw new NotSupportedException($"Not supported value kind {element.ValueKind}"); - } - } - - public static byte[] GetBytesFromBase64(this JsonElement element, string format) - { - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - - return format switch - { - "U" => TypeFormatters.FromBase64UrlString(element.GetRequiredString()), - "D" => element.GetBytesFromBase64(), - _ => throw new ArgumentException($"Format is not supported: '{format}'", nameof(format)) - }; - } - - public static DateTimeOffset GetDateTimeOffset(this JsonElement element, string format) => format switch - { - "U" when element.ValueKind == JsonValueKind.Number => DateTimeOffset.FromUnixTimeSeconds(element.GetInt64()), - _ => TypeFormatters.ParseDateTimeOffset(element.GetString(), format) - }; - - public static TimeSpan GetTimeSpan(this JsonElement element, string format) => TypeFormatters.ParseTimeSpan(element.GetString(), format); - - public static char GetChar(this JsonElement element) - { - if (element.ValueKind == JsonValueKind.String) - { - string text = element.GetString(); - if (text == null || text.Length != 1) - { - throw new NotSupportedException($"Cannot convert \"{text}\" to a char"); - } - return text[0]; - } - else - { - throw new NotSupportedException($"Cannot convert {element.ValueKind} to a char"); - } - } - - [Conditional("DEBUG")] - public static void ThrowNonNullablePropertyIsNull(this JsonProperty @property) - { - throw new JsonException($"A property '{@property.Name}' defined as non-nullable but received as null from the service. This exception only happens in DEBUG builds of the library and would be ignored in the release build"); - } - - public static string GetRequiredString(this JsonElement element) - { - string value = element.GetString(); - if (value == null) - { - throw new InvalidOperationException($"The requested operation requires an element of type 'String', but the target element has type '{element.ValueKind}'."); - } - return value; - } - - public static void WriteStringValue(this Utf8JsonWriter writer, DateTimeOffset value, string format) - { - writer.WriteStringValue(TypeFormatters.ToString(value, format)); - } - - public static void WriteStringValue(this Utf8JsonWriter writer, DateTime value, string format) - { - writer.WriteStringValue(TypeFormatters.ToString(value, format)); - } - - public static void WriteStringValue(this Utf8JsonWriter writer, TimeSpan value, string format) - { - writer.WriteStringValue(TypeFormatters.ToString(value, format)); - } - - public static void WriteStringValue(this Utf8JsonWriter writer, char value) - { - writer.WriteStringValue(value.ToString(CultureInfo.InvariantCulture)); - } - - public static void WriteBase64StringValue(this Utf8JsonWriter writer, byte[] value, string format) - { - if (value == null) - { - writer.WriteNullValue(); - return; - } - switch (format) - { - case "U": - writer.WriteStringValue(TypeFormatters.ToBase64UrlString(value)); - break; - case "D": - writer.WriteBase64StringValue(value); - break; - default: - throw new ArgumentException($"Format is not supported: '{format}'", nameof(format)); - } - } - - public static void WriteNumberValue(this Utf8JsonWriter writer, DateTimeOffset value, string format) - { - if (format != "U") - { - throw new ArgumentOutOfRangeException(nameof(format), "Only 'U' format is supported when writing a DateTimeOffset as a Number."); - } - writer.WriteNumberValue(value.ToUnixTimeSeconds()); - } - - public static void WriteObjectValue(this Utf8JsonWriter writer, T value, ModelReaderWriterOptions options = null) - { - switch (value) - { - case null: - writer.WriteNullValue(); - break; - case IJsonModel jsonModel: - jsonModel.Write(writer, options ?? WireOptions); - break; - case byte[] bytes: - writer.WriteBase64StringValue(bytes); - break; - case BinaryData bytes0: - writer.WriteBase64StringValue(bytes0); - break; - case JsonElement json: - json.WriteTo(writer); - break; - case int i: - writer.WriteNumberValue(i); - break; - case decimal d: - writer.WriteNumberValue(d); - break; - case double d0: - if (double.IsNaN(d0)) - { - writer.WriteStringValue("NaN"); - } - else - { - writer.WriteNumberValue(d0); - } - break; - case float f: - writer.WriteNumberValue(f); - break; - case long l: - writer.WriteNumberValue(l); - break; - case string s: - writer.WriteStringValue(s); - break; - case bool b: - writer.WriteBooleanValue(b); - break; - case Guid g: - writer.WriteStringValue(g); - break; - case DateTimeOffset dateTimeOffset: - writer.WriteStringValue(dateTimeOffset, "O"); - break; - case DateTime dateTime: - writer.WriteStringValue(dateTime, "O"); - break; - case IEnumerable> enumerable: - writer.WriteStartObject(); - foreach (var pair in enumerable) - { - writer.WritePropertyName(pair.Key); - writer.WriteObjectValue(pair.Value, options); - } - writer.WriteEndObject(); - break; - case IEnumerable objectEnumerable: - writer.WriteStartArray(); - foreach (var item in objectEnumerable) - { - writer.WriteObjectValue(item, options); - } - writer.WriteEndArray(); - break; - case TimeSpan timeSpan: - writer.WriteStringValue(timeSpan, "P"); - break; - default: - throw new NotSupportedException($"Not supported type {value.GetType()}"); - } - } - - public static void WriteObjectValue(this Utf8JsonWriter writer, object value, ModelReaderWriterOptions options = null) - { - writer.WriteObjectValue(value, options); - } - - public static BinaryData GetUtf8Bytes(this JsonElement element) - { -#if NET9_0_OR_GREATER - return new global::System.BinaryData(global::System.Runtime.InteropServices.JsonMarshal.GetRawUtf8Value(element).ToArray()); -#else - return BinaryData.FromString(element.GetRawText()); -#endif - } - } -} diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/usage/src/Generated/Internal/SerializationFormat.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/usage/src/Generated/Internal/SerializationFormat.cs deleted file mode 100644 index 40afda08aba..00000000000 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/usage/src/Generated/Internal/SerializationFormat.cs +++ /dev/null @@ -1,46 +0,0 @@ -// - -#nullable disable - -namespace _Type.Model.Usage -{ - internal enum SerializationFormat - { - /// The default serialization format. - Default = 0, - /// The RFC1123 date time format. - DateTime_RFC1123 = 1, - /// The RFC3339 date time format. - DateTime_RFC3339 = 2, - /// The RFC7231 date time format. - DateTime_RFC7231 = 3, - /// The ISO8601 date time format. - DateTime_ISO8601 = 4, - /// The Unix date time format. - DateTime_Unix = 5, - /// The ISO8601 date format. - Date_ISO8601 = 6, - /// The ISO8601 duration format. - Duration_ISO8601 = 7, - /// The constant duration format. - Duration_Constant = 8, - /// The seconds duration format. - Duration_Seconds = 9, - /// The seconds duration format with float precision. - Duration_Seconds_Float = 10, - /// The seconds duration format with double precision. - Duration_Seconds_Double = 11, - /// The milliseconds duration format. - Duration_Milliseconds = 12, - /// The milliseconds duration format with float precision. - Duration_Milliseconds_Float = 13, - /// The milliseconds duration format with double precision. - Duration_Milliseconds_Double = 14, - /// The ISO8601 time format. - Time_ISO8601 = 15, - /// The Base64Url bytes format. - Bytes_Base64Url = 16, - /// The Base64 bytes format. - Bytes_Base64 = 17 - } -} diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/usage/src/Generated/Internal/TypeFormatters.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/usage/src/Generated/Internal/TypeFormatters.cs deleted file mode 100644 index 8dbbc318772..00000000000 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/usage/src/Generated/Internal/TypeFormatters.cs +++ /dev/null @@ -1,178 +0,0 @@ -// - -#nullable disable - -using System; -using System.Collections.Generic; -using System.Globalization; -using System.Xml; - -namespace _Type.Model.Usage -{ - internal static partial class TypeFormatters - { - private const string RoundtripZFormat = "yyyy-MM-ddTHH:mm:ss.fffffffZ"; - public const string DefaultNumberFormat = "G"; - - public static string ToString(bool value) => value ? "true" : "false"; - - public static string ToString(DateTime value, string format) => value.Kind switch - { - DateTimeKind.Utc => ToString((DateTimeOffset)value, format), - _ => throw new NotSupportedException($"DateTime {value} has a Kind of {value.Kind}. Generated clients require it to be UTC. You can call DateTime.SpecifyKind to change Kind property value to DateTimeKind.Utc.") - }; - - public static string ToString(DateTimeOffset value, string format) => format switch - { - "D" => value.ToString("yyyy-MM-dd", CultureInfo.InvariantCulture), - "U" => value.ToUnixTimeSeconds().ToString(CultureInfo.InvariantCulture), - "O" => value.ToUniversalTime().ToString(RoundtripZFormat, CultureInfo.InvariantCulture), - "o" => value.ToUniversalTime().ToString(RoundtripZFormat, CultureInfo.InvariantCulture), - "R" => value.ToString("r", CultureInfo.InvariantCulture), - _ => value.ToString(format, CultureInfo.InvariantCulture) - }; - - public static string ToString(TimeSpan value, string format) => format switch - { - "P" => XmlConvert.ToString(value), - _ => value.ToString(format, CultureInfo.InvariantCulture) - }; - - public static string ToString(byte[] value, string format) => format switch - { - "U" => ToBase64UrlString(value), - "D" => Convert.ToBase64String(value), - _ => throw new ArgumentException($"Format is not supported: '{format}'", nameof(format)) - }; - - public static string ToBase64UrlString(byte[] value) - { - int numWholeOrPartialInputBlocks = checked (value.Length + 2) / 3; - int size = checked (numWholeOrPartialInputBlocks * 4); - char[] output = new char[size]; - - int numBase64Chars = Convert.ToBase64CharArray(value, 0, value.Length, output, 0); - - int i = 0; - for (; i < numBase64Chars; i++) - { - char ch = output[i]; - if (ch == '+') - { - output[i] = '-'; - } - else - { - if (ch == '/') - { - output[i] = '_'; - } - else - { - if (ch == '=') - { - break; - } - } - } - } - - return new string(output, 0, i); - } - - public static byte[] FromBase64UrlString(string value) - { - int paddingCharsToAdd = (value.Length % 4) switch - { - 0 => 0, - 2 => 2, - 3 => 1, - _ => throw new InvalidOperationException("Malformed input") - }; - char[] output = new char[(value.Length + paddingCharsToAdd)]; - int i = 0; - for (; i < value.Length; i++) - { - char ch = value[i]; - if (ch == '-') - { - output[i] = '+'; - } - else - { - if (ch == '_') - { - output[i] = '/'; - } - else - { - output[i] = ch; - } - } - } - - for (; i < output.Length; i++) - { - output[i] = '='; - } - - return Convert.FromBase64CharArray(output, 0, output.Length); - } - - public static DateTimeOffset ParseDateTimeOffset(string value, string format) => format switch - { - "U" => DateTimeOffset.FromUnixTimeSeconds(long.Parse(value, CultureInfo.InvariantCulture)), - _ => DateTimeOffset.Parse(value, CultureInfo.InvariantCulture, DateTimeStyles.AssumeUniversal) - }; - - public static TimeSpan ParseTimeSpan(string value, string format) => format switch - { - "P" => XmlConvert.ToTimeSpan(value), - _ => TimeSpan.ParseExact(value, format, CultureInfo.InvariantCulture) - }; - - public static string ToFormatSpecifier(SerializationFormat format) => format switch - { - SerializationFormat.DateTime_RFC1123 => "R", - SerializationFormat.DateTime_RFC3339 => "O", - SerializationFormat.DateTime_RFC7231 => "R", - SerializationFormat.DateTime_ISO8601 => "O", - SerializationFormat.Date_ISO8601 => "D", - SerializationFormat.DateTime_Unix => "U", - SerializationFormat.Bytes_Base64Url => "U", - SerializationFormat.Bytes_Base64 => "D", - SerializationFormat.Duration_ISO8601 => "P", - SerializationFormat.Duration_Constant => "c", - SerializationFormat.Duration_Seconds => "%s", - SerializationFormat.Duration_Seconds_Float => "s\\.FFF", - SerializationFormat.Duration_Seconds_Double => "s\\.FFFFFF", - SerializationFormat.Time_ISO8601 => "T", - _ => null - }; - - public static string ConvertToString(object value, SerializationFormat format = SerializationFormat.Default) - { - string formatSpecifier = ToFormatSpecifier(format); - - return value switch - { - null => "null", - string s => s, - bool b => ToString(b), - int or float or double or long or decimal => ((IFormattable)value).ToString(DefaultNumberFormat, CultureInfo.InvariantCulture), - byte[] b0 when formatSpecifier != null => ToString(b0, formatSpecifier), - IEnumerable s0 => string.Join(",", s0), - DateTimeOffset dateTime when formatSpecifier != null => ToString(dateTime, formatSpecifier), - TimeSpan timeSpan when format == SerializationFormat.Duration_Seconds => Convert.ToInt32(timeSpan.TotalSeconds).ToString(CultureInfo.InvariantCulture), - TimeSpan timeSpan0 when format == SerializationFormat.Duration_Seconds_Float || format == SerializationFormat.Duration_Seconds_Double => timeSpan0.TotalSeconds.ToString(CultureInfo.InvariantCulture), - TimeSpan timeSpan1 when format == SerializationFormat.Duration_Milliseconds => Convert.ToInt32(timeSpan1.TotalMilliseconds).ToString(CultureInfo.InvariantCulture), - TimeSpan timeSpan2 when format == SerializationFormat.Duration_Milliseconds_Float || format == SerializationFormat.Duration_Milliseconds_Double => timeSpan2.TotalMilliseconds.ToString(CultureInfo.InvariantCulture), - TimeSpan timeSpan3 when formatSpecifier != null => ToString(timeSpan3, formatSpecifier), - TimeSpan timeSpan4 => XmlConvert.ToString(timeSpan4), - Guid guid => guid.ToString(), - BinaryData binaryData => ConvertToString(binaryData.ToArray(), format), - _ => value.ToString() - }; - } - } -} diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/usage/src/Generated/Models/InputOutputRecord.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/usage/src/Generated/Models/InputOutputRecord.Serialization.cs index eab0dbb0e8d..f6736632d78 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/usage/src/Generated/Models/InputOutputRecord.Serialization.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/usage/src/Generated/Models/InputOutputRecord.Serialization.cs @@ -5,154 +5,34 @@ using System; using System.ClientModel; using System.ClientModel.Primitives; -using System.Collections.Generic; using System.Text.Json; namespace _Type.Model.Usage { - /// Record used both as operation parameter and return type. public partial class InputOutputRecord : IJsonModel { - /// Initializes a new instance of for deserialization. - internal InputOutputRecord() - { - } + internal InputOutputRecord() => throw null; - /// The data to parse. - /// The client options for reading and writing models. - protected virtual InputOutputRecord PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) - { - string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - switch (format) - { - case "J": - using (JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions)) - { - return DeserializeInputOutputRecord(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(InputOutputRecord)} does not support reading '{options.Format}' format."); - } - } + protected virtual InputOutputRecord PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; - /// The client options for reading and writing models. - protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) - { - string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - switch (format) - { - case "J": - return ModelReaderWriter.Write(this, options, _TypeModelUsageContext.Default); - default: - throw new FormatException($"The model {nameof(InputOutputRecord)} does not support writing '{options.Format}' format."); - } - } + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) => throw null; - /// The client options for reading and writing models. - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => throw null; - /// The data to parse. - /// The client options for reading and writing models. - InputOutputRecord IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + InputOutputRecord IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => throw null; - /// The client options for reading and writing models. - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => throw null; - /// The to serialize into . - public static implicit operator BinaryContent(InputOutputRecord inputOutputRecord) - { - if (inputOutputRecord == null) - { - return null; - } - return BinaryContent.Create(inputOutputRecord, ModelSerializationExtensions.WireOptions); - } + public static implicit operator BinaryContent(InputOutputRecord inputOutputRecord) => throw null; - /// The to deserialize the from. - public static explicit operator InputOutputRecord(ClientResult result) - { - PipelineResponse response = result.GetRawResponse(); - using JsonDocument document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeInputOutputRecord(document.RootElement, ModelSerializationExtensions.WireOptions); - } + public static explicit operator InputOutputRecord(ClientResult result) => throw null; - /// The JSON writer. - /// The client options for reading and writing models. - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - writer.WriteStartObject(); - JsonModelWriteCore(writer, options); - writer.WriteEndObject(); - } + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; - /// The JSON writer. - /// The client options for reading and writing models. - protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(InputOutputRecord)} does not support writing '{format}' format."); - } - writer.WritePropertyName("requiredProp"u8); - writer.WriteStringValue(RequiredProp); - if (options.Format != "W" && _additionalBinaryDataProperties != null) - { - foreach (var item in _additionalBinaryDataProperties) - { - writer.WritePropertyName(item.Key); -#if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); -#else - using (JsonDocument document = JsonDocument.Parse(item.Value)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - } + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; - /// The JSON reader. - /// The client options for reading and writing models. - InputOutputRecord IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + InputOutputRecord IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => throw null; - /// The JSON reader. - /// The client options for reading and writing models. - protected virtual InputOutputRecord JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) - { - string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(InputOutputRecord)} does not support reading '{format}' format."); - } - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeInputOutputRecord(document.RootElement, options); - } - - /// The JSON element to deserialize. - /// The client options for reading and writing models. - internal static InputOutputRecord DeserializeInputOutputRecord(JsonElement element, ModelReaderWriterOptions options) - { - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - string requiredProp = default; - IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); - foreach (var prop in element.EnumerateObject()) - { - if (prop.NameEquals("requiredProp"u8)) - { - requiredProp = prop.Value.GetString(); - continue; - } - if (options.Format != "W") - { - additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); - } - } - return new InputOutputRecord(requiredProp, additionalBinaryDataProperties); - } + protected virtual InputOutputRecord JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => throw null; } } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/usage/src/Generated/Models/InputOutputRecord.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/usage/src/Generated/Models/InputOutputRecord.cs index 26525fd4f43..1aac054f001 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/usage/src/Generated/Models/InputOutputRecord.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/usage/src/Generated/Models/InputOutputRecord.cs @@ -2,37 +2,16 @@ #nullable disable -using System; -using System.Collections.Generic; - namespace _Type.Model.Usage { - /// Record used both as operation parameter and return type. public partial class InputOutputRecord { - /// Keeps track of any properties unknown to the library. - private protected readonly IDictionary _additionalBinaryDataProperties; - - /// Initializes a new instance of . - /// - /// is null. - public InputOutputRecord(string requiredProp) - { - Argument.AssertNotNull(requiredProp, nameof(requiredProp)); + public InputOutputRecord(string requiredProp) => throw null; - RequiredProp = requiredProp; - } - - /// Initializes a new instance of . - /// - /// Keeps track of any properties unknown to the library. - internal InputOutputRecord(string requiredProp, IDictionary additionalBinaryDataProperties) + public string RequiredProp { - RequiredProp = requiredProp; - _additionalBinaryDataProperties = additionalBinaryDataProperties; + get => throw null; + set => throw null; } - - /// Gets or sets the RequiredProp. - public string RequiredProp { get; set; } } } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/usage/src/Generated/Models/InputRecord.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/usage/src/Generated/Models/InputRecord.Serialization.cs index c1199136a38..0f4cc4dbb5d 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/usage/src/Generated/Models/InputRecord.Serialization.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/usage/src/Generated/Models/InputRecord.Serialization.cs @@ -5,146 +5,32 @@ using System; using System.ClientModel; using System.ClientModel.Primitives; -using System.Collections.Generic; using System.Text.Json; namespace _Type.Model.Usage { - /// Record used in operation parameters. public partial class InputRecord : IJsonModel { - /// Initializes a new instance of for deserialization. - internal InputRecord() - { - } + internal InputRecord() => throw null; - /// The data to parse. - /// The client options for reading and writing models. - protected virtual InputRecord PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) - { - string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - switch (format) - { - case "J": - using (JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions)) - { - return DeserializeInputRecord(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(InputRecord)} does not support reading '{options.Format}' format."); - } - } + protected virtual InputRecord PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; - /// The client options for reading and writing models. - protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) - { - string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - switch (format) - { - case "J": - return ModelReaderWriter.Write(this, options, _TypeModelUsageContext.Default); - default: - throw new FormatException($"The model {nameof(InputRecord)} does not support writing '{options.Format}' format."); - } - } + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) => throw null; - /// The client options for reading and writing models. - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => throw null; - /// The data to parse. - /// The client options for reading and writing models. - InputRecord IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + InputRecord IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => throw null; - /// The client options for reading and writing models. - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => throw null; - /// The to serialize into . - public static implicit operator BinaryContent(InputRecord inputRecord) - { - if (inputRecord == null) - { - return null; - } - return BinaryContent.Create(inputRecord, ModelSerializationExtensions.WireOptions); - } + public static implicit operator BinaryContent(InputRecord inputRecord) => throw null; - /// The JSON writer. - /// The client options for reading and writing models. - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - writer.WriteStartObject(); - JsonModelWriteCore(writer, options); - writer.WriteEndObject(); - } + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; - /// The JSON writer. - /// The client options for reading and writing models. - protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(InputRecord)} does not support writing '{format}' format."); - } - writer.WritePropertyName("requiredProp"u8); - writer.WriteStringValue(RequiredProp); - if (options.Format != "W" && _additionalBinaryDataProperties != null) - { - foreach (var item in _additionalBinaryDataProperties) - { - writer.WritePropertyName(item.Key); -#if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); -#else - using (JsonDocument document = JsonDocument.Parse(item.Value)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - } + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; - /// The JSON reader. - /// The client options for reading and writing models. - InputRecord IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + InputRecord IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => throw null; - /// The JSON reader. - /// The client options for reading and writing models. - protected virtual InputRecord JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) - { - string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(InputRecord)} does not support reading '{format}' format."); - } - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeInputRecord(document.RootElement, options); - } - - /// The JSON element to deserialize. - /// The client options for reading and writing models. - internal static InputRecord DeserializeInputRecord(JsonElement element, ModelReaderWriterOptions options) - { - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - string requiredProp = default; - IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); - foreach (var prop in element.EnumerateObject()) - { - if (prop.NameEquals("requiredProp"u8)) - { - requiredProp = prop.Value.GetString(); - continue; - } - if (options.Format != "W") - { - additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); - } - } - return new InputRecord(requiredProp, additionalBinaryDataProperties); - } + protected virtual InputRecord JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => throw null; } } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/usage/src/Generated/Models/InputRecord.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/usage/src/Generated/Models/InputRecord.cs index 9ecd0bcc369..aa1c9d6cd43 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/usage/src/Generated/Models/InputRecord.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/usage/src/Generated/Models/InputRecord.cs @@ -2,37 +2,12 @@ #nullable disable -using System; -using System.Collections.Generic; - namespace _Type.Model.Usage { - /// Record used in operation parameters. public partial class InputRecord { - /// Keeps track of any properties unknown to the library. - private protected readonly IDictionary _additionalBinaryDataProperties; - - /// Initializes a new instance of . - /// - /// is null. - public InputRecord(string requiredProp) - { - Argument.AssertNotNull(requiredProp, nameof(requiredProp)); - - RequiredProp = requiredProp; - } - - /// Initializes a new instance of . - /// - /// Keeps track of any properties unknown to the library. - internal InputRecord(string requiredProp, IDictionary additionalBinaryDataProperties) - { - RequiredProp = requiredProp; - _additionalBinaryDataProperties = additionalBinaryDataProperties; - } + public InputRecord(string requiredProp) => throw null; - /// Gets the RequiredProp. - public string RequiredProp { get; } + public string RequiredProp => throw null; } } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/usage/src/Generated/Models/OutputRecord.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/usage/src/Generated/Models/OutputRecord.Serialization.cs index d4b14ef28d3..5e02f50a12b 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/usage/src/Generated/Models/OutputRecord.Serialization.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/usage/src/Generated/Models/OutputRecord.Serialization.cs @@ -5,144 +5,32 @@ using System; using System.ClientModel; using System.ClientModel.Primitives; -using System.Collections.Generic; using System.Text.Json; namespace _Type.Model.Usage { - /// Record used in operation return type. public partial class OutputRecord : IJsonModel { - /// Initializes a new instance of for deserialization. - internal OutputRecord() - { - } + internal OutputRecord() => throw null; - /// The data to parse. - /// The client options for reading and writing models. - protected virtual OutputRecord PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) - { - string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - switch (format) - { - case "J": - using (JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions)) - { - return DeserializeOutputRecord(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(OutputRecord)} does not support reading '{options.Format}' format."); - } - } + protected virtual OutputRecord PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; - /// The client options for reading and writing models. - protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) - { - string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - switch (format) - { - case "J": - return ModelReaderWriter.Write(this, options, _TypeModelUsageContext.Default); - default: - throw new FormatException($"The model {nameof(OutputRecord)} does not support writing '{options.Format}' format."); - } - } + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) => throw null; - /// The client options for reading and writing models. - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => throw null; - /// The data to parse. - /// The client options for reading and writing models. - OutputRecord IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + OutputRecord IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => throw null; - /// The client options for reading and writing models. - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => throw null; - /// The to deserialize the from. - public static explicit operator OutputRecord(ClientResult result) - { - PipelineResponse response = result.GetRawResponse(); - using JsonDocument document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeOutputRecord(document.RootElement, ModelSerializationExtensions.WireOptions); - } + public static explicit operator OutputRecord(ClientResult result) => throw null; - /// The JSON writer. - /// The client options for reading and writing models. - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - writer.WriteStartObject(); - JsonModelWriteCore(writer, options); - writer.WriteEndObject(); - } + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; - /// The JSON writer. - /// The client options for reading and writing models. - protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(OutputRecord)} does not support writing '{format}' format."); - } - writer.WritePropertyName("requiredProp"u8); - writer.WriteStringValue(RequiredProp); - if (options.Format != "W" && _additionalBinaryDataProperties != null) - { - foreach (var item in _additionalBinaryDataProperties) - { - writer.WritePropertyName(item.Key); -#if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); -#else - using (JsonDocument document = JsonDocument.Parse(item.Value)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - } + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; - /// The JSON reader. - /// The client options for reading and writing models. - OutputRecord IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + OutputRecord IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => throw null; - /// The JSON reader. - /// The client options for reading and writing models. - protected virtual OutputRecord JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) - { - string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(OutputRecord)} does not support reading '{format}' format."); - } - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeOutputRecord(document.RootElement, options); - } - - /// The JSON element to deserialize. - /// The client options for reading and writing models. - internal static OutputRecord DeserializeOutputRecord(JsonElement element, ModelReaderWriterOptions options) - { - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - string requiredProp = default; - IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); - foreach (var prop in element.EnumerateObject()) - { - if (prop.NameEquals("requiredProp"u8)) - { - requiredProp = prop.Value.GetString(); - continue; - } - if (options.Format != "W") - { - additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); - } - } - return new OutputRecord(requiredProp, additionalBinaryDataProperties); - } + protected virtual OutputRecord JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => throw null; } } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/usage/src/Generated/Models/OutputRecord.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/usage/src/Generated/Models/OutputRecord.cs index ce377a68b6e..9da1535e946 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/usage/src/Generated/Models/OutputRecord.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/usage/src/Generated/Models/OutputRecord.cs @@ -2,34 +2,10 @@ #nullable disable -using System; -using System.Collections.Generic; - namespace _Type.Model.Usage { - /// Record used in operation return type. public partial class OutputRecord { - /// Keeps track of any properties unknown to the library. - private protected readonly IDictionary _additionalBinaryDataProperties; - - /// Initializes a new instance of . - /// - internal OutputRecord(string requiredProp) - { - RequiredProp = requiredProp; - } - - /// Initializes a new instance of . - /// - /// Keeps track of any properties unknown to the library. - internal OutputRecord(string requiredProp, IDictionary additionalBinaryDataProperties) - { - RequiredProp = requiredProp; - _additionalBinaryDataProperties = additionalBinaryDataProperties; - } - - /// Gets the RequiredProp. - public string RequiredProp { get; } + public string RequiredProp => throw null; } } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/usage/src/Generated/Models/_TypeModelUsageContext.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/usage/src/Generated/Models/_TypeModelUsageContext.cs index d9cdb266381..ce0a2f8e119 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/usage/src/Generated/Models/_TypeModelUsageContext.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/usage/src/Generated/Models/_TypeModelUsageContext.cs @@ -6,10 +6,6 @@ namespace _Type.Model.Usage { - /// - /// Context class which will be filled in by the System.ClientModel.SourceGeneration. - /// For more information - /// [ModelReaderWriterBuildable(typeof(InputOutputRecord))] [ModelReaderWriterBuildable(typeof(InputRecord))] [ModelReaderWriterBuildable(typeof(OutputRecord))] diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/usage/src/Generated/TypeModelUsageModelFactory.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/usage/src/Generated/TypeModelUsageModelFactory.cs index 523bdb11002..da7f6114d87 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/usage/src/Generated/TypeModelUsageModelFactory.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/usage/src/Generated/TypeModelUsageModelFactory.cs @@ -4,31 +4,12 @@ namespace _Type.Model.Usage { - /// A factory class for creating instances of the models for mocking. public static partial class TypeModelUsageModelFactory { - /// Record used in operation parameters. - /// - /// A new instance for mocking. - public static InputRecord InputRecord(string requiredProp = default) - { - return new InputRecord(requiredProp, additionalBinaryDataProperties: null); - } + public static InputRecord InputRecord(string requiredProp = default) => throw null; - /// Record used in operation return type. - /// - /// A new instance for mocking. - public static OutputRecord OutputRecord(string requiredProp = default) - { - return new OutputRecord(requiredProp, additionalBinaryDataProperties: null); - } + public static OutputRecord OutputRecord(string requiredProp = default) => throw null; - /// Record used both as operation parameter and return type. - /// - /// A new instance for mocking. - public static InputOutputRecord InputOutputRecord(string requiredProp = default) - { - return new InputOutputRecord(requiredProp, additionalBinaryDataProperties: null); - } + public static InputOutputRecord InputOutputRecord(string requiredProp = default) => throw null; } } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/usage/src/Generated/UsageClient.RestClient.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/usage/src/Generated/UsageClient.RestClient.cs deleted file mode 100644 index c0288ab208d..00000000000 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/usage/src/Generated/UsageClient.RestClient.cs +++ /dev/null @@ -1,59 +0,0 @@ -// - -#nullable disable - -using System.ClientModel; -using System.ClientModel.Primitives; - -namespace _Type.Model.Usage -{ - /// - public partial class UsageClient - { - private static PipelineMessageClassifier _pipelineMessageClassifier200; - private static PipelineMessageClassifier _pipelineMessageClassifier204; - - private static PipelineMessageClassifier PipelineMessageClassifier200 => _pipelineMessageClassifier200 ??= PipelineMessageClassifier.Create(stackalloc ushort[] { 200 }); - - private static PipelineMessageClassifier PipelineMessageClassifier204 => _pipelineMessageClassifier204 ??= PipelineMessageClassifier.Create(stackalloc ushort[] { 204 }); - - internal PipelineMessage CreateInputRequest(BinaryContent content, RequestOptions options) - { - ClientUriBuilder uri = new ClientUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/type/model/usage/input", false); - PipelineMessage message = Pipeline.CreateMessage(uri.ToUri(), "POST", PipelineMessageClassifier204); - PipelineRequest request = message.Request; - request.Headers.Set("Content-Type", "application/json"); - request.Content = content; - message.Apply(options); - return message; - } - - internal PipelineMessage CreateOutputRequest(RequestOptions options) - { - ClientUriBuilder uri = new ClientUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/type/model/usage/output", false); - PipelineMessage message = Pipeline.CreateMessage(uri.ToUri(), "GET", PipelineMessageClassifier200); - PipelineRequest request = message.Request; - request.Headers.Set("Accept", "application/json"); - message.Apply(options); - return message; - } - - internal PipelineMessage CreateInputAndOutputRequest(BinaryContent content, RequestOptions options) - { - ClientUriBuilder uri = new ClientUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/type/model/usage/input-output", false); - PipelineMessage message = Pipeline.CreateMessage(uri.ToUri(), "POST", PipelineMessageClassifier200); - PipelineRequest request = message.Request; - request.Headers.Set("Content-Type", "application/json"); - request.Headers.Set("Accept", "application/json"); - request.Content = content; - message.Apply(options); - return message; - } - } -} diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/usage/src/Generated/UsageClient.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/usage/src/Generated/UsageClient.cs index 87ce8638faf..b1571ae1df5 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/usage/src/Generated/UsageClient.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/usage/src/Generated/UsageClient.cs @@ -11,230 +11,41 @@ namespace _Type.Model.Usage { - /// Illustrates usage of Record in different places(Operation parameters, return type or both). public partial class UsageClient { - private readonly Uri _endpoint; - - /// Initializes a new instance of UsageClient. - public UsageClient() : this(new Uri("http://localhost:3000"), new UsageClientOptions()) - { - } - - /// Initializes a new instance of UsageClient. - /// The authentication policy to use for pipeline creation. - /// Service endpoint. - /// The options for configuring the client. - internal UsageClient(AuthenticationPolicy authenticationPolicy, Uri endpoint, UsageClientOptions options) - { - options ??= new UsageClientOptions(); - - _endpoint = endpoint; - Pipeline = ClientPipeline.Create(options, Array.Empty(), new PipelinePolicy[] { new UserAgentPolicy(typeof(UsageClient).Assembly) }, Array.Empty()); - } - - /// Initializes a new instance of UsageClient. - /// Service endpoint. - /// The options for configuring the client. - /// is null. - public UsageClient(Uri endpoint, UsageClientOptions options) : this(null, endpoint, options) - { - } - - /// Initializes a new instance of UsageClient from settings. - /// The settings for UsageClient. + public UsageClient() : this(new Uri("http://localhost:3000"), new UsageClientOptions()) => throw null; + + internal UsageClient(AuthenticationPolicy authenticationPolicy, Uri endpoint, UsageClientOptions options) => throw null; + + public UsageClient(Uri endpoint, UsageClientOptions options) : this(null, endpoint, options) => throw null; + [Experimental("SCME0002")] - public UsageClient(UsageClientSettings settings) : this(AuthenticationPolicy.Create(settings), settings?.Endpoint, settings?.Options) - { - } - - /// The HTTP pipeline for sending and receiving REST requests and responses. - public ClientPipeline Pipeline { get; } - - /// - /// [Protocol Method] Input - /// - /// - /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. - /// - /// - /// - /// The content to send as the body of the request. - /// The request options, which can override default behaviors of the client pipeline on a per-call basis. - /// is null. - /// Service returned a non-success status code. - /// The response returned from the service. - public virtual ClientResult Input(BinaryContent content, RequestOptions options = null) - { - Argument.AssertNotNull(content, nameof(content)); - - using PipelineMessage message = CreateInputRequest(content, options); - return ClientResult.FromResponse(Pipeline.ProcessMessage(message, options)); - } - - /// - /// [Protocol Method] Input - /// - /// - /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. - /// - /// - /// - /// The content to send as the body of the request. - /// The request options, which can override default behaviors of the client pipeline on a per-call basis. - /// is null. - /// Service returned a non-success status code. - /// The response returned from the service. - public virtual async Task InputAsync(BinaryContent content, RequestOptions options = null) - { - Argument.AssertNotNull(content, nameof(content)); - - using PipelineMessage message = CreateInputRequest(content, options); - return ClientResult.FromResponse(await Pipeline.ProcessMessageAsync(message, options).ConfigureAwait(false)); - } - - /// Input. - /// - /// The cancellation token that can be used to cancel the operation. - /// is null. - /// Service returned a non-success status code. - public virtual ClientResult Input(InputRecord input, CancellationToken cancellationToken = default) - { - Argument.AssertNotNull(input, nameof(input)); - - return Input(input, cancellationToken.ToRequestOptions()); - } - - /// Input. - /// - /// The cancellation token that can be used to cancel the operation. - /// is null. - /// Service returned a non-success status code. - public virtual async Task InputAsync(InputRecord input, CancellationToken cancellationToken = default) - { - Argument.AssertNotNull(input, nameof(input)); - - return await InputAsync(input, cancellationToken.ToRequestOptions()).ConfigureAwait(false); - } - - /// - /// [Protocol Method] Output - /// - /// - /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. - /// - /// - /// - /// The request options, which can override default behaviors of the client pipeline on a per-call basis. - /// Service returned a non-success status code. - /// The response returned from the service. - public virtual ClientResult Output(RequestOptions options) - { - using PipelineMessage message = CreateOutputRequest(options); - return ClientResult.FromResponse(Pipeline.ProcessMessage(message, options)); - } - - /// - /// [Protocol Method] Output - /// - /// - /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. - /// - /// - /// - /// The request options, which can override default behaviors of the client pipeline on a per-call basis. - /// Service returned a non-success status code. - /// The response returned from the service. - public virtual async Task OutputAsync(RequestOptions options) - { - using PipelineMessage message = CreateOutputRequest(options); - return ClientResult.FromResponse(await Pipeline.ProcessMessageAsync(message, options).ConfigureAwait(false)); - } - - /// Output. - /// The cancellation token that can be used to cancel the operation. - /// Service returned a non-success status code. - public virtual ClientResult Output(CancellationToken cancellationToken = default) - { - ClientResult result = Output(cancellationToken.ToRequestOptions()); - return ClientResult.FromValue((OutputRecord)result, result.GetRawResponse()); - } - - /// Output. - /// The cancellation token that can be used to cancel the operation. - /// Service returned a non-success status code. - public virtual async Task> OutputAsync(CancellationToken cancellationToken = default) - { - ClientResult result = await OutputAsync(cancellationToken.ToRequestOptions()).ConfigureAwait(false); - return ClientResult.FromValue((OutputRecord)result, result.GetRawResponse()); - } - - /// - /// [Protocol Method] InputAndOutput - /// - /// - /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. - /// - /// - /// - /// The content to send as the body of the request. - /// The request options, which can override default behaviors of the client pipeline on a per-call basis. - /// is null. - /// Service returned a non-success status code. - /// The response returned from the service. - public virtual ClientResult InputAndOutput(BinaryContent content, RequestOptions options = null) - { - Argument.AssertNotNull(content, nameof(content)); - - using PipelineMessage message = CreateInputAndOutputRequest(content, options); - return ClientResult.FromResponse(Pipeline.ProcessMessage(message, options)); - } - - /// - /// [Protocol Method] InputAndOutput - /// - /// - /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. - /// - /// - /// - /// The content to send as the body of the request. - /// The request options, which can override default behaviors of the client pipeline on a per-call basis. - /// is null. - /// Service returned a non-success status code. - /// The response returned from the service. - public virtual async Task InputAndOutputAsync(BinaryContent content, RequestOptions options = null) - { - Argument.AssertNotNull(content, nameof(content)); - - using PipelineMessage message = CreateInputAndOutputRequest(content, options); - return ClientResult.FromResponse(await Pipeline.ProcessMessageAsync(message, options).ConfigureAwait(false)); - } - - /// InputAndOutput. - /// - /// The cancellation token that can be used to cancel the operation. - /// is null. - /// Service returned a non-success status code. - public virtual ClientResult InputAndOutput(InputOutputRecord body, CancellationToken cancellationToken = default) - { - Argument.AssertNotNull(body, nameof(body)); - - ClientResult result = InputAndOutput(body, cancellationToken.ToRequestOptions()); - return ClientResult.FromValue((InputOutputRecord)result, result.GetRawResponse()); - } - - /// InputAndOutput. - /// - /// The cancellation token that can be used to cancel the operation. - /// is null. - /// Service returned a non-success status code. - public virtual async Task> InputAndOutputAsync(InputOutputRecord body, CancellationToken cancellationToken = default) - { - Argument.AssertNotNull(body, nameof(body)); - - ClientResult result = await InputAndOutputAsync(body, cancellationToken.ToRequestOptions()).ConfigureAwait(false); - return ClientResult.FromValue((InputOutputRecord)result, result.GetRawResponse()); - } + public UsageClient(UsageClientSettings settings) : this(AuthenticationPolicy.Create(settings), settings?.Endpoint, settings?.Options) => throw null; + + public ClientPipeline Pipeline => throw null; + + public virtual ClientResult Input(BinaryContent content, RequestOptions options = null) => throw null; + + public virtual Task InputAsync(BinaryContent content, RequestOptions options = null) => throw null; + + public virtual ClientResult Input(InputRecord input, CancellationToken cancellationToken = default) => throw null; + + public virtual Task InputAsync(InputRecord input, CancellationToken cancellationToken = default) => throw null; + + public virtual ClientResult Output(RequestOptions options) => throw null; + + public virtual Task OutputAsync(RequestOptions options) => throw null; + + public virtual ClientResult Output(CancellationToken cancellationToken = default) => throw null; + + public virtual Task> OutputAsync(CancellationToken cancellationToken = default) => throw null; + + public virtual ClientResult InputAndOutput(BinaryContent content, RequestOptions options = null) => throw null; + + public virtual Task InputAndOutputAsync(BinaryContent content, RequestOptions options = null) => throw null; + + public virtual ClientResult InputAndOutput(InputOutputRecord body, CancellationToken cancellationToken = default) => throw null; + + public virtual Task> InputAndOutputAsync(InputOutputRecord body, CancellationToken cancellationToken = default) => throw null; } } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/usage/src/Generated/UsageClientOptions.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/usage/src/Generated/UsageClientOptions.cs index dc39c6c81bf..d5df51bba00 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/usage/src/Generated/UsageClientOptions.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/usage/src/Generated/UsageClientOptions.cs @@ -8,23 +8,11 @@ namespace _Type.Model.Usage { - /// Client options for . public partial class UsageClientOptions : ClientPipelineOptions { - /// Initializes a new instance of UsageClientOptions. - public UsageClientOptions() - { - } + public UsageClientOptions() => throw null; - /// Initializes a new instance of UsageClientOptions from configuration. - /// The configuration section. [Experimental("SCME0002")] - internal UsageClientOptions(IConfigurationSection section) : base(section) - { - if (section is null || !section.Exists()) - { - return; - } - } + internal UsageClientOptions(IConfigurationSection section) : base(section) => throw null; } } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/usage/src/Generated/UsageClientSettings.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/usage/src/Generated/UsageClientSettings.cs index 1df71610c39..1d813163af2 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/usage/src/Generated/UsageClientSettings.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/usage/src/Generated/UsageClientSettings.cs @@ -9,29 +9,21 @@ namespace _Type.Model.Usage { - /// [Experimental("SCME0002")] public partial class UsageClientSettings : ClientSettings { - /// Gets or sets the Endpoint. - public Uri Endpoint { get; set; } - - /// Gets or sets the Options. - public UsageClientOptions Options { get; set; } + public Uri Endpoint + { + get => throw null; + set => throw null; + } - /// Binds configuration values from the given section. - /// The configuration section. - protected override void BindCore(IConfigurationSection section) + public UsageClientOptions Options { - if (Uri.TryCreate(section["Endpoint"], UriKind.Absolute, out Uri endpoint)) - { - Endpoint = endpoint; - } - IConfigurationSection optionsSection = section.GetSection("Options"); - if (optionsSection.Exists()) - { - Options = new UsageClientOptions(optionsSection); - } + get => throw null; + set => throw null; } + + protected override void BindCore(IConfigurationSection section) => throw null; } } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/madeOptional/v1/src/Generated/MadeOptionalClient.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/madeOptional/v1/src/Generated/MadeOptionalClient.cs new file mode 100644 index 00000000000..d78e1fe494b --- /dev/null +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/madeOptional/v1/src/Generated/MadeOptionalClient.cs @@ -0,0 +1,37 @@ +// + +#nullable disable + +using System; +using System.ClientModel; +using System.ClientModel.Primitives; +using System.Diagnostics.CodeAnalysis; +using System.Threading; +using System.Threading.Tasks; + +namespace Versioning.MadeOptional +{ + public partial class MadeOptionalClient + { + protected MadeOptionalClient() => throw null; + + public MadeOptionalClient(Uri endpoint) : this(endpoint, new MadeOptionalClientOptions()) => throw null; + + internal MadeOptionalClient(AuthenticationPolicy authenticationPolicy, Uri endpoint, MadeOptionalClientOptions options) => throw null; + + public MadeOptionalClient(Uri endpoint, MadeOptionalClientOptions options) : this(null, endpoint, options) => throw null; + + [Experimental("SCME0002")] + public MadeOptionalClient(MadeOptionalClientSettings settings) : this(AuthenticationPolicy.Create(settings), settings?.Endpoint, settings?.Options) => throw null; + + public ClientPipeline Pipeline => throw null; + + public virtual ClientResult Test(string @param, BinaryContent content, RequestOptions options = null) => throw null; + + public virtual Task TestAsync(string @param, BinaryContent content, RequestOptions options = null) => throw null; + + public virtual ClientResult Test(string @param, TestModel body, CancellationToken cancellationToken = default) => throw null; + + public virtual Task> TestAsync(string @param, TestModel body, CancellationToken cancellationToken = default) => throw null; + } +} diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/madeOptional/v1/src/Generated/MadeOptionalClientOptions.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/madeOptional/v1/src/Generated/MadeOptionalClientOptions.cs new file mode 100644 index 00000000000..d26fc936f07 --- /dev/null +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/madeOptional/v1/src/Generated/MadeOptionalClientOptions.cs @@ -0,0 +1,26 @@ +// + +#nullable disable + +using System.ClientModel.Primitives; +using System.Diagnostics.CodeAnalysis; +using Microsoft.Extensions.Configuration; + +namespace Versioning.MadeOptional +{ + public partial class MadeOptionalClientOptions : ClientPipelineOptions + { + private const ServiceVersion LatestVersion = ServiceVersion.V1; + + public MadeOptionalClientOptions(ServiceVersion version = LatestVersion) => throw null; + + [Experimental("SCME0002")] + internal MadeOptionalClientOptions(IConfigurationSection section) : base(section) => throw null; + + public enum ServiceVersion + { + /// The version v1. + V1 = 1 + } + } +} diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/madeOptional/v1/src/Generated/MadeOptionalClientSettings.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/madeOptional/v1/src/Generated/MadeOptionalClientSettings.cs new file mode 100644 index 00000000000..4773765707d --- /dev/null +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/madeOptional/v1/src/Generated/MadeOptionalClientSettings.cs @@ -0,0 +1,29 @@ +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Diagnostics.CodeAnalysis; +using Microsoft.Extensions.Configuration; + +namespace Versioning.MadeOptional +{ + [Experimental("SCME0002")] + public partial class MadeOptionalClientSettings : ClientSettings + { + public Uri Endpoint + { + get => throw null; + set => throw null; + } + + public MadeOptionalClientOptions Options + { + get => throw null; + set => throw null; + } + + protected override void BindCore(IConfigurationSection section) => throw null; + } +} diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/madeOptional/v1/src/Generated/Models/TestModel.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/madeOptional/v1/src/Generated/Models/TestModel.Serialization.cs new file mode 100644 index 00000000000..331346c4851 --- /dev/null +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/madeOptional/v1/src/Generated/Models/TestModel.Serialization.cs @@ -0,0 +1,38 @@ +// + +#nullable disable + +using System; +using System.ClientModel; +using System.ClientModel.Primitives; +using System.Text.Json; + +namespace Versioning.MadeOptional +{ + public partial class TestModel : IJsonModel + { + internal TestModel() => throw null; + + protected virtual TestModel PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; + + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) => throw null; + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => throw null; + + TestModel IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => throw null; + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => throw null; + + public static implicit operator BinaryContent(TestModel testModel) => throw null; + + public static explicit operator TestModel(ClientResult result) => throw null; + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; + + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; + + TestModel IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => throw null; + + protected virtual TestModel JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => throw null; + } +} diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/madeOptional/v1/src/Generated/Models/TestModel.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/madeOptional/v1/src/Generated/Models/TestModel.cs new file mode 100644 index 00000000000..eca2fc80f1d --- /dev/null +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/madeOptional/v1/src/Generated/Models/TestModel.cs @@ -0,0 +1,23 @@ +// + +#nullable disable + +namespace Versioning.MadeOptional +{ + public partial class TestModel + { + public TestModel(string prop, string changedProp) => throw null; + + public string Prop + { + get => throw null; + set => throw null; + } + + public string ChangedProp + { + get => throw null; + set => throw null; + } + } +} diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/madeOptional/v1/src/Generated/Models/VersioningMadeOptionalV1Context.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/madeOptional/v1/src/Generated/Models/VersioningMadeOptionalV1Context.cs new file mode 100644 index 00000000000..7c7a9e4744b --- /dev/null +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/madeOptional/v1/src/Generated/Models/VersioningMadeOptionalV1Context.cs @@ -0,0 +1,14 @@ +// + +#nullable disable + +using System.ClientModel.Primitives; +using Versioning.MadeOptional; + +namespace Versioning.MadeOptional.V1 +{ + [ModelReaderWriterBuildable(typeof(TestModel))] + public partial class VersioningMadeOptionalV1Context : ModelReaderWriterContext + { + } +} diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/madeOptional/v1/src/Generated/VersioningMadeOptionalV1ModelFactory.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/madeOptional/v1/src/Generated/VersioningMadeOptionalV1ModelFactory.cs new file mode 100644 index 00000000000..9b1ab90857d --- /dev/null +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/madeOptional/v1/src/Generated/VersioningMadeOptionalV1ModelFactory.cs @@ -0,0 +1,13 @@ +// + +#nullable disable + +using Versioning.MadeOptional; + +namespace Versioning.MadeOptional.V1 +{ + public static partial class VersioningMadeOptionalV1ModelFactory + { + public static TestModel TestModel(string prop = default, string changedProp = default) => throw null; + } +} From eea73ec45e8db499f9290ff18368770fd0a2c0e4 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 11 Mar 2026 19:28:38 +0000 Subject: [PATCH 18/38] fix: add parameter validation assertions to internal implementation constructor The internal implementation constructor is now the sole constructor with a body, but MethodProviderHelpers.ShouldSkipParameterValidation() skips assertions for non-public methods. Added explicit validation in BuildPrimaryConstructorBody() to ensure Argument.AssertNotNull/AssertNotNullOrEmpty are generated for parameters that require them. Updated all 16 affected TestData files. Co-authored-by: JoshLove-msft <54595583+JoshLove-msft@users.noreply.github.com> --- .../src/Providers/ClientProvider.cs | 28 +- ...tiServiceClient_GeneratesExpectedClient.cs | 3 + ...thThreeServices_GeneratesExpectedClient.cs | 3 + ...eCombinedClient_GeneratesExpectedClient.cs | 2 + ...thThreeServices_GeneratesExpectedClient.cs | 2 + ...yConstructor(WithDefault,False,False,0).cs | 2 + ...ryConstructor(WithDefault,False,True,0).cs | 2 + ...ryConstructor(WithDefault,True,False,0).cs | 2 + ...aryConstructor(WithDefault,True,True,0).cs | 2 + ...aryConstructor(WithDefault,True,True,1).cs | 2 + ...Constructor(WithRequired,False,False,0).cs | 2 + ...yConstructor(WithRequired,False,True,0).cs | 2 + ...yConstructor(WithRequired,True,False,0).cs | 2 + ...ryConstructor(WithRequired,True,True,0).cs | 2 + ...ryConstructor(WithRequired,True,True,1).cs | 2 + ...ValidateConstructorsWhenUnsupportedAuth.cs | 2 + .../ClientProviderTests/XmlDocsAreWritten.cs | 3 + .../BodyOptionalityClient.RestClient.cs | 43 +++ .../src/Generated/BodyOptionalityClient.cs | 208 ++++++++++++-- .../Generated/BodyOptionalityClientOptions.cs | 16 +- .../BodyOptionalityClientSettings.cs | 28 +- .../src/Generated/Internal/Argument.cs | 110 ++++++++ .../Internal/CancellationTokenExtensions.cs | 14 + .../Internal/ChangeTrackingDictionary.cs | 186 ++++++++++++ .../Internal/ClientPipelineExtensions.cs | 67 +++++ .../Generated/Internal/ClientUriBuilder.cs | 181 ++++++++++++ .../Internal/CodeGenMemberAttribute.cs | 17 ++ .../Internal/CodeGenSerializationAttribute.cs | 45 +++ .../Internal/CodeGenSuppressAttribute.cs | 26 ++ .../Internal/CodeGenTypeAttribute.cs | 21 ++ .../src/Generated/Internal/ErrorResult.cs | 24 ++ .../Internal/ModelSerializationExtensions.cs | 265 ++++++++++++++++++ .../Generated/Internal/SerializationFormat.cs | 46 +++ .../src/Generated/Internal/TypeFormatters.cs | 178 ++++++++++++ .../Models/BodyModel.Serialization.cs | 136 ++++++++- .../src/Generated/Models/BodyModel.cs | 29 +- .../ParametersBodyOptionalityContext.cs | 4 + .../Generated/OptionalExplicit.RestClient.cs | 50 ++++ .../src/Generated/OptionalExplicit.cs | 128 ++++++++- .../ParametersBodyOptionalityModelFactory.cs | 9 +- 40 files changed, 1825 insertions(+), 69 deletions(-) create mode 100644 packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/body-optionality/src/Generated/BodyOptionalityClient.RestClient.cs create mode 100644 packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/body-optionality/src/Generated/Internal/Argument.cs create mode 100644 packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/body-optionality/src/Generated/Internal/CancellationTokenExtensions.cs create mode 100644 packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/body-optionality/src/Generated/Internal/ChangeTrackingDictionary.cs create mode 100644 packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/body-optionality/src/Generated/Internal/ClientPipelineExtensions.cs create mode 100644 packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/body-optionality/src/Generated/Internal/ClientUriBuilder.cs create mode 100644 packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/body-optionality/src/Generated/Internal/CodeGenMemberAttribute.cs create mode 100644 packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/body-optionality/src/Generated/Internal/CodeGenSerializationAttribute.cs create mode 100644 packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/body-optionality/src/Generated/Internal/CodeGenSuppressAttribute.cs create mode 100644 packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/body-optionality/src/Generated/Internal/CodeGenTypeAttribute.cs create mode 100644 packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/body-optionality/src/Generated/Internal/ErrorResult.cs create mode 100644 packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/body-optionality/src/Generated/Internal/ModelSerializationExtensions.cs create mode 100644 packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/body-optionality/src/Generated/Internal/SerializationFormat.cs create mode 100644 packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/body-optionality/src/Generated/Internal/TypeFormatters.cs create mode 100644 packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/body-optionality/src/Generated/OptionalExplicit.RestClient.cs diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Providers/ClientProvider.cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Providers/ClientProvider.cs index 3cb74431dc1..d8f4724b249 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Providers/ClientProvider.cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Providers/ClientProvider.cs @@ -836,6 +836,26 @@ private MethodBodyStatement[] BuildPrimaryConstructorBody(IReadOnlyList body = []; + bool hasValidation = false; + foreach (var p in primaryConstructorParameters) + { + if (p.Validation != ParameterValidationType.None) + { + body.Add(ArgumentSnippets.ValidateParameter(p)); + hasValidation = true; + } + } + if (hasValidation) + { + body.Add(MethodBodyStatement.EmptyLine); + } + AssignmentExpression endpointAssignment; if (_endpointParameter.Type.Equals(typeof(string))) { @@ -850,11 +870,9 @@ private MethodBodyStatement[] BuildPrimaryConstructorBody(IReadOnlyList body = [ - clientOptionsParameter.Assign(clientOptionsParameter.InitializationValue!, nullCoalesce: true).Terminate(), - MethodBodyStatement.EmptyLine, - endpointAssignment.Terminate() - ]; + body.Add(clientOptionsParameter.Assign(clientOptionsParameter.InitializationValue!, nullCoalesce: true).Terminate()); + body.Add(MethodBodyStatement.EmptyLine); + body.Add(endpointAssignment.Terminate()); // add other parameter assignments to their corresponding fields foreach (var p in primaryConstructorParameters) diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientProviders/TestData/ClientProviderTests/MultiServiceClient_GeneratesExpectedClient.cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientProviders/TestData/ClientProviderTests/MultiServiceClient_GeneratesExpectedClient.cs index d432f75ec62..3e82b811e69 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientProviders/TestData/ClientProviderTests/MultiServiceClient_GeneratesExpectedClient.cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientProviders/TestData/ClientProviderTests/MultiServiceClient_GeneratesExpectedClient.cs @@ -29,6 +29,9 @@ protected TestClient() internal TestClient(global::System.ClientModel.Primitives.AuthenticationPolicy authenticationPolicy, global::System.Uri endpoint, string subscriptionId, global::Sample.TestClientOptions options) { + global::Sample.Argument.AssertNotNull(endpoint, nameof(endpoint)); + global::Sample.Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + options ??= new global::Sample.TestClientOptions(); _endpoint = endpoint; diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientProviders/TestData/ClientProviderTests/MultiServiceClient_WithThreeServices_GeneratesExpectedClient.cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientProviders/TestData/ClientProviderTests/MultiServiceClient_WithThreeServices_GeneratesExpectedClient.cs index 05acee396e7..54206fc6ffb 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientProviders/TestData/ClientProviderTests/MultiServiceClient_WithThreeServices_GeneratesExpectedClient.cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientProviders/TestData/ClientProviderTests/MultiServiceClient_WithThreeServices_GeneratesExpectedClient.cs @@ -32,6 +32,9 @@ protected TestClient() internal TestClient(global::System.ClientModel.Primitives.AuthenticationPolicy authenticationPolicy, global::System.Uri endpoint, string subscriptionId, global::Sample.TestClientOptions options) { + global::Sample.Argument.AssertNotNull(endpoint, nameof(endpoint)); + global::Sample.Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + options ??= new global::Sample.TestClientOptions(); _endpoint = endpoint; diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientProviders/TestData/ClientProviderTests/MultiServiceCombinedClient_GeneratesExpectedClient.cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientProviders/TestData/ClientProviderTests/MultiServiceCombinedClient_GeneratesExpectedClient.cs index 41edc840d81..1bd204e71e8 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientProviders/TestData/ClientProviderTests/MultiServiceCombinedClient_GeneratesExpectedClient.cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientProviders/TestData/ClientProviderTests/MultiServiceCombinedClient_GeneratesExpectedClient.cs @@ -26,6 +26,8 @@ protected TestClient() internal TestClient(global::System.ClientModel.Primitives.AuthenticationPolicy authenticationPolicy, global::System.Uri endpoint, global::Sample.TestClientOptions options) { + global::Sample.Argument.AssertNotNull(endpoint, nameof(endpoint)); + options ??= new global::Sample.TestClientOptions(); _endpoint = endpoint; diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientProviders/TestData/ClientProviderTests/MultiServiceCombinedClient_WithThreeServices_GeneratesExpectedClient.cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientProviders/TestData/ClientProviderTests/MultiServiceCombinedClient_WithThreeServices_GeneratesExpectedClient.cs index fcd64b4ae27..a5520eb71c1 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientProviders/TestData/ClientProviderTests/MultiServiceCombinedClient_WithThreeServices_GeneratesExpectedClient.cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientProviders/TestData/ClientProviderTests/MultiServiceCombinedClient_WithThreeServices_GeneratesExpectedClient.cs @@ -27,6 +27,8 @@ protected TestClient() internal TestClient(global::System.ClientModel.Primitives.AuthenticationPolicy authenticationPolicy, global::System.Uri endpoint, global::Sample.TestClientOptions options) { + global::Sample.Argument.AssertNotNull(endpoint, nameof(endpoint)); + options ??= new global::Sample.TestClientOptions(); _endpoint = endpoint; diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientProviders/TestData/ClientProviderTests/TestBuildConstructors_PrimaryConstructor(WithDefault,False,False,0).cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientProviders/TestData/ClientProviderTests/TestBuildConstructors_PrimaryConstructor(WithDefault,False,False,0).cs index 855b9b946aa..bc5bbc28eac 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientProviders/TestData/ClientProviderTests/TestBuildConstructors_PrimaryConstructor(WithDefault,False,False,0).cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientProviders/TestData/ClientProviderTests/TestBuildConstructors_PrimaryConstructor(WithDefault,False,False,0).cs @@ -1,3 +1,5 @@ +global::Sample.Argument.AssertNotNull(endpoint, nameof(endpoint)); + options ??= new global::Sample.TestClientOptions(); _endpoint = endpoint; diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientProviders/TestData/ClientProviderTests/TestBuildConstructors_PrimaryConstructor(WithDefault,False,True,0).cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientProviders/TestData/ClientProviderTests/TestBuildConstructors_PrimaryConstructor(WithDefault,False,True,0).cs index cff4c2048c3..579690c23a0 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientProviders/TestData/ClientProviderTests/TestBuildConstructors_PrimaryConstructor(WithDefault,False,True,0).cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientProviders/TestData/ClientProviderTests/TestBuildConstructors_PrimaryConstructor(WithDefault,False,True,0).cs @@ -1,3 +1,5 @@ +global::Sample.Argument.AssertNotNull(endpoint, nameof(endpoint)); + options ??= new global::Sample.TestClientOptions(); _endpoint = endpoint; diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientProviders/TestData/ClientProviderTests/TestBuildConstructors_PrimaryConstructor(WithDefault,True,False,0).cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientProviders/TestData/ClientProviderTests/TestBuildConstructors_PrimaryConstructor(WithDefault,True,False,0).cs index cff4c2048c3..579690c23a0 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientProviders/TestData/ClientProviderTests/TestBuildConstructors_PrimaryConstructor(WithDefault,True,False,0).cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientProviders/TestData/ClientProviderTests/TestBuildConstructors_PrimaryConstructor(WithDefault,True,False,0).cs @@ -1,3 +1,5 @@ +global::Sample.Argument.AssertNotNull(endpoint, nameof(endpoint)); + options ??= new global::Sample.TestClientOptions(); _endpoint = endpoint; diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientProviders/TestData/ClientProviderTests/TestBuildConstructors_PrimaryConstructor(WithDefault,True,True,0).cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientProviders/TestData/ClientProviderTests/TestBuildConstructors_PrimaryConstructor(WithDefault,True,True,0).cs index cff4c2048c3..579690c23a0 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientProviders/TestData/ClientProviderTests/TestBuildConstructors_PrimaryConstructor(WithDefault,True,True,0).cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientProviders/TestData/ClientProviderTests/TestBuildConstructors_PrimaryConstructor(WithDefault,True,True,0).cs @@ -1,3 +1,5 @@ +global::Sample.Argument.AssertNotNull(endpoint, nameof(endpoint)); + options ??= new global::Sample.TestClientOptions(); _endpoint = endpoint; diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientProviders/TestData/ClientProviderTests/TestBuildConstructors_PrimaryConstructor(WithDefault,True,True,1).cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientProviders/TestData/ClientProviderTests/TestBuildConstructors_PrimaryConstructor(WithDefault,True,True,1).cs index cff4c2048c3..579690c23a0 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientProviders/TestData/ClientProviderTests/TestBuildConstructors_PrimaryConstructor(WithDefault,True,True,1).cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientProviders/TestData/ClientProviderTests/TestBuildConstructors_PrimaryConstructor(WithDefault,True,True,1).cs @@ -1,3 +1,5 @@ +global::Sample.Argument.AssertNotNull(endpoint, nameof(endpoint)); + options ??= new global::Sample.TestClientOptions(); _endpoint = endpoint; diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientProviders/TestData/ClientProviderTests/TestBuildConstructors_PrimaryConstructor(WithRequired,False,False,0).cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientProviders/TestData/ClientProviderTests/TestBuildConstructors_PrimaryConstructor(WithRequired,False,False,0).cs index 855b9b946aa..bc5bbc28eac 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientProviders/TestData/ClientProviderTests/TestBuildConstructors_PrimaryConstructor(WithRequired,False,False,0).cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientProviders/TestData/ClientProviderTests/TestBuildConstructors_PrimaryConstructor(WithRequired,False,False,0).cs @@ -1,3 +1,5 @@ +global::Sample.Argument.AssertNotNull(endpoint, nameof(endpoint)); + options ??= new global::Sample.TestClientOptions(); _endpoint = endpoint; diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientProviders/TestData/ClientProviderTests/TestBuildConstructors_PrimaryConstructor(WithRequired,False,True,0).cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientProviders/TestData/ClientProviderTests/TestBuildConstructors_PrimaryConstructor(WithRequired,False,True,0).cs index cff4c2048c3..579690c23a0 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientProviders/TestData/ClientProviderTests/TestBuildConstructors_PrimaryConstructor(WithRequired,False,True,0).cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientProviders/TestData/ClientProviderTests/TestBuildConstructors_PrimaryConstructor(WithRequired,False,True,0).cs @@ -1,3 +1,5 @@ +global::Sample.Argument.AssertNotNull(endpoint, nameof(endpoint)); + options ??= new global::Sample.TestClientOptions(); _endpoint = endpoint; diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientProviders/TestData/ClientProviderTests/TestBuildConstructors_PrimaryConstructor(WithRequired,True,False,0).cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientProviders/TestData/ClientProviderTests/TestBuildConstructors_PrimaryConstructor(WithRequired,True,False,0).cs index cff4c2048c3..579690c23a0 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientProviders/TestData/ClientProviderTests/TestBuildConstructors_PrimaryConstructor(WithRequired,True,False,0).cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientProviders/TestData/ClientProviderTests/TestBuildConstructors_PrimaryConstructor(WithRequired,True,False,0).cs @@ -1,3 +1,5 @@ +global::Sample.Argument.AssertNotNull(endpoint, nameof(endpoint)); + options ??= new global::Sample.TestClientOptions(); _endpoint = endpoint; diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientProviders/TestData/ClientProviderTests/TestBuildConstructors_PrimaryConstructor(WithRequired,True,True,0).cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientProviders/TestData/ClientProviderTests/TestBuildConstructors_PrimaryConstructor(WithRequired,True,True,0).cs index cff4c2048c3..579690c23a0 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientProviders/TestData/ClientProviderTests/TestBuildConstructors_PrimaryConstructor(WithRequired,True,True,0).cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientProviders/TestData/ClientProviderTests/TestBuildConstructors_PrimaryConstructor(WithRequired,True,True,0).cs @@ -1,3 +1,5 @@ +global::Sample.Argument.AssertNotNull(endpoint, nameof(endpoint)); + options ??= new global::Sample.TestClientOptions(); _endpoint = endpoint; diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientProviders/TestData/ClientProviderTests/TestBuildConstructors_PrimaryConstructor(WithRequired,True,True,1).cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientProviders/TestData/ClientProviderTests/TestBuildConstructors_PrimaryConstructor(WithRequired,True,True,1).cs index cff4c2048c3..579690c23a0 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientProviders/TestData/ClientProviderTests/TestBuildConstructors_PrimaryConstructor(WithRequired,True,True,1).cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientProviders/TestData/ClientProviderTests/TestBuildConstructors_PrimaryConstructor(WithRequired,True,True,1).cs @@ -1,3 +1,5 @@ +global::Sample.Argument.AssertNotNull(endpoint, nameof(endpoint)); + options ??= new global::Sample.TestClientOptions(); _endpoint = endpoint; diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientProviders/TestData/ClientProviderTests/ValidateConstructorsWhenUnsupportedAuth.cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientProviders/TestData/ClientProviderTests/ValidateConstructorsWhenUnsupportedAuth.cs index 8bfb8877981..60e6d68058d 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientProviders/TestData/ClientProviderTests/ValidateConstructorsWhenUnsupportedAuth.cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientProviders/TestData/ClientProviderTests/ValidateConstructorsWhenUnsupportedAuth.cs @@ -15,6 +15,8 @@ public partial class TestClient internal TestClient(global::System.ClientModel.Primitives.AuthenticationPolicy authenticationPolicy, global::System.Uri endpoint, global::Sample.TestClientOptions options) { + global::Sample.Argument.AssertNotNull(endpoint, nameof(endpoint)); + options ??= new global::Sample.TestClientOptions(); _endpoint = endpoint; diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientProviders/TestData/ClientProviderTests/XmlDocsAreWritten.cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientProviders/TestData/ClientProviderTests/XmlDocsAreWritten.cs index 3b17afddd36..5e455f24f4c 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientProviders/TestData/ClientProviderTests/XmlDocsAreWritten.cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientProviders/TestData/ClientProviderTests/XmlDocsAreWritten.cs @@ -37,6 +37,9 @@ protected TestClient() /// The options for configuring the client. internal TestClient(global::System.ClientModel.Primitives.AuthenticationPolicy authenticationPolicy, global::System.Uri endpoint, string queryParam, global::Sample.TestClientOptions options) { + global::Sample.Argument.AssertNotNull(endpoint, nameof(endpoint)); + global::Sample.Argument.AssertNotNullOrEmpty(queryParam, nameof(queryParam)); + options ??= new global::Sample.TestClientOptions(); _endpoint = endpoint; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/body-optionality/src/Generated/BodyOptionalityClient.RestClient.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/body-optionality/src/Generated/BodyOptionalityClient.RestClient.cs new file mode 100644 index 00000000000..c369b7a2c6b --- /dev/null +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/body-optionality/src/Generated/BodyOptionalityClient.RestClient.cs @@ -0,0 +1,43 @@ +// + +#nullable disable + +using System.ClientModel; +using System.ClientModel.Primitives; + +namespace Parameters.BodyOptionality +{ + /// + public partial class BodyOptionalityClient + { + private static PipelineMessageClassifier _pipelineMessageClassifier204; + + private static PipelineMessageClassifier PipelineMessageClassifier204 => _pipelineMessageClassifier204 ??= PipelineMessageClassifier.Create(stackalloc ushort[] { 204 }); + + internal PipelineMessage CreateRequiredExplicitRequest(BinaryContent content, RequestOptions options) + { + ClientUriBuilder uri = new ClientUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/parameters/body-optionality/required-explicit", false); + PipelineMessage message = Pipeline.CreateMessage(uri.ToUri(), "POST", PipelineMessageClassifier204); + PipelineRequest request = message.Request; + request.Headers.Set("Content-Type", "application/json"); + request.Content = content; + message.Apply(options); + return message; + } + + internal PipelineMessage CreateRequiredImplicitRequest(BinaryContent content, RequestOptions options) + { + ClientUriBuilder uri = new ClientUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/parameters/body-optionality/required-implicit", false); + PipelineMessage message = Pipeline.CreateMessage(uri.ToUri(), "POST", PipelineMessageClassifier204); + PipelineRequest request = message.Request; + request.Headers.Set("Content-Type", "application/json"); + request.Content = content; + message.Apply(options); + return message; + } + } +} diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/body-optionality/src/Generated/BodyOptionalityClient.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/body-optionality/src/Generated/BodyOptionalityClient.cs index 457b49eac2f..5c9725f7d91 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/body-optionality/src/Generated/BodyOptionalityClient.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/body-optionality/src/Generated/BodyOptionalityClient.cs @@ -12,35 +12,189 @@ namespace Parameters.BodyOptionality { + /// Test describing optionality of the request body. public partial class BodyOptionalityClient { - public BodyOptionalityClient() : this(new Uri("http://localhost:3000"), new BodyOptionalityClientOptions()) => throw null; - - internal BodyOptionalityClient(AuthenticationPolicy authenticationPolicy, Uri endpoint, BodyOptionalityClientOptions options) => throw null; - - public BodyOptionalityClient(Uri endpoint, BodyOptionalityClientOptions options) : this(null, endpoint, options) => throw null; - + private readonly Uri _endpoint; + private OptionalExplicit _cachedOptionalExplicit; + + /// Initializes a new instance of BodyOptionalityClient. + public BodyOptionalityClient() : this(new Uri("http://localhost:3000"), new BodyOptionalityClientOptions()) + { + } + + /// Initializes a new instance of BodyOptionalityClient. + /// The authentication policy to use for pipeline creation. + /// Service endpoint. + /// The options for configuring the client. + internal BodyOptionalityClient(AuthenticationPolicy authenticationPolicy, Uri endpoint, BodyOptionalityClientOptions options) + { + Argument.AssertNotNull(endpoint, nameof(endpoint)); + + options ??= new BodyOptionalityClientOptions(); + + _endpoint = endpoint; + Pipeline = ClientPipeline.Create(options, Array.Empty(), new PipelinePolicy[] { new UserAgentPolicy(typeof(BodyOptionalityClient).Assembly) }, Array.Empty()); + } + + /// Initializes a new instance of BodyOptionalityClient. + /// Service endpoint. + /// The options for configuring the client. + /// is null. + public BodyOptionalityClient(Uri endpoint, BodyOptionalityClientOptions options) : this(null, endpoint, options) + { + } + + /// Initializes a new instance of BodyOptionalityClient from settings. + /// The settings for BodyOptionalityClient. [Experimental("SCME0002")] - public BodyOptionalityClient(BodyOptionalityClientSettings settings) : this(AuthenticationPolicy.Create(settings), settings?.Endpoint, settings?.Options) => throw null; - - public ClientPipeline Pipeline => throw null; - - public virtual ClientResult RequiredExplicit(BinaryContent content, RequestOptions options = null) => throw null; - - public virtual Task RequiredExplicitAsync(BinaryContent content, RequestOptions options = null) => throw null; - - public virtual ClientResult RequiredExplicit(BodyModel body, CancellationToken cancellationToken = default) => throw null; - - public virtual Task RequiredExplicitAsync(BodyModel body, CancellationToken cancellationToken = default) => throw null; - - public virtual ClientResult RequiredImplicit(BinaryContent content, RequestOptions options = null) => throw null; - - public virtual Task RequiredImplicitAsync(BinaryContent content, RequestOptions options = null) => throw null; - - public virtual ClientResult RequiredImplicit(string name, CancellationToken cancellationToken = default) => throw null; - - public virtual Task RequiredImplicitAsync(string name, CancellationToken cancellationToken = default) => throw null; - - public virtual OptionalExplicit GetOptionalExplicitClient() => throw null; + public BodyOptionalityClient(BodyOptionalityClientSettings settings) : this(AuthenticationPolicy.Create(settings), settings?.Endpoint, settings?.Options) + { + } + + /// The HTTP pipeline for sending and receiving REST requests and responses. + public ClientPipeline Pipeline { get; } + + /// + /// [Protocol Method] RequiredExplicit + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// The content to send as the body of the request. + /// The request options, which can override default behaviors of the client pipeline on a per-call basis. + /// is null. + /// Service returned a non-success status code. + /// The response returned from the service. + public virtual ClientResult RequiredExplicit(BinaryContent content, RequestOptions options = null) + { + Argument.AssertNotNull(content, nameof(content)); + + using PipelineMessage message = CreateRequiredExplicitRequest(content, options); + return ClientResult.FromResponse(Pipeline.ProcessMessage(message, options)); + } + + /// + /// [Protocol Method] RequiredExplicit + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// The content to send as the body of the request. + /// The request options, which can override default behaviors of the client pipeline on a per-call basis. + /// is null. + /// Service returned a non-success status code. + /// The response returned from the service. + public virtual async Task RequiredExplicitAsync(BinaryContent content, RequestOptions options = null) + { + Argument.AssertNotNull(content, nameof(content)); + + using PipelineMessage message = CreateRequiredExplicitRequest(content, options); + return ClientResult.FromResponse(await Pipeline.ProcessMessageAsync(message, options).ConfigureAwait(false)); + } + + /// RequiredExplicit. + /// + /// The cancellation token that can be used to cancel the operation. + /// is null. + /// Service returned a non-success status code. + public virtual ClientResult RequiredExplicit(BodyModel body, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(body, nameof(body)); + + return RequiredExplicit(body, cancellationToken.ToRequestOptions()); + } + + /// RequiredExplicit. + /// + /// The cancellation token that can be used to cancel the operation. + /// is null. + /// Service returned a non-success status code. + public virtual async Task RequiredExplicitAsync(BodyModel body, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(body, nameof(body)); + + return await RequiredExplicitAsync(body, cancellationToken.ToRequestOptions()).ConfigureAwait(false); + } + + /// + /// [Protocol Method] RequiredImplicit + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// The content to send as the body of the request. + /// The request options, which can override default behaviors of the client pipeline on a per-call basis. + /// is null. + /// Service returned a non-success status code. + /// The response returned from the service. + public virtual ClientResult RequiredImplicit(BinaryContent content, RequestOptions options = null) + { + Argument.AssertNotNull(content, nameof(content)); + + using PipelineMessage message = CreateRequiredImplicitRequest(content, options); + return ClientResult.FromResponse(Pipeline.ProcessMessage(message, options)); + } + + /// + /// [Protocol Method] RequiredImplicit + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// The content to send as the body of the request. + /// The request options, which can override default behaviors of the client pipeline on a per-call basis. + /// is null. + /// Service returned a non-success status code. + /// The response returned from the service. + public virtual async Task RequiredImplicitAsync(BinaryContent content, RequestOptions options = null) + { + Argument.AssertNotNull(content, nameof(content)); + + using PipelineMessage message = CreateRequiredImplicitRequest(content, options); + return ClientResult.FromResponse(await Pipeline.ProcessMessageAsync(message, options).ConfigureAwait(false)); + } + + /// RequiredImplicit. + /// + /// The cancellation token that can be used to cancel the operation. + /// is null. + /// is an empty string, and was expected to be non-empty. + /// Service returned a non-success status code. + public virtual ClientResult RequiredImplicit(string name, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(name, nameof(name)); + + BodyModel spreadModel = new BodyModel(name, default); + return RequiredImplicit(spreadModel, cancellationToken.ToRequestOptions()); + } + + /// RequiredImplicit. + /// + /// The cancellation token that can be used to cancel the operation. + /// is null. + /// is an empty string, and was expected to be non-empty. + /// Service returned a non-success status code. + public virtual async Task RequiredImplicitAsync(string name, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(name, nameof(name)); + + BodyModel spreadModel = new BodyModel(name, default); + return await RequiredImplicitAsync(spreadModel, cancellationToken.ToRequestOptions()).ConfigureAwait(false); + } + + /// Initializes a new instance of OptionalExplicit. + public virtual OptionalExplicit GetOptionalExplicitClient() + { + return Volatile.Read(ref _cachedOptionalExplicit) ?? Interlocked.CompareExchange(ref _cachedOptionalExplicit, new OptionalExplicit(Pipeline, _endpoint), null) ?? _cachedOptionalExplicit; + } } } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/body-optionality/src/Generated/BodyOptionalityClientOptions.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/body-optionality/src/Generated/BodyOptionalityClientOptions.cs index 33804b10acc..0ff10a94b8e 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/body-optionality/src/Generated/BodyOptionalityClientOptions.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/body-optionality/src/Generated/BodyOptionalityClientOptions.cs @@ -8,11 +8,23 @@ namespace Parameters.BodyOptionality { + /// Client options for . public partial class BodyOptionalityClientOptions : ClientPipelineOptions { - public BodyOptionalityClientOptions() => throw null; + /// Initializes a new instance of BodyOptionalityClientOptions. + public BodyOptionalityClientOptions() + { + } + /// Initializes a new instance of BodyOptionalityClientOptions from configuration. + /// The configuration section. [Experimental("SCME0002")] - internal BodyOptionalityClientOptions(IConfigurationSection section) : base(section) => throw null; + internal BodyOptionalityClientOptions(IConfigurationSection section) : base(section) + { + if (section is null || !section.Exists()) + { + return; + } + } } } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/body-optionality/src/Generated/BodyOptionalityClientSettings.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/body-optionality/src/Generated/BodyOptionalityClientSettings.cs index 137094caec7..c2e7252ea29 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/body-optionality/src/Generated/BodyOptionalityClientSettings.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/body-optionality/src/Generated/BodyOptionalityClientSettings.cs @@ -9,21 +9,29 @@ namespace Parameters.BodyOptionality { + /// [Experimental("SCME0002")] public partial class BodyOptionalityClientSettings : ClientSettings { - public Uri Endpoint - { - get => throw null; - set => throw null; - } + /// Gets or sets the Endpoint. + public Uri Endpoint { get; set; } - public BodyOptionalityClientOptions Options + /// Gets or sets the Options. + public BodyOptionalityClientOptions Options { get; set; } + + /// Binds configuration values from the given section. + /// The configuration section. + protected override void BindCore(IConfigurationSection section) { - get => throw null; - set => throw null; + if (Uri.TryCreate(section["Endpoint"], UriKind.Absolute, out Uri endpoint)) + { + Endpoint = endpoint; + } + IConfigurationSection optionsSection = section.GetSection("Options"); + if (optionsSection.Exists()) + { + Options = new BodyOptionalityClientOptions(optionsSection); + } } - - protected override void BindCore(IConfigurationSection section) => throw null; } } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/body-optionality/src/Generated/Internal/Argument.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/body-optionality/src/Generated/Internal/Argument.cs new file mode 100644 index 00000000000..9a203d56ff3 --- /dev/null +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/body-optionality/src/Generated/Internal/Argument.cs @@ -0,0 +1,110 @@ +// + +#nullable disable + +using System; +using System.Collections; +using System.Collections.Generic; + +namespace Parameters.BodyOptionality +{ + internal static partial class Argument + { + /// The value. + /// The name. + public static void AssertNotNull(T value, string name) + { + if (value is null) + { + throw new ArgumentNullException(name); + } + } + + /// The value. + /// The name. + public static void AssertNotNull(T? value, string name) + where T : struct + { + if (!value.HasValue) + { + throw new ArgumentNullException(name); + } + } + + /// The value. + /// The name. + public static void AssertNotNullOrEmpty(IEnumerable value, string name) + { + if (value is null) + { + throw new ArgumentNullException(name); + } + if (value is ICollection collectionOfT && collectionOfT.Count == 0) + { + throw new ArgumentException("Value cannot be an empty collection.", name); + } + if (value is ICollection collection && collection.Count == 0) + { + throw new ArgumentException("Value cannot be an empty collection.", name); + } + using IEnumerator e = value.GetEnumerator(); + if (!e.MoveNext()) + { + throw new ArgumentException("Value cannot be an empty collection.", name); + } + } + + /// The value. + /// The name. + public static void AssertNotNullOrEmpty(string value, string name) + { + if (value is null) + { + throw new ArgumentNullException(name); + } + if (value.Length == 0) + { + throw new ArgumentException("Value cannot be an empty string.", name); + } + } + + /// The value. + /// The name. + public static void AssertNotNullOrWhiteSpace(string value, string name) + { + if (value is null) + { + throw new ArgumentNullException(name); + } + if (string.IsNullOrWhiteSpace(value)) + { + throw new ArgumentException("Value cannot be empty or contain only white-space characters.", name); + } + } + + /// The value. + /// The minimum value. + /// The maximum value. + /// The name. + public static void AssertInRange(T value, T minimum, T maximum, string name) + where T : notnull, IComparable + { + if (minimum.CompareTo(value) > 0) + { + throw new ArgumentOutOfRangeException(name, "Value is less than the minimum allowed."); + } + if (maximum.CompareTo(value) < 0) + { + throw new ArgumentOutOfRangeException(name, "Value is greater than the maximum allowed."); + } + } + + /// The value. + /// The name. + public static string CheckNotNullOrEmpty(string value, string name) + { + AssertNotNullOrEmpty(value, name); + return value; + } + } +} diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/body-optionality/src/Generated/Internal/CancellationTokenExtensions.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/body-optionality/src/Generated/Internal/CancellationTokenExtensions.cs new file mode 100644 index 00000000000..2403a4646f4 --- /dev/null +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/body-optionality/src/Generated/Internal/CancellationTokenExtensions.cs @@ -0,0 +1,14 @@ +// + +#nullable disable + +using System.ClientModel.Primitives; +using System.Threading; + +namespace Parameters.BodyOptionality +{ + internal static partial class CancellationTokenExtensions + { + public static RequestOptions ToRequestOptions(this CancellationToken cancellationToken) => cancellationToken.CanBeCanceled ? new RequestOptions { CancellationToken = cancellationToken } : null; + } +} diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/body-optionality/src/Generated/Internal/ChangeTrackingDictionary.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/body-optionality/src/Generated/Internal/ChangeTrackingDictionary.cs new file mode 100644 index 00000000000..bd983abaf23 --- /dev/null +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/body-optionality/src/Generated/Internal/ChangeTrackingDictionary.cs @@ -0,0 +1,186 @@ +// + +#nullable disable + +using System; +using System.Collections; +using System.Collections.Generic; + +namespace Parameters.BodyOptionality +{ + internal partial class ChangeTrackingDictionary : IDictionary, IReadOnlyDictionary + where TKey : notnull + { + private IDictionary _innerDictionary; + + public ChangeTrackingDictionary() + { + } + + /// The inner dictionary. + public ChangeTrackingDictionary(IDictionary dictionary) + { + if (dictionary == null) + { + return; + } + _innerDictionary = new Dictionary(dictionary); + } + + /// The inner dictionary. + public ChangeTrackingDictionary(IReadOnlyDictionary dictionary) + { + if (dictionary == null) + { + return; + } + _innerDictionary = new Dictionary(); + foreach (var pair in dictionary) + { + _innerDictionary.Add(pair); + } + } + + /// Gets the IsUndefined. + public bool IsUndefined => _innerDictionary == null; + + /// Gets the Count. + public int Count => IsUndefined ? 0 : EnsureDictionary().Count; + + /// Gets the IsReadOnly. + public bool IsReadOnly => IsUndefined ? false : EnsureDictionary().IsReadOnly; + + /// Gets the Keys. + public ICollection Keys => IsUndefined ? Array.Empty() : EnsureDictionary().Keys; + + /// Gets the Values. + public ICollection Values => IsUndefined ? Array.Empty() : EnsureDictionary().Values; + + /// Gets or sets the value associated with the specified key. + public TValue this[TKey key] + { + get + { + if (IsUndefined) + { + throw new KeyNotFoundException(nameof(key)); + } + return EnsureDictionary()[key]; + } + set + { + EnsureDictionary()[key] = value; + } + } + + /// Gets the Keys. + IEnumerable IReadOnlyDictionary.Keys => Keys; + + /// Gets the Values. + IEnumerable IReadOnlyDictionary.Values => Values; + + public IEnumerator> GetEnumerator() + { + if (IsUndefined) + { + IEnumerator> enumerateEmpty() + { + yield break; + } + return enumerateEmpty(); + } + return EnsureDictionary().GetEnumerator(); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetEnumerator(); + } + + /// The item to add. + public void Add(KeyValuePair item) + { + EnsureDictionary().Add(item); + } + + public void Clear() + { + EnsureDictionary().Clear(); + } + + /// The item to search for. + public bool Contains(KeyValuePair item) + { + if (IsUndefined) + { + return false; + } + return EnsureDictionary().Contains(item); + } + + /// The array to copy. + /// The index. + public void CopyTo(KeyValuePair[] array, int index) + { + if (IsUndefined) + { + return; + } + EnsureDictionary().CopyTo(array, index); + } + + /// The item to remove. + public bool Remove(KeyValuePair item) + { + if (IsUndefined) + { + return false; + } + return EnsureDictionary().Remove(item); + } + + /// The key. + /// The value to add. + public void Add(TKey key, TValue value) + { + EnsureDictionary().Add(key, value); + } + + /// The key to search for. + public bool ContainsKey(TKey key) + { + if (IsUndefined) + { + return false; + } + return EnsureDictionary().ContainsKey(key); + } + + /// The key. + public bool Remove(TKey key) + { + if (IsUndefined) + { + return false; + } + return EnsureDictionary().Remove(key); + } + + /// The key to search for. + /// The value. + public bool TryGetValue(TKey key, out TValue value) + { + if (IsUndefined) + { + value = default; + return false; + } + return EnsureDictionary().TryGetValue(key, out value); + } + + public IDictionary EnsureDictionary() + { + return _innerDictionary ??= new Dictionary(); + } + } +} diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/body-optionality/src/Generated/Internal/ClientPipelineExtensions.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/body-optionality/src/Generated/Internal/ClientPipelineExtensions.cs new file mode 100644 index 00000000000..5f60d88187a --- /dev/null +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/body-optionality/src/Generated/Internal/ClientPipelineExtensions.cs @@ -0,0 +1,67 @@ +// + +#nullable disable + +using System.ClientModel; +using System.ClientModel.Primitives; +using System.Threading.Tasks; + +namespace Parameters.BodyOptionality +{ + internal static partial class ClientPipelineExtensions + { + public static async ValueTask ProcessMessageAsync(this ClientPipeline pipeline, PipelineMessage message, RequestOptions options) + { + await pipeline.SendAsync(message).ConfigureAwait(false); + + if (message.Response.IsError && (options?.ErrorOptions & ClientErrorBehaviors.NoThrow) != ClientErrorBehaviors.NoThrow) + { + throw await ClientResultException.CreateAsync(message.Response).ConfigureAwait(false); + } + + PipelineResponse response = message.BufferResponse ? message.Response : message.ExtractResponse(); + return response; + } + + public static PipelineResponse ProcessMessage(this ClientPipeline pipeline, PipelineMessage message, RequestOptions options) + { + pipeline.Send(message); + + if (message.Response.IsError && (options?.ErrorOptions & ClientErrorBehaviors.NoThrow) != ClientErrorBehaviors.NoThrow) + { + throw new ClientResultException(message.Response); + } + + PipelineResponse response = message.BufferResponse ? message.Response : message.ExtractResponse(); + return response; + } + + public static async ValueTask> ProcessHeadAsBoolMessageAsync(this ClientPipeline pipeline, PipelineMessage message, RequestOptions options) + { + PipelineResponse response = await pipeline.ProcessMessageAsync(message, options).ConfigureAwait(false); + switch (response.Status) + { + case >= 200 and < 300: + return ClientResult.FromValue(true, response); + case >= 400 and < 500: + return ClientResult.FromValue(false, response); + default: + return new ErrorResult(response, new ClientResultException(response)); + } + } + + public static ClientResult ProcessHeadAsBoolMessage(this ClientPipeline pipeline, PipelineMessage message, RequestOptions options) + { + PipelineResponse response = pipeline.ProcessMessage(message, options); + switch (response.Status) + { + case >= 200 and < 300: + return ClientResult.FromValue(true, response); + case >= 400 and < 500: + return ClientResult.FromValue(false, response); + default: + return new ErrorResult(response, new ClientResultException(response)); + } + } + } +} diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/body-optionality/src/Generated/Internal/ClientUriBuilder.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/body-optionality/src/Generated/Internal/ClientUriBuilder.cs new file mode 100644 index 00000000000..637f2a6360c --- /dev/null +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/body-optionality/src/Generated/Internal/ClientUriBuilder.cs @@ -0,0 +1,181 @@ +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace Parameters.BodyOptionality +{ + internal partial class ClientUriBuilder + { + private UriBuilder _uriBuilder; + private StringBuilder _pathAndQuery; + private int _pathLength; + + public ClientUriBuilder() + { + } + + private UriBuilder UriBuilder => _uriBuilder ??= new UriBuilder(); + + private StringBuilder PathAndQuery => _pathAndQuery ??= new StringBuilder(); + + public void Reset(Uri uri) + { + _uriBuilder = new UriBuilder(uri); + PathAndQuery.Clear(); + PathAndQuery.Append(UriBuilder.Path); + _pathLength = PathAndQuery.Length; + PathAndQuery.Append(UriBuilder.Query); + } + + public void AppendPath(string value, bool escape) + { + if (escape) + { + value = Uri.EscapeDataString(value); + } + if (_pathLength > 0 && PathAndQuery[_pathLength - 1] == '/' && value[0] == '/') + { + PathAndQuery.Remove(_pathLength - 1, 1); + _pathLength = _pathLength - 1; + } + PathAndQuery.Insert(_pathLength, value); + _pathLength = _pathLength + value.Length; + } + + public void AppendPath(bool value, bool escape = false) => AppendPath(TypeFormatters.ConvertToString(value), escape); + + public void AppendPath(float value, bool escape = true) => AppendPath(TypeFormatters.ConvertToString(value), escape); + + public void AppendPath(double value, bool escape = true) => AppendPath(TypeFormatters.ConvertToString(value), escape); + + public void AppendPath(int value, bool escape = true) => AppendPath(TypeFormatters.ConvertToString(value), escape); + + public void AppendPath(byte[] value, SerializationFormat format = SerializationFormat.Default, bool escape = true) => AppendPath(TypeFormatters.ConvertToString(value, format), escape); + + public void AppendPath(DateTimeOffset value, SerializationFormat format = SerializationFormat.Default, bool escape = true) => AppendPath(TypeFormatters.ConvertToString(value, format), escape); + + public void AppendPath(TimeSpan value, SerializationFormat format = SerializationFormat.Default, bool escape = true) => AppendPath(TypeFormatters.ConvertToString(value, format), escape); + + public void AppendPath(Guid value, bool escape = true) => AppendPath(TypeFormatters.ConvertToString(value), escape); + + public void AppendPath(long value, bool escape = true) => AppendPath(TypeFormatters.ConvertToString(value), escape); + + public void AppendPathDelimited(IEnumerable value, string delimiter, SerializationFormat format = SerializationFormat.Default, bool escape = true) + { + delimiter ??= ","; + IEnumerable stringValues = value.Select(v => TypeFormatters.ConvertToString(v, format)); + AppendPath(string.Join(delimiter, stringValues), escape); + } + + public void AppendQuery(string name, string value, bool escape) + { + if (PathAndQuery.Length == _pathLength) + { + PathAndQuery.Append('?'); + } + if (PathAndQuery.Length > _pathLength && PathAndQuery[PathAndQuery.Length - 1] != '?') + { + PathAndQuery.Append('&'); + } + if (escape) + { + value = Uri.EscapeDataString(value); + } + PathAndQuery.Append(name); + PathAndQuery.Append('='); + PathAndQuery.Append(value); + } + + public void AppendQuery(string name, bool value, bool escape = false) => AppendQuery(name, TypeFormatters.ConvertToString(value), escape); + + public void AppendQuery(string name, float value, bool escape = true) => AppendQuery(name, TypeFormatters.ConvertToString(value), escape); + + public void AppendQuery(string name, DateTimeOffset value, SerializationFormat format = SerializationFormat.Default, bool escape = true) => AppendQuery(name, TypeFormatters.ConvertToString(value, format), escape); + + public void AppendQuery(string name, TimeSpan value, SerializationFormat format = SerializationFormat.Default, bool escape = true) => AppendQuery(name, TypeFormatters.ConvertToString(value, format), escape); + + public void AppendQuery(string name, double value, bool escape = true) => AppendQuery(name, TypeFormatters.ConvertToString(value), escape); + + public void AppendQuery(string name, decimal value, bool escape = true) => AppendQuery(name, TypeFormatters.ConvertToString(value), escape); + + public void AppendQuery(string name, int value, bool escape = true) => AppendQuery(name, TypeFormatters.ConvertToString(value), escape); + + public void AppendQuery(string name, long value, bool escape = true) => AppendQuery(name, TypeFormatters.ConvertToString(value), escape); + + public void AppendQuery(string name, TimeSpan value, bool escape = true) => AppendQuery(name, TypeFormatters.ConvertToString(value), escape); + + public void AppendQuery(string name, byte[] value, SerializationFormat format = SerializationFormat.Default, bool escape = true) => AppendQuery(name, TypeFormatters.ConvertToString(value, format), escape); + + public void AppendQuery(string name, Guid value, bool escape = true) => AppendQuery(name, TypeFormatters.ConvertToString(value), escape); + + public void AppendQueryDelimited(string name, IEnumerable value, string delimiter, SerializationFormat format = SerializationFormat.Default, bool escape = true) + { + delimiter ??= ","; + IEnumerable stringValues = value.Select(v => TypeFormatters.ConvertToString(v, format)); + AppendQuery(name, string.Join(delimiter, stringValues), escape); + } + + public void UpdateQuery(string name, string value) + { + if (PathAndQuery.Length == _pathLength) + { + AppendQuery(name, value, false); + } + else + { + int queryStartIndex = _pathLength + 1; + string searchPattern = name + "="; + string queryString = PathAndQuery.ToString(queryStartIndex, PathAndQuery.Length - queryStartIndex); + int paramStartIndex = -1; + if (queryString.StartsWith(searchPattern)) + { + paramStartIndex = 0; + } + if (paramStartIndex == -1) + { + int prefixedIndex = queryString.IndexOf("&" + searchPattern); + if (prefixedIndex >= 0) + { + paramStartIndex = prefixedIndex + 1; + } + } + if (paramStartIndex >= 0) + { + int valueStartIndex = paramStartIndex + searchPattern.Length; + int valueEndIndex = queryString.IndexOf('&', valueStartIndex); + if (valueEndIndex == -1) + { + valueEndIndex = queryString.Length; + } + int globalStart = queryStartIndex + valueStartIndex; + int globalEnd = queryStartIndex + valueEndIndex; + PathAndQuery.Remove(globalStart, globalEnd - globalStart); + PathAndQuery.Insert(globalStart, value); + } + else + { + AppendQuery(name, value, false); + } + } + } + + public Uri ToUri() + { + UriBuilder.Path = PathAndQuery.ToString(0, _pathLength); + if (PathAndQuery.Length > _pathLength) + { + UriBuilder.Query = PathAndQuery.ToString(_pathLength + 1, PathAndQuery.Length - _pathLength - 1); + } + if (PathAndQuery.Length == _pathLength) + { + UriBuilder.Query = ""; + } + return UriBuilder.Uri; + } + } +} diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/body-optionality/src/Generated/Internal/CodeGenMemberAttribute.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/body-optionality/src/Generated/Internal/CodeGenMemberAttribute.cs new file mode 100644 index 00000000000..044dfe314c5 --- /dev/null +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/body-optionality/src/Generated/Internal/CodeGenMemberAttribute.cs @@ -0,0 +1,17 @@ +// + +#nullable disable + +using System; + +namespace Microsoft.TypeSpec.Generator.Customizations +{ + [AttributeUsage((AttributeTargets.Property | AttributeTargets.Field))] + internal partial class CodeGenMemberAttribute : CodeGenTypeAttribute + { + /// The original name of the member. + public CodeGenMemberAttribute(string originalName) : base(originalName) + { + } + } +} diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/body-optionality/src/Generated/Internal/CodeGenSerializationAttribute.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/body-optionality/src/Generated/Internal/CodeGenSerializationAttribute.cs new file mode 100644 index 00000000000..aedb8b359b8 --- /dev/null +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/body-optionality/src/Generated/Internal/CodeGenSerializationAttribute.cs @@ -0,0 +1,45 @@ +// + +#nullable disable + +using System; + +namespace Microsoft.TypeSpec.Generator.Customizations +{ + [AttributeUsage((AttributeTargets.Class | AttributeTargets.Struct), AllowMultiple = true, Inherited = true)] + internal partial class CodeGenSerializationAttribute : Attribute + { + /// The property name which these hooks apply to. + public CodeGenSerializationAttribute(string propertyName) + { + PropertyName = propertyName; + } + + /// The property name which these hooks apply to. + /// The serialization name of the property. + public CodeGenSerializationAttribute(string propertyName, string serializationName) + { + PropertyName = propertyName; + SerializationName = serializationName; + } + + /// Gets or sets the property name which these hooks should apply to. + public string PropertyName { get; } + + /// Gets or sets the serialization name of the property. + public string SerializationName { get; set; } + + /// + /// Gets or sets the method name to use when serializing the property value (property name excluded). + /// The signature of the serialization hook method must be or compatible with when invoking: private void SerializeHook(Utf8JsonWriter writer); + /// + public string SerializationValueHook { get; set; } + + /// + /// Gets or sets the method name to use when deserializing the property value from the JSON. + /// private static void DeserializationHook(JsonProperty property, ref TypeOfTheProperty propertyValue); // if the property is required + /// private static void DeserializationHook(JsonProperty property, ref Optional<TypeOfTheProperty> propertyValue); // if the property is optional + /// + public string DeserializationValueHook { get; set; } + } +} diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/body-optionality/src/Generated/Internal/CodeGenSuppressAttribute.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/body-optionality/src/Generated/Internal/CodeGenSuppressAttribute.cs new file mode 100644 index 00000000000..601ded913ab --- /dev/null +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/body-optionality/src/Generated/Internal/CodeGenSuppressAttribute.cs @@ -0,0 +1,26 @@ +// + +#nullable disable + +using System; + +namespace Microsoft.TypeSpec.Generator.Customizations +{ + [AttributeUsage((AttributeTargets.Class | AttributeTargets.Enum | AttributeTargets.Struct), AllowMultiple = true)] + internal partial class CodeGenSuppressAttribute : Attribute + { + /// The member to suppress. + /// The types of the parameters of the member. + public CodeGenSuppressAttribute(string member, params Type[] parameters) + { + Member = member; + Parameters = parameters; + } + + /// Gets the Member. + public string Member { get; } + + /// Gets the Parameters. + public Type[] Parameters { get; } + } +} diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/body-optionality/src/Generated/Internal/CodeGenTypeAttribute.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/body-optionality/src/Generated/Internal/CodeGenTypeAttribute.cs new file mode 100644 index 00000000000..d7b56bdccdf --- /dev/null +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/body-optionality/src/Generated/Internal/CodeGenTypeAttribute.cs @@ -0,0 +1,21 @@ +// + +#nullable disable + +using System; + +namespace Microsoft.TypeSpec.Generator.Customizations +{ + [AttributeUsage((AttributeTargets.Class | AttributeTargets.Enum | AttributeTargets.Struct))] + internal partial class CodeGenTypeAttribute : Attribute + { + /// The original name of the type. + public CodeGenTypeAttribute(string originalName) + { + OriginalName = originalName; + } + + /// Gets the OriginalName. + public string OriginalName { get; } + } +} diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/body-optionality/src/Generated/Internal/ErrorResult.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/body-optionality/src/Generated/Internal/ErrorResult.cs new file mode 100644 index 00000000000..f71f5b72dd6 --- /dev/null +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/body-optionality/src/Generated/Internal/ErrorResult.cs @@ -0,0 +1,24 @@ +// + +#nullable disable + +using System.ClientModel; +using System.ClientModel.Primitives; + +namespace Parameters.BodyOptionality +{ + internal partial class ErrorResult : ClientResult + { + private readonly PipelineResponse _response; + private readonly ClientResultException _exception; + + public ErrorResult(PipelineResponse response, ClientResultException exception) : base(default, response) + { + _response = response; + _exception = exception; + } + + /// Gets the Value. + public override T Value => throw _exception; + } +} diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/body-optionality/src/Generated/Internal/ModelSerializationExtensions.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/body-optionality/src/Generated/Internal/ModelSerializationExtensions.cs new file mode 100644 index 00000000000..49cee9e8bd3 --- /dev/null +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/body-optionality/src/Generated/Internal/ModelSerializationExtensions.cs @@ -0,0 +1,265 @@ +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Diagnostics; +using System.Globalization; +using System.Runtime.InteropServices; +using System.Text.Json; + +namespace Parameters.BodyOptionality +{ + internal static partial class ModelSerializationExtensions + { + internal static readonly ModelReaderWriterOptions WireOptions = new ModelReaderWriterOptions("W"); + internal static readonly JsonDocumentOptions JsonDocumentOptions = new JsonDocumentOptions + { + MaxDepth = 256 + }; + + public static object GetObject(this JsonElement element) + { + switch (element.ValueKind) + { + case JsonValueKind.String: + return element.GetString(); + case JsonValueKind.Number: + if (element.TryGetInt32(out int intValue)) + { + return intValue; + } + if (element.TryGetInt64(out long longValue)) + { + return longValue; + } + return element.GetDouble(); + case JsonValueKind.True: + return true; + case JsonValueKind.False: + return false; + case JsonValueKind.Undefined: + case JsonValueKind.Null: + return null; + case JsonValueKind.Object: + Dictionary dictionary = new Dictionary(); + foreach (var jsonProperty in element.EnumerateObject()) + { + dictionary.Add(jsonProperty.Name, jsonProperty.Value.GetObject()); + } + return dictionary; + case JsonValueKind.Array: + List list = new List(); + foreach (var item in element.EnumerateArray()) + { + list.Add(item.GetObject()); + } + return list.ToArray(); + default: + throw new NotSupportedException($"Not supported value kind {element.ValueKind}"); + } + } + + public static byte[] GetBytesFromBase64(this JsonElement element, string format) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + + return format switch + { + "U" => TypeFormatters.FromBase64UrlString(element.GetRequiredString()), + "D" => element.GetBytesFromBase64(), + _ => throw new ArgumentException($"Format is not supported: '{format}'", nameof(format)) + }; + } + + public static DateTimeOffset GetDateTimeOffset(this JsonElement element, string format) => format switch + { + "U" when element.ValueKind == JsonValueKind.Number => DateTimeOffset.FromUnixTimeSeconds(element.GetInt64()), + _ => TypeFormatters.ParseDateTimeOffset(element.GetString(), format) + }; + + public static TimeSpan GetTimeSpan(this JsonElement element, string format) => TypeFormatters.ParseTimeSpan(element.GetString(), format); + + public static char GetChar(this JsonElement element) + { + if (element.ValueKind == JsonValueKind.String) + { + string text = element.GetString(); + if (text == null || text.Length != 1) + { + throw new NotSupportedException($"Cannot convert \"{text}\" to a char"); + } + return text[0]; + } + else + { + throw new NotSupportedException($"Cannot convert {element.ValueKind} to a char"); + } + } + + [Conditional("DEBUG")] + public static void ThrowNonNullablePropertyIsNull(this JsonProperty @property) + { + throw new JsonException($"A property '{@property.Name}' defined as non-nullable but received as null from the service. This exception only happens in DEBUG builds of the library and would be ignored in the release build"); + } + + public static string GetRequiredString(this JsonElement element) + { + string value = element.GetString(); + if (value == null) + { + throw new InvalidOperationException($"The requested operation requires an element of type 'String', but the target element has type '{element.ValueKind}'."); + } + return value; + } + + public static void WriteStringValue(this Utf8JsonWriter writer, DateTimeOffset value, string format) + { + writer.WriteStringValue(TypeFormatters.ToString(value, format)); + } + + public static void WriteStringValue(this Utf8JsonWriter writer, DateTime value, string format) + { + writer.WriteStringValue(TypeFormatters.ToString(value, format)); + } + + public static void WriteStringValue(this Utf8JsonWriter writer, TimeSpan value, string format) + { + writer.WriteStringValue(TypeFormatters.ToString(value, format)); + } + + public static void WriteStringValue(this Utf8JsonWriter writer, char value) + { + writer.WriteStringValue(value.ToString(CultureInfo.InvariantCulture)); + } + + public static void WriteBase64StringValue(this Utf8JsonWriter writer, byte[] value, string format) + { + if (value == null) + { + writer.WriteNullValue(); + return; + } + switch (format) + { + case "U": + writer.WriteStringValue(TypeFormatters.ToBase64UrlString(value)); + break; + case "D": + writer.WriteBase64StringValue(value); + break; + default: + throw new ArgumentException($"Format is not supported: '{format}'", nameof(format)); + } + } + + public static void WriteNumberValue(this Utf8JsonWriter writer, DateTimeOffset value, string format) + { + if (format != "U") + { + throw new ArgumentOutOfRangeException(nameof(format), "Only 'U' format is supported when writing a DateTimeOffset as a Number."); + } + writer.WriteNumberValue(value.ToUnixTimeSeconds()); + } + + public static void WriteObjectValue(this Utf8JsonWriter writer, T value, ModelReaderWriterOptions options = null) + { + switch (value) + { + case null: + writer.WriteNullValue(); + break; + case IJsonModel jsonModel: + jsonModel.Write(writer, options ?? WireOptions); + break; + case byte[] bytes: + writer.WriteBase64StringValue(bytes); + break; + case BinaryData bytes0: + writer.WriteBase64StringValue(bytes0); + break; + case JsonElement json: + json.WriteTo(writer); + break; + case int i: + writer.WriteNumberValue(i); + break; + case decimal d: + writer.WriteNumberValue(d); + break; + case double d0: + if (double.IsNaN(d0)) + { + writer.WriteStringValue("NaN"); + } + else + { + writer.WriteNumberValue(d0); + } + break; + case float f: + writer.WriteNumberValue(f); + break; + case long l: + writer.WriteNumberValue(l); + break; + case string s: + writer.WriteStringValue(s); + break; + case bool b: + writer.WriteBooleanValue(b); + break; + case Guid g: + writer.WriteStringValue(g); + break; + case DateTimeOffset dateTimeOffset: + writer.WriteStringValue(dateTimeOffset, "O"); + break; + case DateTime dateTime: + writer.WriteStringValue(dateTime, "O"); + break; + case IEnumerable> enumerable: + writer.WriteStartObject(); + foreach (var pair in enumerable) + { + writer.WritePropertyName(pair.Key); + writer.WriteObjectValue(pair.Value, options); + } + writer.WriteEndObject(); + break; + case IEnumerable objectEnumerable: + writer.WriteStartArray(); + foreach (var item in objectEnumerable) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + break; + case TimeSpan timeSpan: + writer.WriteStringValue(timeSpan, "P"); + break; + default: + throw new NotSupportedException($"Not supported type {value.GetType()}"); + } + } + + public static void WriteObjectValue(this Utf8JsonWriter writer, object value, ModelReaderWriterOptions options = null) + { + writer.WriteObjectValue(value, options); + } + + public static BinaryData GetUtf8Bytes(this JsonElement element) + { +#if NET9_0_OR_GREATER + return new global::System.BinaryData(global::System.Runtime.InteropServices.JsonMarshal.GetRawUtf8Value(element).ToArray()); +#else + return BinaryData.FromString(element.GetRawText()); +#endif + } + } +} diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/body-optionality/src/Generated/Internal/SerializationFormat.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/body-optionality/src/Generated/Internal/SerializationFormat.cs new file mode 100644 index 00000000000..a6386dbb19e --- /dev/null +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/body-optionality/src/Generated/Internal/SerializationFormat.cs @@ -0,0 +1,46 @@ +// + +#nullable disable + +namespace Parameters.BodyOptionality +{ + internal enum SerializationFormat + { + /// The default serialization format. + Default = 0, + /// The RFC1123 date time format. + DateTime_RFC1123 = 1, + /// The RFC3339 date time format. + DateTime_RFC3339 = 2, + /// The RFC7231 date time format. + DateTime_RFC7231 = 3, + /// The ISO8601 date time format. + DateTime_ISO8601 = 4, + /// The Unix date time format. + DateTime_Unix = 5, + /// The ISO8601 date format. + Date_ISO8601 = 6, + /// The ISO8601 duration format. + Duration_ISO8601 = 7, + /// The constant duration format. + Duration_Constant = 8, + /// The seconds duration format. + Duration_Seconds = 9, + /// The seconds duration format with float precision. + Duration_Seconds_Float = 10, + /// The seconds duration format with double precision. + Duration_Seconds_Double = 11, + /// The milliseconds duration format. + Duration_Milliseconds = 12, + /// The milliseconds duration format with float precision. + Duration_Milliseconds_Float = 13, + /// The milliseconds duration format with double precision. + Duration_Milliseconds_Double = 14, + /// The ISO8601 time format. + Time_ISO8601 = 15, + /// The Base64Url bytes format. + Bytes_Base64Url = 16, + /// The Base64 bytes format. + Bytes_Base64 = 17 + } +} diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/body-optionality/src/Generated/Internal/TypeFormatters.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/body-optionality/src/Generated/Internal/TypeFormatters.cs new file mode 100644 index 00000000000..f4aa41863b6 --- /dev/null +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/body-optionality/src/Generated/Internal/TypeFormatters.cs @@ -0,0 +1,178 @@ +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Globalization; +using System.Xml; + +namespace Parameters.BodyOptionality +{ + internal static partial class TypeFormatters + { + private const string RoundtripZFormat = "yyyy-MM-ddTHH:mm:ss.fffffffZ"; + public const string DefaultNumberFormat = "G"; + + public static string ToString(bool value) => value ? "true" : "false"; + + public static string ToString(DateTime value, string format) => value.Kind switch + { + DateTimeKind.Utc => ToString((DateTimeOffset)value, format), + _ => throw new NotSupportedException($"DateTime {value} has a Kind of {value.Kind}. Generated clients require it to be UTC. You can call DateTime.SpecifyKind to change Kind property value to DateTimeKind.Utc.") + }; + + public static string ToString(DateTimeOffset value, string format) => format switch + { + "D" => value.ToString("yyyy-MM-dd", CultureInfo.InvariantCulture), + "U" => value.ToUnixTimeSeconds().ToString(CultureInfo.InvariantCulture), + "O" => value.ToUniversalTime().ToString(RoundtripZFormat, CultureInfo.InvariantCulture), + "o" => value.ToUniversalTime().ToString(RoundtripZFormat, CultureInfo.InvariantCulture), + "R" => value.ToString("r", CultureInfo.InvariantCulture), + _ => value.ToString(format, CultureInfo.InvariantCulture) + }; + + public static string ToString(TimeSpan value, string format) => format switch + { + "P" => XmlConvert.ToString(value), + _ => value.ToString(format, CultureInfo.InvariantCulture) + }; + + public static string ToString(byte[] value, string format) => format switch + { + "U" => ToBase64UrlString(value), + "D" => Convert.ToBase64String(value), + _ => throw new ArgumentException($"Format is not supported: '{format}'", nameof(format)) + }; + + public static string ToBase64UrlString(byte[] value) + { + int numWholeOrPartialInputBlocks = checked (value.Length + 2) / 3; + int size = checked (numWholeOrPartialInputBlocks * 4); + char[] output = new char[size]; + + int numBase64Chars = Convert.ToBase64CharArray(value, 0, value.Length, output, 0); + + int i = 0; + for (; i < numBase64Chars; i++) + { + char ch = output[i]; + if (ch == '+') + { + output[i] = '-'; + } + else + { + if (ch == '/') + { + output[i] = '_'; + } + else + { + if (ch == '=') + { + break; + } + } + } + } + + return new string(output, 0, i); + } + + public static byte[] FromBase64UrlString(string value) + { + int paddingCharsToAdd = (value.Length % 4) switch + { + 0 => 0, + 2 => 2, + 3 => 1, + _ => throw new InvalidOperationException("Malformed input") + }; + char[] output = new char[(value.Length + paddingCharsToAdd)]; + int i = 0; + for (; i < value.Length; i++) + { + char ch = value[i]; + if (ch == '-') + { + output[i] = '+'; + } + else + { + if (ch == '_') + { + output[i] = '/'; + } + else + { + output[i] = ch; + } + } + } + + for (; i < output.Length; i++) + { + output[i] = '='; + } + + return Convert.FromBase64CharArray(output, 0, output.Length); + } + + public static DateTimeOffset ParseDateTimeOffset(string value, string format) => format switch + { + "U" => DateTimeOffset.FromUnixTimeSeconds(long.Parse(value, CultureInfo.InvariantCulture)), + _ => DateTimeOffset.Parse(value, CultureInfo.InvariantCulture, DateTimeStyles.AssumeUniversal) + }; + + public static TimeSpan ParseTimeSpan(string value, string format) => format switch + { + "P" => XmlConvert.ToTimeSpan(value), + _ => TimeSpan.ParseExact(value, format, CultureInfo.InvariantCulture) + }; + + public static string ToFormatSpecifier(SerializationFormat format) => format switch + { + SerializationFormat.DateTime_RFC1123 => "R", + SerializationFormat.DateTime_RFC3339 => "O", + SerializationFormat.DateTime_RFC7231 => "R", + SerializationFormat.DateTime_ISO8601 => "O", + SerializationFormat.Date_ISO8601 => "D", + SerializationFormat.DateTime_Unix => "U", + SerializationFormat.Bytes_Base64Url => "U", + SerializationFormat.Bytes_Base64 => "D", + SerializationFormat.Duration_ISO8601 => "P", + SerializationFormat.Duration_Constant => "c", + SerializationFormat.Duration_Seconds => "%s", + SerializationFormat.Duration_Seconds_Float => "s\\.FFF", + SerializationFormat.Duration_Seconds_Double => "s\\.FFFFFF", + SerializationFormat.Time_ISO8601 => "T", + _ => null + }; + + public static string ConvertToString(object value, SerializationFormat format = SerializationFormat.Default) + { + string formatSpecifier = ToFormatSpecifier(format); + + return value switch + { + null => "null", + string s => s, + bool b => ToString(b), + int or float or double or long or decimal => ((IFormattable)value).ToString(DefaultNumberFormat, CultureInfo.InvariantCulture), + byte[] b0 when formatSpecifier != null => ToString(b0, formatSpecifier), + IEnumerable s0 => string.Join(",", s0), + DateTimeOffset dateTime when formatSpecifier != null => ToString(dateTime, formatSpecifier), + TimeSpan timeSpan when format == SerializationFormat.Duration_Seconds => Convert.ToInt32(timeSpan.TotalSeconds).ToString(CultureInfo.InvariantCulture), + TimeSpan timeSpan0 when format == SerializationFormat.Duration_Seconds_Float || format == SerializationFormat.Duration_Seconds_Double => timeSpan0.TotalSeconds.ToString(CultureInfo.InvariantCulture), + TimeSpan timeSpan1 when format == SerializationFormat.Duration_Milliseconds => Convert.ToInt32(timeSpan1.TotalMilliseconds).ToString(CultureInfo.InvariantCulture), + TimeSpan timeSpan2 when format == SerializationFormat.Duration_Milliseconds_Float || format == SerializationFormat.Duration_Milliseconds_Double => timeSpan2.TotalMilliseconds.ToString(CultureInfo.InvariantCulture), + TimeSpan timeSpan3 when formatSpecifier != null => ToString(timeSpan3, formatSpecifier), + TimeSpan timeSpan4 => XmlConvert.ToString(timeSpan4), + Guid guid => guid.ToString(), + BinaryData binaryData => ConvertToString(binaryData.ToArray(), format), + _ => value.ToString() + }; + } + } +} diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/body-optionality/src/Generated/Models/BodyModel.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/body-optionality/src/Generated/Models/BodyModel.Serialization.cs index 7f142275b66..a762581a3f2 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/body-optionality/src/Generated/Models/BodyModel.Serialization.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/body-optionality/src/Generated/Models/BodyModel.Serialization.cs @@ -5,32 +5,146 @@ using System; using System.ClientModel; using System.ClientModel.Primitives; +using System.Collections.Generic; using System.Text.Json; namespace Parameters.BodyOptionality { + /// The BodyModel. public partial class BodyModel : IJsonModel { - internal BodyModel() => throw null; + /// Initializes a new instance of for deserialization. + internal BodyModel() + { + } - protected virtual BodyModel PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; + /// The data to parse. + /// The client options for reading and writing models. + protected virtual BodyModel PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + using (JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions)) + { + return DeserializeBodyModel(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(BodyModel)} does not support reading '{options.Format}' format."); + } + } - protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) => throw null; + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, ParametersBodyOptionalityContext.Default); + default: + throw new FormatException($"The model {nameof(BodyModel)} does not support writing '{options.Format}' format."); + } + } - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => throw null; + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); - BodyModel IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => throw null; + /// The data to parse. + /// The client options for reading and writing models. + BodyModel IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => throw null; + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - public static implicit operator BinaryContent(BodyModel bodyModel) => throw null; + /// The to serialize into . + public static implicit operator BinaryContent(BodyModel bodyModel) + { + if (bodyModel == null) + { + return null; + } + return BinaryContent.Create(bodyModel, ModelSerializationExtensions.WireOptions); + } - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; + /// The JSON writer. + /// The client options for reading and writing models. + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } - protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(BodyModel)} does not support writing '{format}' format."); + } + writer.WritePropertyName("name"u8); + writer.WriteStringValue(Name); + if (options.Format != "W" && _additionalBinaryDataProperties != null) + { + foreach (var item in _additionalBinaryDataProperties) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } - BodyModel IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => throw null; + /// The JSON reader. + /// The client options for reading and writing models. + BodyModel IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); - protected virtual BodyModel JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => throw null; + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual BodyModel JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(BodyModel)} does not support reading '{format}' format."); + } + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeBodyModel(document.RootElement, options); + } + + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static BodyModel DeserializeBodyModel(JsonElement element, ModelReaderWriterOptions options) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string name = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) + { + if (prop.NameEquals("name"u8)) + { + name = prop.Value.GetString(); + continue; + } + if (options.Format != "W") + { + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); + } + } + return new BodyModel(name, additionalBinaryDataProperties); + } } } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/body-optionality/src/Generated/Models/BodyModel.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/body-optionality/src/Generated/Models/BodyModel.cs index 5726118c284..83f9e5e1510 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/body-optionality/src/Generated/Models/BodyModel.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/body-optionality/src/Generated/Models/BodyModel.cs @@ -2,12 +2,37 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Parameters.BodyOptionality { + /// The BodyModel. public partial class BodyModel { - public BodyModel(string name) => throw null; + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; + + /// Initializes a new instance of . + /// + /// is null. + public BodyModel(string name) + { + Argument.AssertNotNull(name, nameof(name)); + + Name = name; + } + + /// Initializes a new instance of . + /// + /// Keeps track of any properties unknown to the library. + internal BodyModel(string name, IDictionary additionalBinaryDataProperties) + { + Name = name; + _additionalBinaryDataProperties = additionalBinaryDataProperties; + } - public string Name => throw null; + /// Gets the Name. + public string Name { get; } } } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/body-optionality/src/Generated/Models/ParametersBodyOptionalityContext.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/body-optionality/src/Generated/Models/ParametersBodyOptionalityContext.cs index cf75f43d92f..1886e039e11 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/body-optionality/src/Generated/Models/ParametersBodyOptionalityContext.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/body-optionality/src/Generated/Models/ParametersBodyOptionalityContext.cs @@ -6,6 +6,10 @@ namespace Parameters.BodyOptionality { + /// + /// Context class which will be filled in by the System.ClientModel.SourceGeneration. + /// For more information + /// [ModelReaderWriterBuildable(typeof(BodyModel))] public partial class ParametersBodyOptionalityContext : ModelReaderWriterContext { diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/body-optionality/src/Generated/OptionalExplicit.RestClient.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/body-optionality/src/Generated/OptionalExplicit.RestClient.cs new file mode 100644 index 00000000000..e3f5f52c832 --- /dev/null +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/body-optionality/src/Generated/OptionalExplicit.RestClient.cs @@ -0,0 +1,50 @@ +// + +#nullable disable + +using System.ClientModel; +using System.ClientModel.Primitives; +using Parameters.BodyOptionality; + +namespace Parameters.BodyOptionality._OptionalExplicit +{ + /// + public partial class OptionalExplicit + { + private static PipelineMessageClassifier _pipelineMessageClassifier204; + + private static PipelineMessageClassifier PipelineMessageClassifier204 => _pipelineMessageClassifier204 ??= PipelineMessageClassifier.Create(stackalloc ushort[] { 204 }); + + internal PipelineMessage CreateSetRequest(BinaryContent content, RequestOptions options) + { + ClientUriBuilder uri = new ClientUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/parameters/body-optionality/optional-explicit/set", false); + PipelineMessage message = Pipeline.CreateMessage(uri.ToUri(), "POST", PipelineMessageClassifier204); + PipelineRequest request = message.Request; + if ("application/json" != null) + { + request.Headers.Set("Content-Type", "application/json"); + } + request.Content = content; + message.Apply(options); + return message; + } + + internal PipelineMessage CreateOmitRequest(BinaryContent content, RequestOptions options) + { + ClientUriBuilder uri = new ClientUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/parameters/body-optionality/optional-explicit/omit", false); + PipelineMessage message = Pipeline.CreateMessage(uri.ToUri(), "POST", PipelineMessageClassifier204); + PipelineRequest request = message.Request; + if ("application/json" != null) + { + request.Headers.Set("Content-Type", "application/json"); + } + request.Content = content; + message.Apply(options); + return message; + } + } +} diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/body-optionality/src/Generated/OptionalExplicit.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/body-optionality/src/Generated/OptionalExplicit.cs index 5d4de240634..66afe277ed8 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/body-optionality/src/Generated/OptionalExplicit.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/body-optionality/src/Generated/OptionalExplicit.cs @@ -11,28 +11,134 @@ namespace Parameters.BodyOptionality._OptionalExplicit { + /// The OptionalExplicit sub-client. public partial class OptionalExplicit { - protected OptionalExplicit() => throw null; + private readonly Uri _endpoint; - internal OptionalExplicit(ClientPipeline pipeline, Uri endpoint) => throw null; + /// Initializes a new instance of OptionalExplicit for mocking. + protected OptionalExplicit() + { + } - public ClientPipeline Pipeline => throw null; + /// Initializes a new instance of OptionalExplicit. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// Service endpoint. + internal OptionalExplicit(ClientPipeline pipeline, Uri endpoint) + { + _endpoint = endpoint; + Pipeline = pipeline; + } - public virtual ClientResult Set(BinaryContent content, RequestOptions options = null) => throw null; + /// The HTTP pipeline for sending and receiving REST requests and responses. + public ClientPipeline Pipeline { get; } - public virtual Task SetAsync(BinaryContent content, RequestOptions options = null) => throw null; + /// + /// [Protocol Method] Set + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// The content to send as the body of the request. + /// The request options, which can override default behaviors of the client pipeline on a per-call basis. + /// Service returned a non-success status code. + /// The response returned from the service. + public virtual ClientResult Set(BinaryContent content, RequestOptions options = null) + { + using PipelineMessage message = CreateSetRequest(content, options); + return ClientResult.FromResponse(Pipeline.ProcessMessage(message, options)); + } - public virtual ClientResult Set(BodyModel body = default, CancellationToken cancellationToken = default) => throw null; + /// + /// [Protocol Method] Set + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// The content to send as the body of the request. + /// The request options, which can override default behaviors of the client pipeline on a per-call basis. + /// Service returned a non-success status code. + /// The response returned from the service. + public virtual async Task SetAsync(BinaryContent content, RequestOptions options = null) + { + using PipelineMessage message = CreateSetRequest(content, options); + return ClientResult.FromResponse(await Pipeline.ProcessMessageAsync(message, options).ConfigureAwait(false)); + } - public virtual Task SetAsync(BodyModel body = default, CancellationToken cancellationToken = default) => throw null; + /// Set. + /// + /// The cancellation token that can be used to cancel the operation. + /// Service returned a non-success status code. + public virtual ClientResult Set(BodyModel body = default, CancellationToken cancellationToken = default) + { + return Set(body, cancellationToken.ToRequestOptions()); + } - public virtual ClientResult Omit(BinaryContent content, RequestOptions options = null) => throw null; + /// Set. + /// + /// The cancellation token that can be used to cancel the operation. + /// Service returned a non-success status code. + public virtual async Task SetAsync(BodyModel body = default, CancellationToken cancellationToken = default) + { + return await SetAsync(body, cancellationToken.ToRequestOptions()).ConfigureAwait(false); + } - public virtual Task OmitAsync(BinaryContent content, RequestOptions options = null) => throw null; + /// + /// [Protocol Method] Omit + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// The content to send as the body of the request. + /// The request options, which can override default behaviors of the client pipeline on a per-call basis. + /// Service returned a non-success status code. + /// The response returned from the service. + public virtual ClientResult Omit(BinaryContent content, RequestOptions options = null) + { + using PipelineMessage message = CreateOmitRequest(content, options); + return ClientResult.FromResponse(Pipeline.ProcessMessage(message, options)); + } - public virtual ClientResult Omit(BodyModel body = default, CancellationToken cancellationToken = default) => throw null; + /// + /// [Protocol Method] Omit + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// The content to send as the body of the request. + /// The request options, which can override default behaviors of the client pipeline on a per-call basis. + /// Service returned a non-success status code. + /// The response returned from the service. + public virtual async Task OmitAsync(BinaryContent content, RequestOptions options = null) + { + using PipelineMessage message = CreateOmitRequest(content, options); + return ClientResult.FromResponse(await Pipeline.ProcessMessageAsync(message, options).ConfigureAwait(false)); + } - public virtual Task OmitAsync(BodyModel body = default, CancellationToken cancellationToken = default) => throw null; + /// Omit. + /// + /// The cancellation token that can be used to cancel the operation. + /// Service returned a non-success status code. + public virtual ClientResult Omit(BodyModel body = default, CancellationToken cancellationToken = default) + { + return Omit(body, cancellationToken.ToRequestOptions()); + } + + /// Omit. + /// + /// The cancellation token that can be used to cancel the operation. + /// Service returned a non-success status code. + public virtual async Task OmitAsync(BodyModel body = default, CancellationToken cancellationToken = default) + { + return await OmitAsync(body, cancellationToken.ToRequestOptions()).ConfigureAwait(false); + } } } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/body-optionality/src/Generated/ParametersBodyOptionalityModelFactory.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/body-optionality/src/Generated/ParametersBodyOptionalityModelFactory.cs index c810ed2aaa2..5253face1fb 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/body-optionality/src/Generated/ParametersBodyOptionalityModelFactory.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/body-optionality/src/Generated/ParametersBodyOptionalityModelFactory.cs @@ -4,8 +4,15 @@ namespace Parameters.BodyOptionality { + /// A factory class for creating instances of the models for mocking. public static partial class ParametersBodyOptionalityModelFactory { - public static BodyModel BodyModel(string name = default) => throw null; + /// The BodyModel. + /// + /// A new instance for mocking. + public static BodyModel BodyModel(string name = default) + { + return new BodyModel(name, additionalBinaryDataProperties: null); + } } } From 17e468d38227a70c53de736dfb2158ba3b061481 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 11 Mar 2026 20:14:04 +0000 Subject: [PATCH 19/38] test: add tests for ClientSettings, settings constructor, and IConfiguration constructor body Add test coverage for the new configuration-based client initialization features: - ClientOptionsProviderTests: TestConfigurationSectionConstructorBody validates the IConfigurationSection constructor has proper guard statements, version initialization, and config section reading. - ClientProviderTests: TestBuildConstructors_SettingsConstructor validates the settings constructor is public, has correct parameter, uses this() initializer, and has empty body. TestBuildConstructors_NoSettingsConstructor_WhenNoEndpoint validates settings constructor is not generated without an endpoint. - ClientSettingsProviderTests: New test class validating name, base type, properties, BindCore method, experimental attribute, and namespace. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- .../Providers/ClientOptionsProviderTests.cs | 40 ++++ .../ClientProviders/ClientProviderTests.cs | 52 ++++++ .../Providers/ClientSettingsProviderTests.cs | 176 ++++++++++++++++++ 3 files changed, 268 insertions(+) create mode 100644 packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientSettingsProviderTests.cs diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientOptionsProviderTests.cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientOptionsProviderTests.cs index 6c62aa632b7..ffc5670c4da 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientOptionsProviderTests.cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientOptionsProviderTests.cs @@ -161,6 +161,46 @@ public void TestConstructors(bool containsApiVersions) } } + [TestCase(true, Category = ApiVersionsCategory)] + [TestCase(false)] + public void TestConfigurationSectionConstructorBody(bool containsApiVersions) + { + var client = InputFactory.Client("TestClient"); + var clientProvider = new ClientProvider(client); + var clientOptionsProvider = new ClientOptionsProvider(client, clientProvider); + + var ctors = clientOptionsProvider.Constructors; + var configSectionCtor = ctors.FirstOrDefault(c => c.Signature.Parameters.Any(p => p.Name == "section")); + Assert.IsNotNull(configSectionCtor); + + // Validate it's internal + Assert.AreEqual(MethodSignatureModifiers.Internal, configSectionCtor!.Signature.Modifiers); + + // Validate it has the base(section) initializer + Assert.IsNotNull(configSectionCtor.Signature.Initializer); + Assert.IsTrue(configSectionCtor.Signature.Initializer!.IsBase); + + // Validate the body is not empty + var body = configSectionCtor.BodyStatements; + Assert.IsNotNull(body); + + var bodyString = body!.ToDisplayString(); + + // Always has a guard statement + Assert.IsTrue(bodyString.Contains("section is null") || bodyString.Contains("Exists"), + "Configuration section constructor should have a guard statement"); + + if (containsApiVersions) + { + // When API versions exist, Version should be set to latest before guard + Assert.IsTrue(bodyString.Contains("Version ="), + "Configuration constructor should set Version when API versions exist"); + // After guard, should read version from config + Assert.IsTrue(bodyString.Contains("section[\"Version\"]"), + "Configuration constructor should read Version from config section"); + } + } + [TestCase(true, Category = ApiVersionsCategory)] [TestCase(false)] public void TestProperties(bool containsApiVersions) diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientProviders/ClientProviderTests.cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientProviders/ClientProviderTests.cs index 81767deb6c0..9625b25559b 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientProviders/ClientProviderTests.cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientProviders/ClientProviderTests.cs @@ -588,6 +588,58 @@ public void TestBuildConstructors_SimplifiedWithOptions_WhenDefaultEndpoint() Assert.IsFalse(optionsArg is NewInstanceExpression, "Options argument should be the parameter itself, not a new instance"); } + [TestCase(Category = KeyAuthCategory)] + [TestCase(Category = OAuth2Category)] + public void TestBuildConstructors_SettingsConstructor() + { + var inputParameters = new List + { + InputFactory.EndpointParameter( + KnownParameters.Endpoint.Name, + InputPrimitiveType.String, + defaultValue: InputFactory.Constant.String("https://default.endpoint.io"), + scope: InputParameterScope.Client, + isEndpoint: true) + }; + var client = InputFactory.Client(TestClientName, parameters: [.. inputParameters]); + var clientProvider = new ClientProvider(client); + + Assert.IsNotNull(clientProvider); + + var constructors = clientProvider.Constructors; + var settingsConstructor = constructors.FirstOrDefault(IsSettingsConstructor); + Assert.IsNotNull(settingsConstructor, "Expected a settings constructor"); + + // Validate it's public + Assert.AreEqual(MethodSignatureModifiers.Public, settingsConstructor!.Signature.Modifiers); + + // Validate it has exactly 1 parameter: settings + Assert.AreEqual(1, settingsConstructor.Signature.Parameters.Count); + Assert.AreEqual("settings", settingsConstructor.Signature.Parameters[0].Name); + + // Validate it's a pass-through (body is empty) + Assert.AreEqual(MethodBodyStatement.Empty, settingsConstructor.BodyStatements); + + // Validate it has a this(...) initializer + var initializer = settingsConstructor.Signature.Initializer; + Assert.IsNotNull(initializer); + Assert.IsFalse(initializer!.IsBase, "Settings constructor should use this() initializer, not base()"); + } + + [Test] + public void TestBuildConstructors_NoSettingsConstructor_WhenNoEndpoint() + { + // No endpoint parameter — settings constructor should not be generated + var client = InputFactory.Client(TestClientName); + var clientProvider = new ClientProvider(client); + + Assert.IsNotNull(clientProvider); + + var constructors = clientProvider.Constructors; + var settingsConstructor = constructors.FirstOrDefault(IsSettingsConstructor); + Assert.IsNull(settingsConstructor, "Settings constructor should not be generated when there is no endpoint"); + } + [Test] public void TestBuildConstructors_DeduplicatesParametersBySerializedName() { diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientSettingsProviderTests.cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientSettingsProviderTests.cs new file mode 100644 index 00000000000..bc362bb5601 --- /dev/null +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientSettingsProviderTests.cs @@ -0,0 +1,176 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using System; +using System.Linq; +using Microsoft.TypeSpec.Generator.ClientModel.Providers; +using Microsoft.TypeSpec.Generator.Input; +using Microsoft.TypeSpec.Generator.Primitives; +using Microsoft.TypeSpec.Generator.Tests.Common; +using NUnit.Framework; + +namespace Microsoft.TypeSpec.Generator.ClientModel.Tests.Providers +{ + public class ClientSettingsProviderTests + { + [SetUp] + public void SetUp() + { + MockHelpers.LoadMockGenerator(); + } + + [Test] + public void TestName() + { + var client = InputFactory.Client("TestClient"); + var clientProvider = new ClientProvider(client); + var settingsProvider = clientProvider.ClientSettings; + + Assert.IsNotNull(settingsProvider); + Assert.AreEqual("TestClientSettings", settingsProvider!.Name); + } + + [Test] + public void TestBaseType() + { + var client = InputFactory.Client("TestClient"); + var clientProvider = new ClientProvider(client); + var settingsProvider = clientProvider.ClientSettings; + + Assert.IsNotNull(settingsProvider); + Assert.AreEqual(ClientSettingsProvider.ClientSettingsType, settingsProvider!.Type.BaseType); + } + + [Test] + public void TestProperties_WithEndpoint() + { + var inputParameters = new[] + { + InputFactory.EndpointParameter( + "endpoint", + InputPrimitiveType.String, + defaultValue: InputFactory.Constant.String("https://default.endpoint.io"), + scope: InputParameterScope.Client, + isEndpoint: true) + }; + var client = InputFactory.Client("TestClient", parameters: inputParameters); + var clientProvider = new ClientProvider(client); + var settingsProvider = clientProvider.ClientSettings; + + Assert.IsNotNull(settingsProvider); + + var properties = settingsProvider!.Properties; + // Should have Endpoint and Options properties + var endpointProp = properties.FirstOrDefault(p => p.Type.Equals(new CSharpType(typeof(Uri), isNullable: true))); + Assert.IsNotNull(endpointProp, "Settings should have an endpoint property"); + + var optionsProp = properties.FirstOrDefault(p => p.Name == "Options"); + Assert.IsNotNull(optionsProp, "Settings should have an Options property"); + } + + [Test] + public void TestProperties_NoEndpoint() + { + var client = InputFactory.Client("TestClient"); + var clientProvider = new ClientProvider(client); + var settingsProvider = clientProvider.ClientSettings; + + // Settings provider should exist but without endpoint-related properties + Assert.IsNotNull(settingsProvider); + + var endpointProp = settingsProvider!.Properties.FirstOrDefault(p => p.Type.Equals(new CSharpType(typeof(Uri), isNullable: true))); + Assert.IsNull(endpointProp, "Settings should not have an endpoint property when no endpoint parameter exists"); + } + + [Test] + public void TestBindCoreMethod_WithEndpoint() + { + var inputParameters = new[] + { + InputFactory.EndpointParameter( + "endpoint", + InputPrimitiveType.String, + defaultValue: InputFactory.Constant.String("https://default.endpoint.io"), + scope: InputParameterScope.Client, + isEndpoint: true) + }; + var client = InputFactory.Client("TestClient", parameters: inputParameters); + var clientProvider = new ClientProvider(client); + var settingsProvider = clientProvider.ClientSettings; + + Assert.IsNotNull(settingsProvider); + + var methods = settingsProvider!.Methods; + var bindCoreMethod = methods.FirstOrDefault(m => m.Signature.Name == "BindCore"); + Assert.IsNotNull(bindCoreMethod, "Settings should have a BindCore method"); + + // Validate it's protected override + Assert.AreEqual( + MethodSignatureModifiers.Protected | MethodSignatureModifiers.Override, + bindCoreMethod!.Signature.Modifiers); + + // Validate it has section parameter + Assert.AreEqual(1, bindCoreMethod.Signature.Parameters.Count); + Assert.AreEqual("section", bindCoreMethod.Signature.Parameters[0].Name); + + // Validate the body contains Uri.TryCreate for endpoint binding + var body = bindCoreMethod.BodyStatements; + Assert.IsNotNull(body); + var bodyString = body!.ToDisplayString(); + Assert.IsTrue(bodyString.Contains("TryCreate"), "BindCore should use Uri.TryCreate for endpoint binding"); + } + + [Test] + public void TestBindCoreMethod_WithOptionsSection() + { + var inputParameters = new[] + { + InputFactory.EndpointParameter( + "endpoint", + InputPrimitiveType.String, + defaultValue: InputFactory.Constant.String("https://default.endpoint.io"), + scope: InputParameterScope.Client, + isEndpoint: true) + }; + var client = InputFactory.Client("TestClient", parameters: inputParameters); + var clientProvider = new ClientProvider(client); + var settingsProvider = clientProvider.ClientSettings; + + Assert.IsNotNull(settingsProvider); + + var methods = settingsProvider!.Methods; + var bindCoreMethod = methods.FirstOrDefault(m => m.Signature.Name == "BindCore"); + Assert.IsNotNull(bindCoreMethod); + + var bodyString = bindCoreMethod!.BodyStatements!.ToDisplayString(); + // Should get the options section and create options from it + Assert.IsTrue(bodyString.Contains("GetSection") && bodyString.Contains("Options"), + "BindCore should get the Options section from configuration"); + } + + [Test] + public void TestExperimentalAttribute() + { + var client = InputFactory.Client("TestClient"); + var clientProvider = new ClientProvider(client); + var settingsProvider = clientProvider.ClientSettings; + + Assert.IsNotNull(settingsProvider); + + var attributes = settingsProvider!.Attributes; + Assert.IsNotNull(attributes); + Assert.IsTrue(attributes.Any(), "Settings should have an Experimental attribute"); + } + + [Test] + public void TestNamespace() + { + var client = InputFactory.Client("TestClient"); + var clientProvider = new ClientProvider(client); + var settingsProvider = clientProvider.ClientSettings; + + Assert.IsNotNull(settingsProvider); + Assert.AreEqual(clientProvider.Type.Namespace, settingsProvider!.Type.Namespace); + } + } +} From be7e6188bde5aa9ae5772c64e3e113ffe74150fa Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 11 Mar 2026 20:21:38 +0000 Subject: [PATCH 20/38] test: improve property assertion precision in ClientSettingsProviderTests Co-authored-by: JoshLove-msft <54595583+JoshLove-msft@users.noreply.github.com> --- .../test/Providers/ClientSettingsProviderTests.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientSettingsProviderTests.cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientSettingsProviderTests.cs index bc362bb5601..90819cfdbc4 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientSettingsProviderTests.cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientSettingsProviderTests.cs @@ -61,8 +61,8 @@ public void TestProperties_WithEndpoint() var properties = settingsProvider!.Properties; // Should have Endpoint and Options properties - var endpointProp = properties.FirstOrDefault(p => p.Type.Equals(new CSharpType(typeof(Uri), isNullable: true))); - Assert.IsNotNull(endpointProp, "Settings should have an endpoint property"); + var endpointProp = properties.FirstOrDefault(p => p.Name == "Endpoint" && p.Type.Equals(new CSharpType(typeof(Uri), isNullable: true))); + Assert.IsNotNull(endpointProp, "Settings should have an Endpoint property of type Uri?"); var optionsProp = properties.FirstOrDefault(p => p.Name == "Options"); Assert.IsNotNull(optionsProp, "Settings should have an Options property"); @@ -78,8 +78,8 @@ public void TestProperties_NoEndpoint() // Settings provider should exist but without endpoint-related properties Assert.IsNotNull(settingsProvider); - var endpointProp = settingsProvider!.Properties.FirstOrDefault(p => p.Type.Equals(new CSharpType(typeof(Uri), isNullable: true))); - Assert.IsNull(endpointProp, "Settings should not have an endpoint property when no endpoint parameter exists"); + var endpointProp = settingsProvider!.Properties.FirstOrDefault(p => p.Name == "Endpoint" && p.Type.Equals(new CSharpType(typeof(Uri), isNullable: true))); + Assert.IsNull(endpointProp, "Settings should not have an Endpoint property when no endpoint parameter exists"); } [Test] From 8666c955c9708a435294f2e45cdfd78be959cc27 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 11 Mar 2026 20:33:29 +0000 Subject: [PATCH 21/38] Add see-cref link to settings constructor XML docs Co-authored-by: JoshLove-msft <54595583+JoshLove-msft@users.noreply.github.com> --- .../src/Providers/ClientProvider.cs | 2 +- .../Local/Sample-TypeSpec/src/Generated/SampleTypeSpecClient.cs | 2 +- .../body-optionality/src/Generated/BodyOptionalityClient.cs | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Providers/ClientProvider.cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Providers/ClientProvider.cs index d8f4724b249..101904828d2 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Providers/ClientProvider.cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Providers/ClientProvider.cs @@ -697,7 +697,7 @@ private IEnumerable BuildSettingsConstructors() var settingsConstructor = new ConstructorProvider( new ConstructorSignature( Type, - $"Initializes a new instance of {Name} from settings.", + $"Initializes a new instance of {Name} from a .", MethodSignatureModifiers.Public, [settingsParam], attributes: [experimentalAttr], diff --git a/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/SampleTypeSpecClient.cs b/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/SampleTypeSpecClient.cs index 77b6c2cc6b4..7674fd653d7 100644 --- a/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/SampleTypeSpecClient.cs +++ b/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/SampleTypeSpecClient.cs @@ -92,7 +92,7 @@ public SampleTypeSpecClient(Uri endpoint, AuthenticationTokenProvider tokenProvi _apiVersion = options.Version; } - /// Initializes a new instance of SampleTypeSpecClient from settings. + /// Initializes a new instance of SampleTypeSpecClient from a . /// The settings for SampleTypeSpecClient. [Experimental("SCME0002")] public SampleTypeSpecClient(SampleTypeSpecClientSettings settings) : this(settings?.SampleTypeSpecUrl, settings?.CredentialProvider as AuthenticationTokenProvider, settings?.Options) diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/body-optionality/src/Generated/BodyOptionalityClient.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/body-optionality/src/Generated/BodyOptionalityClient.cs index 5c9725f7d91..6e2edbe7a0a 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/body-optionality/src/Generated/BodyOptionalityClient.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/body-optionality/src/Generated/BodyOptionalityClient.cs @@ -45,7 +45,7 @@ public BodyOptionalityClient(Uri endpoint, BodyOptionalityClientOptions options) { } - /// Initializes a new instance of BodyOptionalityClient from settings. + /// Initializes a new instance of BodyOptionalityClient from a . /// The settings for BodyOptionalityClient. [Experimental("SCME0002")] public BodyOptionalityClient(BodyOptionalityClientSettings settings) : this(AuthenticationPolicy.Create(settings), settings?.Endpoint, settings?.Options) From 0d1d6cf75164d6f86215dbd3f06c63ff67468e9b Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 11 Mar 2026 20:47:39 +0000 Subject: [PATCH 22/38] Sort LatestVersionsFields dictionary and add XML docs to ClientSettingsProvider Co-authored-by: JoshLove-msft <54595583+JoshLove-msft@users.noreply.github.com> --- .../src/Providers/ClientOptionsProvider.cs | 4 ++-- .../src/Providers/ClientSettingsProvider.cs | 3 +++ ...WithThreeServices_GeneratesExpectedClientOptions.cs | 10 +++++----- ...WithThreeServices_GeneratesExpectedClientOptions.cs | 10 +++++----- 4 files changed, 15 insertions(+), 12 deletions(-) diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Providers/ClientOptionsProvider.cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Providers/ClientOptionsProvider.cs index 16e9ea5bb65..a60fa8d273b 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Providers/ClientOptionsProvider.cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Providers/ClientOptionsProvider.cs @@ -306,7 +306,7 @@ private ConstructorProvider BuildConfigurationSectionConstructor() var body = new List(); if (LatestVersionsFields != null && VersionProperties != null) { - foreach (var (_, serviceVersionEnum) in LatestVersionsFields) + foreach (var (_, serviceVersionEnum) in LatestVersionsFields.OrderBy(kvp => kvp.Key.Name)) { if (VersionProperties.TryGetValue(serviceVersionEnum, out var versionProperty)) { @@ -325,7 +325,7 @@ private ConstructorProvider BuildConfigurationSectionConstructor() // Bind version properties from configuration (after guard, default already set before guard) if (LatestVersionsFields != null && VersionProperties != null) { - foreach (var (_, serviceVersionEnum) in LatestVersionsFields) + foreach (var (_, serviceVersionEnum) in LatestVersionsFields.OrderBy(kvp => kvp.Key.Name)) { if (VersionProperties.TryGetValue(serviceVersionEnum, out var versionProperty)) { diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Providers/ClientSettingsProvider.cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Providers/ClientSettingsProvider.cs index 300fe966f72..c866e72be13 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Providers/ClientSettingsProvider.cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Providers/ClientSettingsProvider.cs @@ -54,6 +54,9 @@ internal ClientSettingsProvider(InputClient inputClient, ClientProvider clientPr /// Gets non-endpoint, non-auth required parameters that have settings properties. internal IReadOnlyList OtherRequiredParams { get; } + protected override FormattableString BuildDescription() + => $"Settings for the {_clientProvider.Name} client, extending ."; + protected override string BuildRelativeFilePath() => Path.Combine("src", "Generated", $"{Name}.cs"); protected override string BuildName() => $"{_clientProvider.Name}Settings"; diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/TestData/ClientOptionsProviderTests/MultiServiceClient_WithThreeServices_GeneratesExpectedClientOptions.cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/TestData/ClientOptionsProviderTests/MultiServiceClient_WithThreeServices_GeneratesExpectedClientOptions.cs index bf32f96cbf8..1dffdca1dbb 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/TestData/ClientOptionsProviderTests/MultiServiceClient_WithThreeServices_GeneratesExpectedClientOptions.cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/TestData/ClientOptionsProviderTests/MultiServiceClient_WithThreeServices_GeneratesExpectedClientOptions.cs @@ -41,13 +41,17 @@ public TestClientOptions(global::Sample.TestClientOptions.ServiceKeyVaultVersion [global::System.Diagnostics.CodeAnalysis.ExperimentalAttribute("SCME0002")] internal TestClientOptions(global::Microsoft.Extensions.Configuration.IConfigurationSection section) : base(section) { + ServiceComputeApiVersion = "2024-07-01"; ServiceKeyVaultApiVersion = "7.5"; ServiceStorageApiVersion = "2024-01-01"; - ServiceComputeApiVersion = "2024-07-01"; if (((section is null) || !section.Exists())) { return; } + if ((section["ServiceComputeApiVersion"] is string serviceComputeApiVersion)) + { + this.ServiceComputeApiVersion = serviceComputeApiVersion; + } if ((section["ServiceKeyVaultApiVersion"] is string serviceKeyVaultApiVersion)) { this.ServiceKeyVaultApiVersion = serviceKeyVaultApiVersion; @@ -56,10 +60,6 @@ internal TestClientOptions(global::Microsoft.Extensions.Configuration.IConfigura { this.ServiceStorageApiVersion = serviceStorageApiVersion; } - if ((section["ServiceComputeApiVersion"] is string serviceComputeApiVersion)) - { - this.ServiceComputeApiVersion = serviceComputeApiVersion; - } } internal string ServiceComputeApiVersion { get; } diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/TestData/ClientOptionsProviderTests/MultiServiceCombinedClient_WithThreeServices_GeneratesExpectedClientOptions.cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/TestData/ClientOptionsProviderTests/MultiServiceCombinedClient_WithThreeServices_GeneratesExpectedClientOptions.cs index bf32f96cbf8..1dffdca1dbb 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/TestData/ClientOptionsProviderTests/MultiServiceCombinedClient_WithThreeServices_GeneratesExpectedClientOptions.cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/TestData/ClientOptionsProviderTests/MultiServiceCombinedClient_WithThreeServices_GeneratesExpectedClientOptions.cs @@ -41,13 +41,17 @@ public TestClientOptions(global::Sample.TestClientOptions.ServiceKeyVaultVersion [global::System.Diagnostics.CodeAnalysis.ExperimentalAttribute("SCME0002")] internal TestClientOptions(global::Microsoft.Extensions.Configuration.IConfigurationSection section) : base(section) { + ServiceComputeApiVersion = "2024-07-01"; ServiceKeyVaultApiVersion = "7.5"; ServiceStorageApiVersion = "2024-01-01"; - ServiceComputeApiVersion = "2024-07-01"; if (((section is null) || !section.Exists())) { return; } + if ((section["ServiceComputeApiVersion"] is string serviceComputeApiVersion)) + { + this.ServiceComputeApiVersion = serviceComputeApiVersion; + } if ((section["ServiceKeyVaultApiVersion"] is string serviceKeyVaultApiVersion)) { this.ServiceKeyVaultApiVersion = serviceKeyVaultApiVersion; @@ -56,10 +60,6 @@ internal TestClientOptions(global::Microsoft.Extensions.Configuration.IConfigura { this.ServiceStorageApiVersion = serviceStorageApiVersion; } - if ((section["ServiceComputeApiVersion"] is string serviceComputeApiVersion)) - { - this.ServiceComputeApiVersion = serviceComputeApiVersion; - } } internal string ServiceComputeApiVersion { get; } From 272ad435e562dbbb061249e99a12b7ee8a7f5196 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 11 Mar 2026 21:12:21 +0000 Subject: [PATCH 23/38] fix: update ClientSettings XML doc to follow pattern "Represents the settings used to configure a {Client} that can be loaded from an IConfigurationSection" Co-authored-by: JoshLove-msft <54595583+JoshLove-msft@users.noreply.github.com> --- .../src/Providers/ClientSettingsProvider.cs | 2 +- .../Generated/SampleTypeSpecClientSettings.cs | 2 +- .../BodyOptionalityClient.RestClient.cs | 43 --- .../src/Generated/BodyOptionalityClient.cs | 208 ++------------ .../Generated/BodyOptionalityClientOptions.cs | 16 +- .../BodyOptionalityClientSettings.cs | 28 +- .../src/Generated/Internal/Argument.cs | 110 -------- .../Internal/CancellationTokenExtensions.cs | 14 - .../Internal/ChangeTrackingDictionary.cs | 186 ------------ .../Internal/ClientPipelineExtensions.cs | 67 ----- .../Generated/Internal/ClientUriBuilder.cs | 181 ------------ .../Internal/CodeGenMemberAttribute.cs | 17 -- .../Internal/CodeGenSerializationAttribute.cs | 45 --- .../Internal/CodeGenSuppressAttribute.cs | 26 -- .../Internal/CodeGenTypeAttribute.cs | 21 -- .../src/Generated/Internal/ErrorResult.cs | 24 -- .../Internal/ModelSerializationExtensions.cs | 265 ------------------ .../Generated/Internal/SerializationFormat.cs | 46 --- .../src/Generated/Internal/TypeFormatters.cs | 178 ------------ .../Models/BodyModel.Serialization.cs | 136 +-------- .../src/Generated/Models/BodyModel.cs | 29 +- .../ParametersBodyOptionalityContext.cs | 4 - .../Generated/OptionalExplicit.RestClient.cs | 50 ---- .../src/Generated/OptionalExplicit.cs | 128 +-------- .../ParametersBodyOptionalityModelFactory.cs | 9 +- 25 files changed, 66 insertions(+), 1769 deletions(-) delete mode 100644 packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/body-optionality/src/Generated/BodyOptionalityClient.RestClient.cs delete mode 100644 packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/body-optionality/src/Generated/Internal/Argument.cs delete mode 100644 packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/body-optionality/src/Generated/Internal/CancellationTokenExtensions.cs delete mode 100644 packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/body-optionality/src/Generated/Internal/ChangeTrackingDictionary.cs delete mode 100644 packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/body-optionality/src/Generated/Internal/ClientPipelineExtensions.cs delete mode 100644 packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/body-optionality/src/Generated/Internal/ClientUriBuilder.cs delete mode 100644 packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/body-optionality/src/Generated/Internal/CodeGenMemberAttribute.cs delete mode 100644 packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/body-optionality/src/Generated/Internal/CodeGenSerializationAttribute.cs delete mode 100644 packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/body-optionality/src/Generated/Internal/CodeGenSuppressAttribute.cs delete mode 100644 packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/body-optionality/src/Generated/Internal/CodeGenTypeAttribute.cs delete mode 100644 packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/body-optionality/src/Generated/Internal/ErrorResult.cs delete mode 100644 packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/body-optionality/src/Generated/Internal/ModelSerializationExtensions.cs delete mode 100644 packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/body-optionality/src/Generated/Internal/SerializationFormat.cs delete mode 100644 packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/body-optionality/src/Generated/Internal/TypeFormatters.cs delete mode 100644 packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/body-optionality/src/Generated/OptionalExplicit.RestClient.cs diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Providers/ClientSettingsProvider.cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Providers/ClientSettingsProvider.cs index c866e72be13..eecaf6ef18a 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Providers/ClientSettingsProvider.cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Providers/ClientSettingsProvider.cs @@ -55,7 +55,7 @@ internal ClientSettingsProvider(InputClient inputClient, ClientProvider clientPr internal IReadOnlyList OtherRequiredParams { get; } protected override FormattableString BuildDescription() - => $"Settings for the {_clientProvider.Name} client, extending ."; + => $"Represents the settings used to configure a that can be loaded from an ."; protected override string BuildRelativeFilePath() => Path.Combine("src", "Generated", $"{Name}.cs"); diff --git a/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/SampleTypeSpecClientSettings.cs b/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/SampleTypeSpecClientSettings.cs index 88e8f35c29e..d3a58b30dc6 100644 --- a/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/SampleTypeSpecClientSettings.cs +++ b/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/SampleTypeSpecClientSettings.cs @@ -12,7 +12,7 @@ namespace SampleTypeSpec { - /// + /// Represents the settings used to configure a that can be loaded from an . [Experimental("SCME0002")] public partial class SampleTypeSpecClientSettings : ClientSettings { diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/body-optionality/src/Generated/BodyOptionalityClient.RestClient.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/body-optionality/src/Generated/BodyOptionalityClient.RestClient.cs deleted file mode 100644 index c369b7a2c6b..00000000000 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/body-optionality/src/Generated/BodyOptionalityClient.RestClient.cs +++ /dev/null @@ -1,43 +0,0 @@ -// - -#nullable disable - -using System.ClientModel; -using System.ClientModel.Primitives; - -namespace Parameters.BodyOptionality -{ - /// - public partial class BodyOptionalityClient - { - private static PipelineMessageClassifier _pipelineMessageClassifier204; - - private static PipelineMessageClassifier PipelineMessageClassifier204 => _pipelineMessageClassifier204 ??= PipelineMessageClassifier.Create(stackalloc ushort[] { 204 }); - - internal PipelineMessage CreateRequiredExplicitRequest(BinaryContent content, RequestOptions options) - { - ClientUriBuilder uri = new ClientUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/parameters/body-optionality/required-explicit", false); - PipelineMessage message = Pipeline.CreateMessage(uri.ToUri(), "POST", PipelineMessageClassifier204); - PipelineRequest request = message.Request; - request.Headers.Set("Content-Type", "application/json"); - request.Content = content; - message.Apply(options); - return message; - } - - internal PipelineMessage CreateRequiredImplicitRequest(BinaryContent content, RequestOptions options) - { - ClientUriBuilder uri = new ClientUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/parameters/body-optionality/required-implicit", false); - PipelineMessage message = Pipeline.CreateMessage(uri.ToUri(), "POST", PipelineMessageClassifier204); - PipelineRequest request = message.Request; - request.Headers.Set("Content-Type", "application/json"); - request.Content = content; - message.Apply(options); - return message; - } - } -} diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/body-optionality/src/Generated/BodyOptionalityClient.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/body-optionality/src/Generated/BodyOptionalityClient.cs index 6e2edbe7a0a..457b49eac2f 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/body-optionality/src/Generated/BodyOptionalityClient.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/body-optionality/src/Generated/BodyOptionalityClient.cs @@ -12,189 +12,35 @@ namespace Parameters.BodyOptionality { - /// Test describing optionality of the request body. public partial class BodyOptionalityClient { - private readonly Uri _endpoint; - private OptionalExplicit _cachedOptionalExplicit; - - /// Initializes a new instance of BodyOptionalityClient. - public BodyOptionalityClient() : this(new Uri("http://localhost:3000"), new BodyOptionalityClientOptions()) - { - } - - /// Initializes a new instance of BodyOptionalityClient. - /// The authentication policy to use for pipeline creation. - /// Service endpoint. - /// The options for configuring the client. - internal BodyOptionalityClient(AuthenticationPolicy authenticationPolicy, Uri endpoint, BodyOptionalityClientOptions options) - { - Argument.AssertNotNull(endpoint, nameof(endpoint)); - - options ??= new BodyOptionalityClientOptions(); - - _endpoint = endpoint; - Pipeline = ClientPipeline.Create(options, Array.Empty(), new PipelinePolicy[] { new UserAgentPolicy(typeof(BodyOptionalityClient).Assembly) }, Array.Empty()); - } - - /// Initializes a new instance of BodyOptionalityClient. - /// Service endpoint. - /// The options for configuring the client. - /// is null. - public BodyOptionalityClient(Uri endpoint, BodyOptionalityClientOptions options) : this(null, endpoint, options) - { - } - - /// Initializes a new instance of BodyOptionalityClient from a . - /// The settings for BodyOptionalityClient. + public BodyOptionalityClient() : this(new Uri("http://localhost:3000"), new BodyOptionalityClientOptions()) => throw null; + + internal BodyOptionalityClient(AuthenticationPolicy authenticationPolicy, Uri endpoint, BodyOptionalityClientOptions options) => throw null; + + public BodyOptionalityClient(Uri endpoint, BodyOptionalityClientOptions options) : this(null, endpoint, options) => throw null; + [Experimental("SCME0002")] - public BodyOptionalityClient(BodyOptionalityClientSettings settings) : this(AuthenticationPolicy.Create(settings), settings?.Endpoint, settings?.Options) - { - } - - /// The HTTP pipeline for sending and receiving REST requests and responses. - public ClientPipeline Pipeline { get; } - - /// - /// [Protocol Method] RequiredExplicit - /// - /// - /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. - /// - /// - /// - /// The content to send as the body of the request. - /// The request options, which can override default behaviors of the client pipeline on a per-call basis. - /// is null. - /// Service returned a non-success status code. - /// The response returned from the service. - public virtual ClientResult RequiredExplicit(BinaryContent content, RequestOptions options = null) - { - Argument.AssertNotNull(content, nameof(content)); - - using PipelineMessage message = CreateRequiredExplicitRequest(content, options); - return ClientResult.FromResponse(Pipeline.ProcessMessage(message, options)); - } - - /// - /// [Protocol Method] RequiredExplicit - /// - /// - /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. - /// - /// - /// - /// The content to send as the body of the request. - /// The request options, which can override default behaviors of the client pipeline on a per-call basis. - /// is null. - /// Service returned a non-success status code. - /// The response returned from the service. - public virtual async Task RequiredExplicitAsync(BinaryContent content, RequestOptions options = null) - { - Argument.AssertNotNull(content, nameof(content)); - - using PipelineMessage message = CreateRequiredExplicitRequest(content, options); - return ClientResult.FromResponse(await Pipeline.ProcessMessageAsync(message, options).ConfigureAwait(false)); - } - - /// RequiredExplicit. - /// - /// The cancellation token that can be used to cancel the operation. - /// is null. - /// Service returned a non-success status code. - public virtual ClientResult RequiredExplicit(BodyModel body, CancellationToken cancellationToken = default) - { - Argument.AssertNotNull(body, nameof(body)); - - return RequiredExplicit(body, cancellationToken.ToRequestOptions()); - } - - /// RequiredExplicit. - /// - /// The cancellation token that can be used to cancel the operation. - /// is null. - /// Service returned a non-success status code. - public virtual async Task RequiredExplicitAsync(BodyModel body, CancellationToken cancellationToken = default) - { - Argument.AssertNotNull(body, nameof(body)); - - return await RequiredExplicitAsync(body, cancellationToken.ToRequestOptions()).ConfigureAwait(false); - } - - /// - /// [Protocol Method] RequiredImplicit - /// - /// - /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. - /// - /// - /// - /// The content to send as the body of the request. - /// The request options, which can override default behaviors of the client pipeline on a per-call basis. - /// is null. - /// Service returned a non-success status code. - /// The response returned from the service. - public virtual ClientResult RequiredImplicit(BinaryContent content, RequestOptions options = null) - { - Argument.AssertNotNull(content, nameof(content)); - - using PipelineMessage message = CreateRequiredImplicitRequest(content, options); - return ClientResult.FromResponse(Pipeline.ProcessMessage(message, options)); - } - - /// - /// [Protocol Method] RequiredImplicit - /// - /// - /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. - /// - /// - /// - /// The content to send as the body of the request. - /// The request options, which can override default behaviors of the client pipeline on a per-call basis. - /// is null. - /// Service returned a non-success status code. - /// The response returned from the service. - public virtual async Task RequiredImplicitAsync(BinaryContent content, RequestOptions options = null) - { - Argument.AssertNotNull(content, nameof(content)); - - using PipelineMessage message = CreateRequiredImplicitRequest(content, options); - return ClientResult.FromResponse(await Pipeline.ProcessMessageAsync(message, options).ConfigureAwait(false)); - } - - /// RequiredImplicit. - /// - /// The cancellation token that can be used to cancel the operation. - /// is null. - /// is an empty string, and was expected to be non-empty. - /// Service returned a non-success status code. - public virtual ClientResult RequiredImplicit(string name, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(name, nameof(name)); - - BodyModel spreadModel = new BodyModel(name, default); - return RequiredImplicit(spreadModel, cancellationToken.ToRequestOptions()); - } - - /// RequiredImplicit. - /// - /// The cancellation token that can be used to cancel the operation. - /// is null. - /// is an empty string, and was expected to be non-empty. - /// Service returned a non-success status code. - public virtual async Task RequiredImplicitAsync(string name, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(name, nameof(name)); - - BodyModel spreadModel = new BodyModel(name, default); - return await RequiredImplicitAsync(spreadModel, cancellationToken.ToRequestOptions()).ConfigureAwait(false); - } - - /// Initializes a new instance of OptionalExplicit. - public virtual OptionalExplicit GetOptionalExplicitClient() - { - return Volatile.Read(ref _cachedOptionalExplicit) ?? Interlocked.CompareExchange(ref _cachedOptionalExplicit, new OptionalExplicit(Pipeline, _endpoint), null) ?? _cachedOptionalExplicit; - } + public BodyOptionalityClient(BodyOptionalityClientSettings settings) : this(AuthenticationPolicy.Create(settings), settings?.Endpoint, settings?.Options) => throw null; + + public ClientPipeline Pipeline => throw null; + + public virtual ClientResult RequiredExplicit(BinaryContent content, RequestOptions options = null) => throw null; + + public virtual Task RequiredExplicitAsync(BinaryContent content, RequestOptions options = null) => throw null; + + public virtual ClientResult RequiredExplicit(BodyModel body, CancellationToken cancellationToken = default) => throw null; + + public virtual Task RequiredExplicitAsync(BodyModel body, CancellationToken cancellationToken = default) => throw null; + + public virtual ClientResult RequiredImplicit(BinaryContent content, RequestOptions options = null) => throw null; + + public virtual Task RequiredImplicitAsync(BinaryContent content, RequestOptions options = null) => throw null; + + public virtual ClientResult RequiredImplicit(string name, CancellationToken cancellationToken = default) => throw null; + + public virtual Task RequiredImplicitAsync(string name, CancellationToken cancellationToken = default) => throw null; + + public virtual OptionalExplicit GetOptionalExplicitClient() => throw null; } } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/body-optionality/src/Generated/BodyOptionalityClientOptions.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/body-optionality/src/Generated/BodyOptionalityClientOptions.cs index 0ff10a94b8e..33804b10acc 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/body-optionality/src/Generated/BodyOptionalityClientOptions.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/body-optionality/src/Generated/BodyOptionalityClientOptions.cs @@ -8,23 +8,11 @@ namespace Parameters.BodyOptionality { - /// Client options for . public partial class BodyOptionalityClientOptions : ClientPipelineOptions { - /// Initializes a new instance of BodyOptionalityClientOptions. - public BodyOptionalityClientOptions() - { - } + public BodyOptionalityClientOptions() => throw null; - /// Initializes a new instance of BodyOptionalityClientOptions from configuration. - /// The configuration section. [Experimental("SCME0002")] - internal BodyOptionalityClientOptions(IConfigurationSection section) : base(section) - { - if (section is null || !section.Exists()) - { - return; - } - } + internal BodyOptionalityClientOptions(IConfigurationSection section) : base(section) => throw null; } } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/body-optionality/src/Generated/BodyOptionalityClientSettings.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/body-optionality/src/Generated/BodyOptionalityClientSettings.cs index c2e7252ea29..137094caec7 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/body-optionality/src/Generated/BodyOptionalityClientSettings.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/body-optionality/src/Generated/BodyOptionalityClientSettings.cs @@ -9,29 +9,21 @@ namespace Parameters.BodyOptionality { - /// [Experimental("SCME0002")] public partial class BodyOptionalityClientSettings : ClientSettings { - /// Gets or sets the Endpoint. - public Uri Endpoint { get; set; } - - /// Gets or sets the Options. - public BodyOptionalityClientOptions Options { get; set; } + public Uri Endpoint + { + get => throw null; + set => throw null; + } - /// Binds configuration values from the given section. - /// The configuration section. - protected override void BindCore(IConfigurationSection section) + public BodyOptionalityClientOptions Options { - if (Uri.TryCreate(section["Endpoint"], UriKind.Absolute, out Uri endpoint)) - { - Endpoint = endpoint; - } - IConfigurationSection optionsSection = section.GetSection("Options"); - if (optionsSection.Exists()) - { - Options = new BodyOptionalityClientOptions(optionsSection); - } + get => throw null; + set => throw null; } + + protected override void BindCore(IConfigurationSection section) => throw null; } } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/body-optionality/src/Generated/Internal/Argument.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/body-optionality/src/Generated/Internal/Argument.cs deleted file mode 100644 index 9a203d56ff3..00000000000 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/body-optionality/src/Generated/Internal/Argument.cs +++ /dev/null @@ -1,110 +0,0 @@ -// - -#nullable disable - -using System; -using System.Collections; -using System.Collections.Generic; - -namespace Parameters.BodyOptionality -{ - internal static partial class Argument - { - /// The value. - /// The name. - public static void AssertNotNull(T value, string name) - { - if (value is null) - { - throw new ArgumentNullException(name); - } - } - - /// The value. - /// The name. - public static void AssertNotNull(T? value, string name) - where T : struct - { - if (!value.HasValue) - { - throw new ArgumentNullException(name); - } - } - - /// The value. - /// The name. - public static void AssertNotNullOrEmpty(IEnumerable value, string name) - { - if (value is null) - { - throw new ArgumentNullException(name); - } - if (value is ICollection collectionOfT && collectionOfT.Count == 0) - { - throw new ArgumentException("Value cannot be an empty collection.", name); - } - if (value is ICollection collection && collection.Count == 0) - { - throw new ArgumentException("Value cannot be an empty collection.", name); - } - using IEnumerator e = value.GetEnumerator(); - if (!e.MoveNext()) - { - throw new ArgumentException("Value cannot be an empty collection.", name); - } - } - - /// The value. - /// The name. - public static void AssertNotNullOrEmpty(string value, string name) - { - if (value is null) - { - throw new ArgumentNullException(name); - } - if (value.Length == 0) - { - throw new ArgumentException("Value cannot be an empty string.", name); - } - } - - /// The value. - /// The name. - public static void AssertNotNullOrWhiteSpace(string value, string name) - { - if (value is null) - { - throw new ArgumentNullException(name); - } - if (string.IsNullOrWhiteSpace(value)) - { - throw new ArgumentException("Value cannot be empty or contain only white-space characters.", name); - } - } - - /// The value. - /// The minimum value. - /// The maximum value. - /// The name. - public static void AssertInRange(T value, T minimum, T maximum, string name) - where T : notnull, IComparable - { - if (minimum.CompareTo(value) > 0) - { - throw new ArgumentOutOfRangeException(name, "Value is less than the minimum allowed."); - } - if (maximum.CompareTo(value) < 0) - { - throw new ArgumentOutOfRangeException(name, "Value is greater than the maximum allowed."); - } - } - - /// The value. - /// The name. - public static string CheckNotNullOrEmpty(string value, string name) - { - AssertNotNullOrEmpty(value, name); - return value; - } - } -} diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/body-optionality/src/Generated/Internal/CancellationTokenExtensions.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/body-optionality/src/Generated/Internal/CancellationTokenExtensions.cs deleted file mode 100644 index 2403a4646f4..00000000000 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/body-optionality/src/Generated/Internal/CancellationTokenExtensions.cs +++ /dev/null @@ -1,14 +0,0 @@ -// - -#nullable disable - -using System.ClientModel.Primitives; -using System.Threading; - -namespace Parameters.BodyOptionality -{ - internal static partial class CancellationTokenExtensions - { - public static RequestOptions ToRequestOptions(this CancellationToken cancellationToken) => cancellationToken.CanBeCanceled ? new RequestOptions { CancellationToken = cancellationToken } : null; - } -} diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/body-optionality/src/Generated/Internal/ChangeTrackingDictionary.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/body-optionality/src/Generated/Internal/ChangeTrackingDictionary.cs deleted file mode 100644 index bd983abaf23..00000000000 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/body-optionality/src/Generated/Internal/ChangeTrackingDictionary.cs +++ /dev/null @@ -1,186 +0,0 @@ -// - -#nullable disable - -using System; -using System.Collections; -using System.Collections.Generic; - -namespace Parameters.BodyOptionality -{ - internal partial class ChangeTrackingDictionary : IDictionary, IReadOnlyDictionary - where TKey : notnull - { - private IDictionary _innerDictionary; - - public ChangeTrackingDictionary() - { - } - - /// The inner dictionary. - public ChangeTrackingDictionary(IDictionary dictionary) - { - if (dictionary == null) - { - return; - } - _innerDictionary = new Dictionary(dictionary); - } - - /// The inner dictionary. - public ChangeTrackingDictionary(IReadOnlyDictionary dictionary) - { - if (dictionary == null) - { - return; - } - _innerDictionary = new Dictionary(); - foreach (var pair in dictionary) - { - _innerDictionary.Add(pair); - } - } - - /// Gets the IsUndefined. - public bool IsUndefined => _innerDictionary == null; - - /// Gets the Count. - public int Count => IsUndefined ? 0 : EnsureDictionary().Count; - - /// Gets the IsReadOnly. - public bool IsReadOnly => IsUndefined ? false : EnsureDictionary().IsReadOnly; - - /// Gets the Keys. - public ICollection Keys => IsUndefined ? Array.Empty() : EnsureDictionary().Keys; - - /// Gets the Values. - public ICollection Values => IsUndefined ? Array.Empty() : EnsureDictionary().Values; - - /// Gets or sets the value associated with the specified key. - public TValue this[TKey key] - { - get - { - if (IsUndefined) - { - throw new KeyNotFoundException(nameof(key)); - } - return EnsureDictionary()[key]; - } - set - { - EnsureDictionary()[key] = value; - } - } - - /// Gets the Keys. - IEnumerable IReadOnlyDictionary.Keys => Keys; - - /// Gets the Values. - IEnumerable IReadOnlyDictionary.Values => Values; - - public IEnumerator> GetEnumerator() - { - if (IsUndefined) - { - IEnumerator> enumerateEmpty() - { - yield break; - } - return enumerateEmpty(); - } - return EnsureDictionary().GetEnumerator(); - } - - IEnumerator IEnumerable.GetEnumerator() - { - return GetEnumerator(); - } - - /// The item to add. - public void Add(KeyValuePair item) - { - EnsureDictionary().Add(item); - } - - public void Clear() - { - EnsureDictionary().Clear(); - } - - /// The item to search for. - public bool Contains(KeyValuePair item) - { - if (IsUndefined) - { - return false; - } - return EnsureDictionary().Contains(item); - } - - /// The array to copy. - /// The index. - public void CopyTo(KeyValuePair[] array, int index) - { - if (IsUndefined) - { - return; - } - EnsureDictionary().CopyTo(array, index); - } - - /// The item to remove. - public bool Remove(KeyValuePair item) - { - if (IsUndefined) - { - return false; - } - return EnsureDictionary().Remove(item); - } - - /// The key. - /// The value to add. - public void Add(TKey key, TValue value) - { - EnsureDictionary().Add(key, value); - } - - /// The key to search for. - public bool ContainsKey(TKey key) - { - if (IsUndefined) - { - return false; - } - return EnsureDictionary().ContainsKey(key); - } - - /// The key. - public bool Remove(TKey key) - { - if (IsUndefined) - { - return false; - } - return EnsureDictionary().Remove(key); - } - - /// The key to search for. - /// The value. - public bool TryGetValue(TKey key, out TValue value) - { - if (IsUndefined) - { - value = default; - return false; - } - return EnsureDictionary().TryGetValue(key, out value); - } - - public IDictionary EnsureDictionary() - { - return _innerDictionary ??= new Dictionary(); - } - } -} diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/body-optionality/src/Generated/Internal/ClientPipelineExtensions.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/body-optionality/src/Generated/Internal/ClientPipelineExtensions.cs deleted file mode 100644 index 5f60d88187a..00000000000 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/body-optionality/src/Generated/Internal/ClientPipelineExtensions.cs +++ /dev/null @@ -1,67 +0,0 @@ -// - -#nullable disable - -using System.ClientModel; -using System.ClientModel.Primitives; -using System.Threading.Tasks; - -namespace Parameters.BodyOptionality -{ - internal static partial class ClientPipelineExtensions - { - public static async ValueTask ProcessMessageAsync(this ClientPipeline pipeline, PipelineMessage message, RequestOptions options) - { - await pipeline.SendAsync(message).ConfigureAwait(false); - - if (message.Response.IsError && (options?.ErrorOptions & ClientErrorBehaviors.NoThrow) != ClientErrorBehaviors.NoThrow) - { - throw await ClientResultException.CreateAsync(message.Response).ConfigureAwait(false); - } - - PipelineResponse response = message.BufferResponse ? message.Response : message.ExtractResponse(); - return response; - } - - public static PipelineResponse ProcessMessage(this ClientPipeline pipeline, PipelineMessage message, RequestOptions options) - { - pipeline.Send(message); - - if (message.Response.IsError && (options?.ErrorOptions & ClientErrorBehaviors.NoThrow) != ClientErrorBehaviors.NoThrow) - { - throw new ClientResultException(message.Response); - } - - PipelineResponse response = message.BufferResponse ? message.Response : message.ExtractResponse(); - return response; - } - - public static async ValueTask> ProcessHeadAsBoolMessageAsync(this ClientPipeline pipeline, PipelineMessage message, RequestOptions options) - { - PipelineResponse response = await pipeline.ProcessMessageAsync(message, options).ConfigureAwait(false); - switch (response.Status) - { - case >= 200 and < 300: - return ClientResult.FromValue(true, response); - case >= 400 and < 500: - return ClientResult.FromValue(false, response); - default: - return new ErrorResult(response, new ClientResultException(response)); - } - } - - public static ClientResult ProcessHeadAsBoolMessage(this ClientPipeline pipeline, PipelineMessage message, RequestOptions options) - { - PipelineResponse response = pipeline.ProcessMessage(message, options); - switch (response.Status) - { - case >= 200 and < 300: - return ClientResult.FromValue(true, response); - case >= 400 and < 500: - return ClientResult.FromValue(false, response); - default: - return new ErrorResult(response, new ClientResultException(response)); - } - } - } -} diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/body-optionality/src/Generated/Internal/ClientUriBuilder.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/body-optionality/src/Generated/Internal/ClientUriBuilder.cs deleted file mode 100644 index 637f2a6360c..00000000000 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/body-optionality/src/Generated/Internal/ClientUriBuilder.cs +++ /dev/null @@ -1,181 +0,0 @@ -// - -#nullable disable - -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; - -namespace Parameters.BodyOptionality -{ - internal partial class ClientUriBuilder - { - private UriBuilder _uriBuilder; - private StringBuilder _pathAndQuery; - private int _pathLength; - - public ClientUriBuilder() - { - } - - private UriBuilder UriBuilder => _uriBuilder ??= new UriBuilder(); - - private StringBuilder PathAndQuery => _pathAndQuery ??= new StringBuilder(); - - public void Reset(Uri uri) - { - _uriBuilder = new UriBuilder(uri); - PathAndQuery.Clear(); - PathAndQuery.Append(UriBuilder.Path); - _pathLength = PathAndQuery.Length; - PathAndQuery.Append(UriBuilder.Query); - } - - public void AppendPath(string value, bool escape) - { - if (escape) - { - value = Uri.EscapeDataString(value); - } - if (_pathLength > 0 && PathAndQuery[_pathLength - 1] == '/' && value[0] == '/') - { - PathAndQuery.Remove(_pathLength - 1, 1); - _pathLength = _pathLength - 1; - } - PathAndQuery.Insert(_pathLength, value); - _pathLength = _pathLength + value.Length; - } - - public void AppendPath(bool value, bool escape = false) => AppendPath(TypeFormatters.ConvertToString(value), escape); - - public void AppendPath(float value, bool escape = true) => AppendPath(TypeFormatters.ConvertToString(value), escape); - - public void AppendPath(double value, bool escape = true) => AppendPath(TypeFormatters.ConvertToString(value), escape); - - public void AppendPath(int value, bool escape = true) => AppendPath(TypeFormatters.ConvertToString(value), escape); - - public void AppendPath(byte[] value, SerializationFormat format = SerializationFormat.Default, bool escape = true) => AppendPath(TypeFormatters.ConvertToString(value, format), escape); - - public void AppendPath(DateTimeOffset value, SerializationFormat format = SerializationFormat.Default, bool escape = true) => AppendPath(TypeFormatters.ConvertToString(value, format), escape); - - public void AppendPath(TimeSpan value, SerializationFormat format = SerializationFormat.Default, bool escape = true) => AppendPath(TypeFormatters.ConvertToString(value, format), escape); - - public void AppendPath(Guid value, bool escape = true) => AppendPath(TypeFormatters.ConvertToString(value), escape); - - public void AppendPath(long value, bool escape = true) => AppendPath(TypeFormatters.ConvertToString(value), escape); - - public void AppendPathDelimited(IEnumerable value, string delimiter, SerializationFormat format = SerializationFormat.Default, bool escape = true) - { - delimiter ??= ","; - IEnumerable stringValues = value.Select(v => TypeFormatters.ConvertToString(v, format)); - AppendPath(string.Join(delimiter, stringValues), escape); - } - - public void AppendQuery(string name, string value, bool escape) - { - if (PathAndQuery.Length == _pathLength) - { - PathAndQuery.Append('?'); - } - if (PathAndQuery.Length > _pathLength && PathAndQuery[PathAndQuery.Length - 1] != '?') - { - PathAndQuery.Append('&'); - } - if (escape) - { - value = Uri.EscapeDataString(value); - } - PathAndQuery.Append(name); - PathAndQuery.Append('='); - PathAndQuery.Append(value); - } - - public void AppendQuery(string name, bool value, bool escape = false) => AppendQuery(name, TypeFormatters.ConvertToString(value), escape); - - public void AppendQuery(string name, float value, bool escape = true) => AppendQuery(name, TypeFormatters.ConvertToString(value), escape); - - public void AppendQuery(string name, DateTimeOffset value, SerializationFormat format = SerializationFormat.Default, bool escape = true) => AppendQuery(name, TypeFormatters.ConvertToString(value, format), escape); - - public void AppendQuery(string name, TimeSpan value, SerializationFormat format = SerializationFormat.Default, bool escape = true) => AppendQuery(name, TypeFormatters.ConvertToString(value, format), escape); - - public void AppendQuery(string name, double value, bool escape = true) => AppendQuery(name, TypeFormatters.ConvertToString(value), escape); - - public void AppendQuery(string name, decimal value, bool escape = true) => AppendQuery(name, TypeFormatters.ConvertToString(value), escape); - - public void AppendQuery(string name, int value, bool escape = true) => AppendQuery(name, TypeFormatters.ConvertToString(value), escape); - - public void AppendQuery(string name, long value, bool escape = true) => AppendQuery(name, TypeFormatters.ConvertToString(value), escape); - - public void AppendQuery(string name, TimeSpan value, bool escape = true) => AppendQuery(name, TypeFormatters.ConvertToString(value), escape); - - public void AppendQuery(string name, byte[] value, SerializationFormat format = SerializationFormat.Default, bool escape = true) => AppendQuery(name, TypeFormatters.ConvertToString(value, format), escape); - - public void AppendQuery(string name, Guid value, bool escape = true) => AppendQuery(name, TypeFormatters.ConvertToString(value), escape); - - public void AppendQueryDelimited(string name, IEnumerable value, string delimiter, SerializationFormat format = SerializationFormat.Default, bool escape = true) - { - delimiter ??= ","; - IEnumerable stringValues = value.Select(v => TypeFormatters.ConvertToString(v, format)); - AppendQuery(name, string.Join(delimiter, stringValues), escape); - } - - public void UpdateQuery(string name, string value) - { - if (PathAndQuery.Length == _pathLength) - { - AppendQuery(name, value, false); - } - else - { - int queryStartIndex = _pathLength + 1; - string searchPattern = name + "="; - string queryString = PathAndQuery.ToString(queryStartIndex, PathAndQuery.Length - queryStartIndex); - int paramStartIndex = -1; - if (queryString.StartsWith(searchPattern)) - { - paramStartIndex = 0; - } - if (paramStartIndex == -1) - { - int prefixedIndex = queryString.IndexOf("&" + searchPattern); - if (prefixedIndex >= 0) - { - paramStartIndex = prefixedIndex + 1; - } - } - if (paramStartIndex >= 0) - { - int valueStartIndex = paramStartIndex + searchPattern.Length; - int valueEndIndex = queryString.IndexOf('&', valueStartIndex); - if (valueEndIndex == -1) - { - valueEndIndex = queryString.Length; - } - int globalStart = queryStartIndex + valueStartIndex; - int globalEnd = queryStartIndex + valueEndIndex; - PathAndQuery.Remove(globalStart, globalEnd - globalStart); - PathAndQuery.Insert(globalStart, value); - } - else - { - AppendQuery(name, value, false); - } - } - } - - public Uri ToUri() - { - UriBuilder.Path = PathAndQuery.ToString(0, _pathLength); - if (PathAndQuery.Length > _pathLength) - { - UriBuilder.Query = PathAndQuery.ToString(_pathLength + 1, PathAndQuery.Length - _pathLength - 1); - } - if (PathAndQuery.Length == _pathLength) - { - UriBuilder.Query = ""; - } - return UriBuilder.Uri; - } - } -} diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/body-optionality/src/Generated/Internal/CodeGenMemberAttribute.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/body-optionality/src/Generated/Internal/CodeGenMemberAttribute.cs deleted file mode 100644 index 044dfe314c5..00000000000 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/body-optionality/src/Generated/Internal/CodeGenMemberAttribute.cs +++ /dev/null @@ -1,17 +0,0 @@ -// - -#nullable disable - -using System; - -namespace Microsoft.TypeSpec.Generator.Customizations -{ - [AttributeUsage((AttributeTargets.Property | AttributeTargets.Field))] - internal partial class CodeGenMemberAttribute : CodeGenTypeAttribute - { - /// The original name of the member. - public CodeGenMemberAttribute(string originalName) : base(originalName) - { - } - } -} diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/body-optionality/src/Generated/Internal/CodeGenSerializationAttribute.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/body-optionality/src/Generated/Internal/CodeGenSerializationAttribute.cs deleted file mode 100644 index aedb8b359b8..00000000000 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/body-optionality/src/Generated/Internal/CodeGenSerializationAttribute.cs +++ /dev/null @@ -1,45 +0,0 @@ -// - -#nullable disable - -using System; - -namespace Microsoft.TypeSpec.Generator.Customizations -{ - [AttributeUsage((AttributeTargets.Class | AttributeTargets.Struct), AllowMultiple = true, Inherited = true)] - internal partial class CodeGenSerializationAttribute : Attribute - { - /// The property name which these hooks apply to. - public CodeGenSerializationAttribute(string propertyName) - { - PropertyName = propertyName; - } - - /// The property name which these hooks apply to. - /// The serialization name of the property. - public CodeGenSerializationAttribute(string propertyName, string serializationName) - { - PropertyName = propertyName; - SerializationName = serializationName; - } - - /// Gets or sets the property name which these hooks should apply to. - public string PropertyName { get; } - - /// Gets or sets the serialization name of the property. - public string SerializationName { get; set; } - - /// - /// Gets or sets the method name to use when serializing the property value (property name excluded). - /// The signature of the serialization hook method must be or compatible with when invoking: private void SerializeHook(Utf8JsonWriter writer); - /// - public string SerializationValueHook { get; set; } - - /// - /// Gets or sets the method name to use when deserializing the property value from the JSON. - /// private static void DeserializationHook(JsonProperty property, ref TypeOfTheProperty propertyValue); // if the property is required - /// private static void DeserializationHook(JsonProperty property, ref Optional<TypeOfTheProperty> propertyValue); // if the property is optional - /// - public string DeserializationValueHook { get; set; } - } -} diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/body-optionality/src/Generated/Internal/CodeGenSuppressAttribute.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/body-optionality/src/Generated/Internal/CodeGenSuppressAttribute.cs deleted file mode 100644 index 601ded913ab..00000000000 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/body-optionality/src/Generated/Internal/CodeGenSuppressAttribute.cs +++ /dev/null @@ -1,26 +0,0 @@ -// - -#nullable disable - -using System; - -namespace Microsoft.TypeSpec.Generator.Customizations -{ - [AttributeUsage((AttributeTargets.Class | AttributeTargets.Enum | AttributeTargets.Struct), AllowMultiple = true)] - internal partial class CodeGenSuppressAttribute : Attribute - { - /// The member to suppress. - /// The types of the parameters of the member. - public CodeGenSuppressAttribute(string member, params Type[] parameters) - { - Member = member; - Parameters = parameters; - } - - /// Gets the Member. - public string Member { get; } - - /// Gets the Parameters. - public Type[] Parameters { get; } - } -} diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/body-optionality/src/Generated/Internal/CodeGenTypeAttribute.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/body-optionality/src/Generated/Internal/CodeGenTypeAttribute.cs deleted file mode 100644 index d7b56bdccdf..00000000000 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/body-optionality/src/Generated/Internal/CodeGenTypeAttribute.cs +++ /dev/null @@ -1,21 +0,0 @@ -// - -#nullable disable - -using System; - -namespace Microsoft.TypeSpec.Generator.Customizations -{ - [AttributeUsage((AttributeTargets.Class | AttributeTargets.Enum | AttributeTargets.Struct))] - internal partial class CodeGenTypeAttribute : Attribute - { - /// The original name of the type. - public CodeGenTypeAttribute(string originalName) - { - OriginalName = originalName; - } - - /// Gets the OriginalName. - public string OriginalName { get; } - } -} diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/body-optionality/src/Generated/Internal/ErrorResult.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/body-optionality/src/Generated/Internal/ErrorResult.cs deleted file mode 100644 index f71f5b72dd6..00000000000 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/body-optionality/src/Generated/Internal/ErrorResult.cs +++ /dev/null @@ -1,24 +0,0 @@ -// - -#nullable disable - -using System.ClientModel; -using System.ClientModel.Primitives; - -namespace Parameters.BodyOptionality -{ - internal partial class ErrorResult : ClientResult - { - private readonly PipelineResponse _response; - private readonly ClientResultException _exception; - - public ErrorResult(PipelineResponse response, ClientResultException exception) : base(default, response) - { - _response = response; - _exception = exception; - } - - /// Gets the Value. - public override T Value => throw _exception; - } -} diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/body-optionality/src/Generated/Internal/ModelSerializationExtensions.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/body-optionality/src/Generated/Internal/ModelSerializationExtensions.cs deleted file mode 100644 index 49cee9e8bd3..00000000000 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/body-optionality/src/Generated/Internal/ModelSerializationExtensions.cs +++ /dev/null @@ -1,265 +0,0 @@ -// - -#nullable disable - -using System; -using System.ClientModel.Primitives; -using System.Collections.Generic; -using System.Diagnostics; -using System.Globalization; -using System.Runtime.InteropServices; -using System.Text.Json; - -namespace Parameters.BodyOptionality -{ - internal static partial class ModelSerializationExtensions - { - internal static readonly ModelReaderWriterOptions WireOptions = new ModelReaderWriterOptions("W"); - internal static readonly JsonDocumentOptions JsonDocumentOptions = new JsonDocumentOptions - { - MaxDepth = 256 - }; - - public static object GetObject(this JsonElement element) - { - switch (element.ValueKind) - { - case JsonValueKind.String: - return element.GetString(); - case JsonValueKind.Number: - if (element.TryGetInt32(out int intValue)) - { - return intValue; - } - if (element.TryGetInt64(out long longValue)) - { - return longValue; - } - return element.GetDouble(); - case JsonValueKind.True: - return true; - case JsonValueKind.False: - return false; - case JsonValueKind.Undefined: - case JsonValueKind.Null: - return null; - case JsonValueKind.Object: - Dictionary dictionary = new Dictionary(); - foreach (var jsonProperty in element.EnumerateObject()) - { - dictionary.Add(jsonProperty.Name, jsonProperty.Value.GetObject()); - } - return dictionary; - case JsonValueKind.Array: - List list = new List(); - foreach (var item in element.EnumerateArray()) - { - list.Add(item.GetObject()); - } - return list.ToArray(); - default: - throw new NotSupportedException($"Not supported value kind {element.ValueKind}"); - } - } - - public static byte[] GetBytesFromBase64(this JsonElement element, string format) - { - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - - return format switch - { - "U" => TypeFormatters.FromBase64UrlString(element.GetRequiredString()), - "D" => element.GetBytesFromBase64(), - _ => throw new ArgumentException($"Format is not supported: '{format}'", nameof(format)) - }; - } - - public static DateTimeOffset GetDateTimeOffset(this JsonElement element, string format) => format switch - { - "U" when element.ValueKind == JsonValueKind.Number => DateTimeOffset.FromUnixTimeSeconds(element.GetInt64()), - _ => TypeFormatters.ParseDateTimeOffset(element.GetString(), format) - }; - - public static TimeSpan GetTimeSpan(this JsonElement element, string format) => TypeFormatters.ParseTimeSpan(element.GetString(), format); - - public static char GetChar(this JsonElement element) - { - if (element.ValueKind == JsonValueKind.String) - { - string text = element.GetString(); - if (text == null || text.Length != 1) - { - throw new NotSupportedException($"Cannot convert \"{text}\" to a char"); - } - return text[0]; - } - else - { - throw new NotSupportedException($"Cannot convert {element.ValueKind} to a char"); - } - } - - [Conditional("DEBUG")] - public static void ThrowNonNullablePropertyIsNull(this JsonProperty @property) - { - throw new JsonException($"A property '{@property.Name}' defined as non-nullable but received as null from the service. This exception only happens in DEBUG builds of the library and would be ignored in the release build"); - } - - public static string GetRequiredString(this JsonElement element) - { - string value = element.GetString(); - if (value == null) - { - throw new InvalidOperationException($"The requested operation requires an element of type 'String', but the target element has type '{element.ValueKind}'."); - } - return value; - } - - public static void WriteStringValue(this Utf8JsonWriter writer, DateTimeOffset value, string format) - { - writer.WriteStringValue(TypeFormatters.ToString(value, format)); - } - - public static void WriteStringValue(this Utf8JsonWriter writer, DateTime value, string format) - { - writer.WriteStringValue(TypeFormatters.ToString(value, format)); - } - - public static void WriteStringValue(this Utf8JsonWriter writer, TimeSpan value, string format) - { - writer.WriteStringValue(TypeFormatters.ToString(value, format)); - } - - public static void WriteStringValue(this Utf8JsonWriter writer, char value) - { - writer.WriteStringValue(value.ToString(CultureInfo.InvariantCulture)); - } - - public static void WriteBase64StringValue(this Utf8JsonWriter writer, byte[] value, string format) - { - if (value == null) - { - writer.WriteNullValue(); - return; - } - switch (format) - { - case "U": - writer.WriteStringValue(TypeFormatters.ToBase64UrlString(value)); - break; - case "D": - writer.WriteBase64StringValue(value); - break; - default: - throw new ArgumentException($"Format is not supported: '{format}'", nameof(format)); - } - } - - public static void WriteNumberValue(this Utf8JsonWriter writer, DateTimeOffset value, string format) - { - if (format != "U") - { - throw new ArgumentOutOfRangeException(nameof(format), "Only 'U' format is supported when writing a DateTimeOffset as a Number."); - } - writer.WriteNumberValue(value.ToUnixTimeSeconds()); - } - - public static void WriteObjectValue(this Utf8JsonWriter writer, T value, ModelReaderWriterOptions options = null) - { - switch (value) - { - case null: - writer.WriteNullValue(); - break; - case IJsonModel jsonModel: - jsonModel.Write(writer, options ?? WireOptions); - break; - case byte[] bytes: - writer.WriteBase64StringValue(bytes); - break; - case BinaryData bytes0: - writer.WriteBase64StringValue(bytes0); - break; - case JsonElement json: - json.WriteTo(writer); - break; - case int i: - writer.WriteNumberValue(i); - break; - case decimal d: - writer.WriteNumberValue(d); - break; - case double d0: - if (double.IsNaN(d0)) - { - writer.WriteStringValue("NaN"); - } - else - { - writer.WriteNumberValue(d0); - } - break; - case float f: - writer.WriteNumberValue(f); - break; - case long l: - writer.WriteNumberValue(l); - break; - case string s: - writer.WriteStringValue(s); - break; - case bool b: - writer.WriteBooleanValue(b); - break; - case Guid g: - writer.WriteStringValue(g); - break; - case DateTimeOffset dateTimeOffset: - writer.WriteStringValue(dateTimeOffset, "O"); - break; - case DateTime dateTime: - writer.WriteStringValue(dateTime, "O"); - break; - case IEnumerable> enumerable: - writer.WriteStartObject(); - foreach (var pair in enumerable) - { - writer.WritePropertyName(pair.Key); - writer.WriteObjectValue(pair.Value, options); - } - writer.WriteEndObject(); - break; - case IEnumerable objectEnumerable: - writer.WriteStartArray(); - foreach (var item in objectEnumerable) - { - writer.WriteObjectValue(item, options); - } - writer.WriteEndArray(); - break; - case TimeSpan timeSpan: - writer.WriteStringValue(timeSpan, "P"); - break; - default: - throw new NotSupportedException($"Not supported type {value.GetType()}"); - } - } - - public static void WriteObjectValue(this Utf8JsonWriter writer, object value, ModelReaderWriterOptions options = null) - { - writer.WriteObjectValue(value, options); - } - - public static BinaryData GetUtf8Bytes(this JsonElement element) - { -#if NET9_0_OR_GREATER - return new global::System.BinaryData(global::System.Runtime.InteropServices.JsonMarshal.GetRawUtf8Value(element).ToArray()); -#else - return BinaryData.FromString(element.GetRawText()); -#endif - } - } -} diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/body-optionality/src/Generated/Internal/SerializationFormat.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/body-optionality/src/Generated/Internal/SerializationFormat.cs deleted file mode 100644 index a6386dbb19e..00000000000 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/body-optionality/src/Generated/Internal/SerializationFormat.cs +++ /dev/null @@ -1,46 +0,0 @@ -// - -#nullable disable - -namespace Parameters.BodyOptionality -{ - internal enum SerializationFormat - { - /// The default serialization format. - Default = 0, - /// The RFC1123 date time format. - DateTime_RFC1123 = 1, - /// The RFC3339 date time format. - DateTime_RFC3339 = 2, - /// The RFC7231 date time format. - DateTime_RFC7231 = 3, - /// The ISO8601 date time format. - DateTime_ISO8601 = 4, - /// The Unix date time format. - DateTime_Unix = 5, - /// The ISO8601 date format. - Date_ISO8601 = 6, - /// The ISO8601 duration format. - Duration_ISO8601 = 7, - /// The constant duration format. - Duration_Constant = 8, - /// The seconds duration format. - Duration_Seconds = 9, - /// The seconds duration format with float precision. - Duration_Seconds_Float = 10, - /// The seconds duration format with double precision. - Duration_Seconds_Double = 11, - /// The milliseconds duration format. - Duration_Milliseconds = 12, - /// The milliseconds duration format with float precision. - Duration_Milliseconds_Float = 13, - /// The milliseconds duration format with double precision. - Duration_Milliseconds_Double = 14, - /// The ISO8601 time format. - Time_ISO8601 = 15, - /// The Base64Url bytes format. - Bytes_Base64Url = 16, - /// The Base64 bytes format. - Bytes_Base64 = 17 - } -} diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/body-optionality/src/Generated/Internal/TypeFormatters.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/body-optionality/src/Generated/Internal/TypeFormatters.cs deleted file mode 100644 index f4aa41863b6..00000000000 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/body-optionality/src/Generated/Internal/TypeFormatters.cs +++ /dev/null @@ -1,178 +0,0 @@ -// - -#nullable disable - -using System; -using System.Collections.Generic; -using System.Globalization; -using System.Xml; - -namespace Parameters.BodyOptionality -{ - internal static partial class TypeFormatters - { - private const string RoundtripZFormat = "yyyy-MM-ddTHH:mm:ss.fffffffZ"; - public const string DefaultNumberFormat = "G"; - - public static string ToString(bool value) => value ? "true" : "false"; - - public static string ToString(DateTime value, string format) => value.Kind switch - { - DateTimeKind.Utc => ToString((DateTimeOffset)value, format), - _ => throw new NotSupportedException($"DateTime {value} has a Kind of {value.Kind}. Generated clients require it to be UTC. You can call DateTime.SpecifyKind to change Kind property value to DateTimeKind.Utc.") - }; - - public static string ToString(DateTimeOffset value, string format) => format switch - { - "D" => value.ToString("yyyy-MM-dd", CultureInfo.InvariantCulture), - "U" => value.ToUnixTimeSeconds().ToString(CultureInfo.InvariantCulture), - "O" => value.ToUniversalTime().ToString(RoundtripZFormat, CultureInfo.InvariantCulture), - "o" => value.ToUniversalTime().ToString(RoundtripZFormat, CultureInfo.InvariantCulture), - "R" => value.ToString("r", CultureInfo.InvariantCulture), - _ => value.ToString(format, CultureInfo.InvariantCulture) - }; - - public static string ToString(TimeSpan value, string format) => format switch - { - "P" => XmlConvert.ToString(value), - _ => value.ToString(format, CultureInfo.InvariantCulture) - }; - - public static string ToString(byte[] value, string format) => format switch - { - "U" => ToBase64UrlString(value), - "D" => Convert.ToBase64String(value), - _ => throw new ArgumentException($"Format is not supported: '{format}'", nameof(format)) - }; - - public static string ToBase64UrlString(byte[] value) - { - int numWholeOrPartialInputBlocks = checked (value.Length + 2) / 3; - int size = checked (numWholeOrPartialInputBlocks * 4); - char[] output = new char[size]; - - int numBase64Chars = Convert.ToBase64CharArray(value, 0, value.Length, output, 0); - - int i = 0; - for (; i < numBase64Chars; i++) - { - char ch = output[i]; - if (ch == '+') - { - output[i] = '-'; - } - else - { - if (ch == '/') - { - output[i] = '_'; - } - else - { - if (ch == '=') - { - break; - } - } - } - } - - return new string(output, 0, i); - } - - public static byte[] FromBase64UrlString(string value) - { - int paddingCharsToAdd = (value.Length % 4) switch - { - 0 => 0, - 2 => 2, - 3 => 1, - _ => throw new InvalidOperationException("Malformed input") - }; - char[] output = new char[(value.Length + paddingCharsToAdd)]; - int i = 0; - for (; i < value.Length; i++) - { - char ch = value[i]; - if (ch == '-') - { - output[i] = '+'; - } - else - { - if (ch == '_') - { - output[i] = '/'; - } - else - { - output[i] = ch; - } - } - } - - for (; i < output.Length; i++) - { - output[i] = '='; - } - - return Convert.FromBase64CharArray(output, 0, output.Length); - } - - public static DateTimeOffset ParseDateTimeOffset(string value, string format) => format switch - { - "U" => DateTimeOffset.FromUnixTimeSeconds(long.Parse(value, CultureInfo.InvariantCulture)), - _ => DateTimeOffset.Parse(value, CultureInfo.InvariantCulture, DateTimeStyles.AssumeUniversal) - }; - - public static TimeSpan ParseTimeSpan(string value, string format) => format switch - { - "P" => XmlConvert.ToTimeSpan(value), - _ => TimeSpan.ParseExact(value, format, CultureInfo.InvariantCulture) - }; - - public static string ToFormatSpecifier(SerializationFormat format) => format switch - { - SerializationFormat.DateTime_RFC1123 => "R", - SerializationFormat.DateTime_RFC3339 => "O", - SerializationFormat.DateTime_RFC7231 => "R", - SerializationFormat.DateTime_ISO8601 => "O", - SerializationFormat.Date_ISO8601 => "D", - SerializationFormat.DateTime_Unix => "U", - SerializationFormat.Bytes_Base64Url => "U", - SerializationFormat.Bytes_Base64 => "D", - SerializationFormat.Duration_ISO8601 => "P", - SerializationFormat.Duration_Constant => "c", - SerializationFormat.Duration_Seconds => "%s", - SerializationFormat.Duration_Seconds_Float => "s\\.FFF", - SerializationFormat.Duration_Seconds_Double => "s\\.FFFFFF", - SerializationFormat.Time_ISO8601 => "T", - _ => null - }; - - public static string ConvertToString(object value, SerializationFormat format = SerializationFormat.Default) - { - string formatSpecifier = ToFormatSpecifier(format); - - return value switch - { - null => "null", - string s => s, - bool b => ToString(b), - int or float or double or long or decimal => ((IFormattable)value).ToString(DefaultNumberFormat, CultureInfo.InvariantCulture), - byte[] b0 when formatSpecifier != null => ToString(b0, formatSpecifier), - IEnumerable s0 => string.Join(",", s0), - DateTimeOffset dateTime when formatSpecifier != null => ToString(dateTime, formatSpecifier), - TimeSpan timeSpan when format == SerializationFormat.Duration_Seconds => Convert.ToInt32(timeSpan.TotalSeconds).ToString(CultureInfo.InvariantCulture), - TimeSpan timeSpan0 when format == SerializationFormat.Duration_Seconds_Float || format == SerializationFormat.Duration_Seconds_Double => timeSpan0.TotalSeconds.ToString(CultureInfo.InvariantCulture), - TimeSpan timeSpan1 when format == SerializationFormat.Duration_Milliseconds => Convert.ToInt32(timeSpan1.TotalMilliseconds).ToString(CultureInfo.InvariantCulture), - TimeSpan timeSpan2 when format == SerializationFormat.Duration_Milliseconds_Float || format == SerializationFormat.Duration_Milliseconds_Double => timeSpan2.TotalMilliseconds.ToString(CultureInfo.InvariantCulture), - TimeSpan timeSpan3 when formatSpecifier != null => ToString(timeSpan3, formatSpecifier), - TimeSpan timeSpan4 => XmlConvert.ToString(timeSpan4), - Guid guid => guid.ToString(), - BinaryData binaryData => ConvertToString(binaryData.ToArray(), format), - _ => value.ToString() - }; - } - } -} diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/body-optionality/src/Generated/Models/BodyModel.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/body-optionality/src/Generated/Models/BodyModel.Serialization.cs index a762581a3f2..7f142275b66 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/body-optionality/src/Generated/Models/BodyModel.Serialization.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/body-optionality/src/Generated/Models/BodyModel.Serialization.cs @@ -5,146 +5,32 @@ using System; using System.ClientModel; using System.ClientModel.Primitives; -using System.Collections.Generic; using System.Text.Json; namespace Parameters.BodyOptionality { - /// The BodyModel. public partial class BodyModel : IJsonModel { - /// Initializes a new instance of for deserialization. - internal BodyModel() - { - } + internal BodyModel() => throw null; - /// The data to parse. - /// The client options for reading and writing models. - protected virtual BodyModel PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) - { - string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - switch (format) - { - case "J": - using (JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions)) - { - return DeserializeBodyModel(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(BodyModel)} does not support reading '{options.Format}' format."); - } - } + protected virtual BodyModel PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; - /// The client options for reading and writing models. - protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) - { - string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - switch (format) - { - case "J": - return ModelReaderWriter.Write(this, options, ParametersBodyOptionalityContext.Default); - default: - throw new FormatException($"The model {nameof(BodyModel)} does not support writing '{options.Format}' format."); - } - } + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) => throw null; - /// The client options for reading and writing models. - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => throw null; - /// The data to parse. - /// The client options for reading and writing models. - BodyModel IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + BodyModel IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => throw null; - /// The client options for reading and writing models. - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => throw null; - /// The to serialize into . - public static implicit operator BinaryContent(BodyModel bodyModel) - { - if (bodyModel == null) - { - return null; - } - return BinaryContent.Create(bodyModel, ModelSerializationExtensions.WireOptions); - } + public static implicit operator BinaryContent(BodyModel bodyModel) => throw null; - /// The JSON writer. - /// The client options for reading and writing models. - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - writer.WriteStartObject(); - JsonModelWriteCore(writer, options); - writer.WriteEndObject(); - } + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; - /// The JSON writer. - /// The client options for reading and writing models. - protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(BodyModel)} does not support writing '{format}' format."); - } - writer.WritePropertyName("name"u8); - writer.WriteStringValue(Name); - if (options.Format != "W" && _additionalBinaryDataProperties != null) - { - foreach (var item in _additionalBinaryDataProperties) - { - writer.WritePropertyName(item.Key); -#if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); -#else - using (JsonDocument document = JsonDocument.Parse(item.Value)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - } + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; - /// The JSON reader. - /// The client options for reading and writing models. - BodyModel IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + BodyModel IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => throw null; - /// The JSON reader. - /// The client options for reading and writing models. - protected virtual BodyModel JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) - { - string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(BodyModel)} does not support reading '{format}' format."); - } - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeBodyModel(document.RootElement, options); - } - - /// The JSON element to deserialize. - /// The client options for reading and writing models. - internal static BodyModel DeserializeBodyModel(JsonElement element, ModelReaderWriterOptions options) - { - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - string name = default; - IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); - foreach (var prop in element.EnumerateObject()) - { - if (prop.NameEquals("name"u8)) - { - name = prop.Value.GetString(); - continue; - } - if (options.Format != "W") - { - additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); - } - } - return new BodyModel(name, additionalBinaryDataProperties); - } + protected virtual BodyModel JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => throw null; } } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/body-optionality/src/Generated/Models/BodyModel.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/body-optionality/src/Generated/Models/BodyModel.cs index 83f9e5e1510..5726118c284 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/body-optionality/src/Generated/Models/BodyModel.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/body-optionality/src/Generated/Models/BodyModel.cs @@ -2,37 +2,12 @@ #nullable disable -using System; -using System.Collections.Generic; - namespace Parameters.BodyOptionality { - /// The BodyModel. public partial class BodyModel { - /// Keeps track of any properties unknown to the library. - private protected readonly IDictionary _additionalBinaryDataProperties; - - /// Initializes a new instance of . - /// - /// is null. - public BodyModel(string name) - { - Argument.AssertNotNull(name, nameof(name)); - - Name = name; - } - - /// Initializes a new instance of . - /// - /// Keeps track of any properties unknown to the library. - internal BodyModel(string name, IDictionary additionalBinaryDataProperties) - { - Name = name; - _additionalBinaryDataProperties = additionalBinaryDataProperties; - } + public BodyModel(string name) => throw null; - /// Gets the Name. - public string Name { get; } + public string Name => throw null; } } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/body-optionality/src/Generated/Models/ParametersBodyOptionalityContext.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/body-optionality/src/Generated/Models/ParametersBodyOptionalityContext.cs index 1886e039e11..cf75f43d92f 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/body-optionality/src/Generated/Models/ParametersBodyOptionalityContext.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/body-optionality/src/Generated/Models/ParametersBodyOptionalityContext.cs @@ -6,10 +6,6 @@ namespace Parameters.BodyOptionality { - /// - /// Context class which will be filled in by the System.ClientModel.SourceGeneration. - /// For more information - /// [ModelReaderWriterBuildable(typeof(BodyModel))] public partial class ParametersBodyOptionalityContext : ModelReaderWriterContext { diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/body-optionality/src/Generated/OptionalExplicit.RestClient.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/body-optionality/src/Generated/OptionalExplicit.RestClient.cs deleted file mode 100644 index e3f5f52c832..00000000000 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/body-optionality/src/Generated/OptionalExplicit.RestClient.cs +++ /dev/null @@ -1,50 +0,0 @@ -// - -#nullable disable - -using System.ClientModel; -using System.ClientModel.Primitives; -using Parameters.BodyOptionality; - -namespace Parameters.BodyOptionality._OptionalExplicit -{ - /// - public partial class OptionalExplicit - { - private static PipelineMessageClassifier _pipelineMessageClassifier204; - - private static PipelineMessageClassifier PipelineMessageClassifier204 => _pipelineMessageClassifier204 ??= PipelineMessageClassifier.Create(stackalloc ushort[] { 204 }); - - internal PipelineMessage CreateSetRequest(BinaryContent content, RequestOptions options) - { - ClientUriBuilder uri = new ClientUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/parameters/body-optionality/optional-explicit/set", false); - PipelineMessage message = Pipeline.CreateMessage(uri.ToUri(), "POST", PipelineMessageClassifier204); - PipelineRequest request = message.Request; - if ("application/json" != null) - { - request.Headers.Set("Content-Type", "application/json"); - } - request.Content = content; - message.Apply(options); - return message; - } - - internal PipelineMessage CreateOmitRequest(BinaryContent content, RequestOptions options) - { - ClientUriBuilder uri = new ClientUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/parameters/body-optionality/optional-explicit/omit", false); - PipelineMessage message = Pipeline.CreateMessage(uri.ToUri(), "POST", PipelineMessageClassifier204); - PipelineRequest request = message.Request; - if ("application/json" != null) - { - request.Headers.Set("Content-Type", "application/json"); - } - request.Content = content; - message.Apply(options); - return message; - } - } -} diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/body-optionality/src/Generated/OptionalExplicit.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/body-optionality/src/Generated/OptionalExplicit.cs index 66afe277ed8..5d4de240634 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/body-optionality/src/Generated/OptionalExplicit.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/body-optionality/src/Generated/OptionalExplicit.cs @@ -11,134 +11,28 @@ namespace Parameters.BodyOptionality._OptionalExplicit { - /// The OptionalExplicit sub-client. public partial class OptionalExplicit { - private readonly Uri _endpoint; + protected OptionalExplicit() => throw null; - /// Initializes a new instance of OptionalExplicit for mocking. - protected OptionalExplicit() - { - } + internal OptionalExplicit(ClientPipeline pipeline, Uri endpoint) => throw null; - /// Initializes a new instance of OptionalExplicit. - /// The HTTP pipeline for sending and receiving REST requests and responses. - /// Service endpoint. - internal OptionalExplicit(ClientPipeline pipeline, Uri endpoint) - { - _endpoint = endpoint; - Pipeline = pipeline; - } + public ClientPipeline Pipeline => throw null; - /// The HTTP pipeline for sending and receiving REST requests and responses. - public ClientPipeline Pipeline { get; } + public virtual ClientResult Set(BinaryContent content, RequestOptions options = null) => throw null; - /// - /// [Protocol Method] Set - /// - /// - /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. - /// - /// - /// - /// The content to send as the body of the request. - /// The request options, which can override default behaviors of the client pipeline on a per-call basis. - /// Service returned a non-success status code. - /// The response returned from the service. - public virtual ClientResult Set(BinaryContent content, RequestOptions options = null) - { - using PipelineMessage message = CreateSetRequest(content, options); - return ClientResult.FromResponse(Pipeline.ProcessMessage(message, options)); - } + public virtual Task SetAsync(BinaryContent content, RequestOptions options = null) => throw null; - /// - /// [Protocol Method] Set - /// - /// - /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. - /// - /// - /// - /// The content to send as the body of the request. - /// The request options, which can override default behaviors of the client pipeline on a per-call basis. - /// Service returned a non-success status code. - /// The response returned from the service. - public virtual async Task SetAsync(BinaryContent content, RequestOptions options = null) - { - using PipelineMessage message = CreateSetRequest(content, options); - return ClientResult.FromResponse(await Pipeline.ProcessMessageAsync(message, options).ConfigureAwait(false)); - } + public virtual ClientResult Set(BodyModel body = default, CancellationToken cancellationToken = default) => throw null; - /// Set. - /// - /// The cancellation token that can be used to cancel the operation. - /// Service returned a non-success status code. - public virtual ClientResult Set(BodyModel body = default, CancellationToken cancellationToken = default) - { - return Set(body, cancellationToken.ToRequestOptions()); - } + public virtual Task SetAsync(BodyModel body = default, CancellationToken cancellationToken = default) => throw null; - /// Set. - /// - /// The cancellation token that can be used to cancel the operation. - /// Service returned a non-success status code. - public virtual async Task SetAsync(BodyModel body = default, CancellationToken cancellationToken = default) - { - return await SetAsync(body, cancellationToken.ToRequestOptions()).ConfigureAwait(false); - } + public virtual ClientResult Omit(BinaryContent content, RequestOptions options = null) => throw null; - /// - /// [Protocol Method] Omit - /// - /// - /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. - /// - /// - /// - /// The content to send as the body of the request. - /// The request options, which can override default behaviors of the client pipeline on a per-call basis. - /// Service returned a non-success status code. - /// The response returned from the service. - public virtual ClientResult Omit(BinaryContent content, RequestOptions options = null) - { - using PipelineMessage message = CreateOmitRequest(content, options); - return ClientResult.FromResponse(Pipeline.ProcessMessage(message, options)); - } + public virtual Task OmitAsync(BinaryContent content, RequestOptions options = null) => throw null; - /// - /// [Protocol Method] Omit - /// - /// - /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. - /// - /// - /// - /// The content to send as the body of the request. - /// The request options, which can override default behaviors of the client pipeline on a per-call basis. - /// Service returned a non-success status code. - /// The response returned from the service. - public virtual async Task OmitAsync(BinaryContent content, RequestOptions options = null) - { - using PipelineMessage message = CreateOmitRequest(content, options); - return ClientResult.FromResponse(await Pipeline.ProcessMessageAsync(message, options).ConfigureAwait(false)); - } + public virtual ClientResult Omit(BodyModel body = default, CancellationToken cancellationToken = default) => throw null; - /// Omit. - /// - /// The cancellation token that can be used to cancel the operation. - /// Service returned a non-success status code. - public virtual ClientResult Omit(BodyModel body = default, CancellationToken cancellationToken = default) - { - return Omit(body, cancellationToken.ToRequestOptions()); - } - - /// Omit. - /// - /// The cancellation token that can be used to cancel the operation. - /// Service returned a non-success status code. - public virtual async Task OmitAsync(BodyModel body = default, CancellationToken cancellationToken = default) - { - return await OmitAsync(body, cancellationToken.ToRequestOptions()).ConfigureAwait(false); - } + public virtual Task OmitAsync(BodyModel body = default, CancellationToken cancellationToken = default) => throw null; } } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/body-optionality/src/Generated/ParametersBodyOptionalityModelFactory.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/body-optionality/src/Generated/ParametersBodyOptionalityModelFactory.cs index 5253face1fb..c810ed2aaa2 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/body-optionality/src/Generated/ParametersBodyOptionalityModelFactory.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/body-optionality/src/Generated/ParametersBodyOptionalityModelFactory.cs @@ -4,15 +4,8 @@ namespace Parameters.BodyOptionality { - /// A factory class for creating instances of the models for mocking. public static partial class ParametersBodyOptionalityModelFactory { - /// The BodyModel. - /// - /// A new instance for mocking. - public static BodyModel BodyModel(string name = default) - { - return new BodyModel(name, additionalBinaryDataProperties: null); - } + public static BodyModel BodyModel(string name = default) => throw null; } } From e3998e64a5a38410d726654ea528f4523ef33453 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 11 Mar 2026 23:13:19 +0000 Subject: [PATCH 24/38] fix: OAuth2 tests use BindingFlags.Static for _flows field; extract credential/settings param name constants Co-authored-by: JoshLove-msft <54595583+JoshLove-msft@users.noreply.github.com> --- .../src/Providers/ClientProvider.cs | 12 +++++++----- .../Http/Authentication/OAuth2/OAuth2Tests.cs | 12 ++++++------ 2 files changed, 13 insertions(+), 11 deletions(-) diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Providers/ClientProvider.cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Providers/ClientProvider.cs index 101904828d2..509aa32bbb1 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Providers/ClientProvider.cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Providers/ClientProvider.cs @@ -37,6 +37,8 @@ private record ApiVersionFields(FieldProvider Field, PropertyProvider? Correspon private const string TokenProviderFieldName = "_tokenProvider"; private const string TokenCredentialFieldName = "_tokenCredential"; private const string EndpointFieldName = "_endpoint"; + private const string CredentialParamName = "credential"; + private const string SettingsParamName = "settings"; private const string ClientSuffix = "Client"; private readonly FormattableString _publicCtorDescription; private readonly InputClient _inputClient; @@ -620,7 +622,7 @@ void AppendPublicConstructors( // Add non-auth required parameters from the SAME parameter list (requiredParameters) // to ensure the initializer references the same objects as the constructor signature. string? authParamName = authFields != null - ? (authFields.AuthField.Name != TokenProviderFieldName ? "credential" : authFields.AuthField.AsParameter.Name) + ? (authFields.AuthField.Name != TokenProviderFieldName ? CredentialParamName : authFields.AuthField.AsParameter.Name) : null; foreach (var p in requiredParameters) { @@ -664,7 +666,7 @@ private IEnumerable BuildSettingsConstructors() yield break; } - var settingsParam = new ParameterProvider("settings", $"The settings for {Name}.", ClientSettings.Type); + var settingsParam = new ParameterProvider(SettingsParamName, $"The settings for {Name}.", ClientSettings.Type); var experimentalAttr = new AttributeStatement(typeof(ExperimentalAttribute), [Literal(ClientSettingsProvider.ClientSettingsDiagnosticId)]); // Build the arguments for the this(...) internal constructor initializer: @@ -811,7 +813,7 @@ private IReadOnlyList GetRequiredParameters(FieldProvider? au var authParameter = authField.AsParameter; if (authField.Name != TokenProviderFieldName) { - authParameter.Update(name: "credential"); + authParameter.Update(name: CredentialParamName); } requiredParameters.Add(authParameter); } @@ -940,7 +942,7 @@ private ValueExpression BuildAuthPolicyArgument(AuthFields? authFields, IReadOnl if (authFields is ApiKeyFields keyFields) { // ApiKeyAuthenticationPolicy.CreateHeaderApiKeyPolicy(credential, AuthorizationHeader, prefix?) - var credParam = requiredParameters.FirstOrDefault(p => p.Name == "credential"); + var credParam = requiredParameters.FirstOrDefault(p => p.Name == CredentialParamName); if (credParam != null) { ValueExpression? keyPrefixExpression = keyFields.AuthorizationApiKeyPrefixField != null ? (ValueExpression)keyFields.AuthorizationApiKeyPrefixField : null; @@ -953,7 +955,7 @@ private ValueExpression BuildAuthPolicyArgument(AuthFields? authFields, IReadOnl // The param name is derived from the field name: _tokenProvider → tokenProvider, _tokenCredential → credential var credParam = requiredParameters.FirstOrDefault(p => p.Name == TokenProviderFieldName.ToVariableName() || - p.Name == "credential"); + p.Name == CredentialParamName); if (credParam != null) { return This.ToApi().TokenAuthorizationPolicy(credParam, oauth2Fields.AuthorizationScopesField); diff --git a/packages/http-client-csharp/generator/TestProjects/Spector.Tests/Http/Authentication/OAuth2/OAuth2Tests.cs b/packages/http-client-csharp/generator/TestProjects/Spector.Tests/Http/Authentication/OAuth2/OAuth2Tests.cs index dc6e99bee90..f40e866724e 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector.Tests/Http/Authentication/OAuth2/OAuth2Tests.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector.Tests/Http/Authentication/OAuth2/OAuth2Tests.cs @@ -22,12 +22,12 @@ public Task Valid() => Test(async (host) => // create a test client to access the private field "_flows". This will be used to pass to the test token provider. var tokenProvider = new ClientCredentialTokenProvider("myClientId", "myClientSecret"); var testClient = new OAuth2Client(tokenProvider); - var flowsField = testClient.GetType().GetField("_flows", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance); + var flowsField = testClient.GetType().GetField("_flows", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Static); Assert.IsNotNull(flowsField, "Flows field should not be null"); - Assert.IsInstanceOf[]>(flowsField!.GetValue(testClient), "Flows field should be of type Dictionary[]"); + Assert.IsInstanceOf[]>(flowsField!.GetValue(null), "Flows field should be of type Dictionary[]"); // Retrieve the value of the field and cast it to the expected type. - var flows = flowsField!.GetValue(testClient) as Dictionary[]; + var flows = flowsField!.GetValue(null) as Dictionary[]; Assert.IsNotNull(flows, "Flows field should be of type Dictionary[]"); // Parse the generated scope to use in the test. @@ -62,12 +62,12 @@ public Task Invalid() => Test((host) => // create a test client to access the private field "_flows". This will be used to pass to the test token provider. var tokenProvider = new ClientCredentialTokenProvider("myClientId", "myClientSecret"); var testClient = new OAuth2Client(tokenProvider); - var flowsField = testClient.GetType().GetField("_flows", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance); + var flowsField = testClient.GetType().GetField("_flows", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Static); Assert.IsNotNull(flowsField, "Flows field should not be null"); - Assert.IsInstanceOf[]>(flowsField!.GetValue(testClient), "Flows field should be of type Dictionary[]"); + Assert.IsInstanceOf[]>(flowsField!.GetValue(null), "Flows field should be of type Dictionary[]"); // Retrieve the value of the field and cast it to the expected type. - var flows = flowsField!.GetValue(testClient) as Dictionary[]; + var flows = flowsField!.GetValue(null) as Dictionary[]; Assert.IsNotNull(flows, "Flows field should be of type Dictionary[]"); // Parse the generated scope to use in the test. From ec76257788361c370fb758ab77eaa09aeb8ef6a9 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 11 Mar 2026 23:59:40 +0000 Subject: [PATCH 25/38] feat: add bool, int, TimeSpan TryParse bindings in ClientSettingsProvider with tests Co-authored-by: JoshLove-msft <54595583+JoshLove-msft@users.noreply.github.com> --- .../src/Providers/ClientSettingsProvider.cs | 48 ++++++- .../Providers/ClientSettingsProviderTests.cs | 134 ++++++++++++++++++ 2 files changed, 179 insertions(+), 3 deletions(-) diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Providers/ClientSettingsProvider.cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Providers/ClientSettingsProvider.cs index eecaf6ef18a..80da96eb78b 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Providers/ClientSettingsProvider.cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Providers/ClientSettingsProvider.cs @@ -133,8 +133,15 @@ protected override MethodProvider[] BuildMethods() foreach (var param in OtherRequiredParams) { var propName = param.Name.ToIdentifierName(); - // For string types: if (section[propName] is string val) PropName = val; - if (param.Type.IsFrameworkType && param.Type.FrameworkType == typeof(string)) + if (!param.Type.IsFrameworkType) + { + continue; + } + + var frameworkType = param.Type.FrameworkType; + + // For string types: if (!string.IsNullOrEmpty(val)) PropName = val; + if (frameworkType == typeof(string)) { var valVar = new VariableExpression(new CSharpType(typeof(string), isNullable: true), param.Name.ToVariableName()); body.Add(Declare(valVar, new IndexerExpression(sectionParam, Literal(propName)))); @@ -142,7 +149,21 @@ protected override MethodProvider[] BuildMethods() ifStatement.Add(This.Property(propName).Assign(valVar).Terminate()); body.Add(ifStatement); } - // Other types are skipped in BindCore (users can customize via partial class) + // For bool: if (bool.TryParse(section[name], out bool val)) PropName = val; + else if (frameworkType == typeof(bool)) + { + AppendTryParseBinding(body, sectionParam, propName, param, typeof(bool)); + } + // For int: if (int.TryParse(section[name], out int val)) PropName = val; + else if (frameworkType == typeof(int)) + { + AppendTryParseBinding(body, sectionParam, propName, param, typeof(int)); + } + // For TimeSpan: if (TimeSpan.TryParse(section[name], out TimeSpan val)) PropName = val; + else if (frameworkType == typeof(TimeSpan)) + { + AppendTryParseBinding(body, sectionParam, propName, param, typeof(TimeSpan)); + } } if (_clientProvider.ClientOptions != null) @@ -171,5 +192,26 @@ protected override MethodProvider[] BuildMethods() return [bindCoreMethod]; } + + /// + /// Appends a TryParse-based binding statement: if (Type.TryParse(section[name], out Type val)) PropName = val; + /// + private static void AppendTryParseBinding( + List body, + ParameterProvider sectionParam, + string propName, + ParameterProvider param, + Type parseType) + { + var outDecl = new DeclarationExpression(parseType, param.Name.ToVariableName(), out var parsedVar, isOut: true); + var ifStatement = new IfStatement(Static(parseType).Invoke("TryParse", + new ValueExpression[] + { + new IndexerExpression(sectionParam, Literal(propName)), + outDecl + })); + ifStatement.Add(This.Property(propName).Assign(parsedVar).Terminate()); + body.Add(ifStatement); + } } } diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientSettingsProviderTests.cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientSettingsProviderTests.cs index 90819cfdbc4..93ef5b91980 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientSettingsProviderTests.cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientSettingsProviderTests.cs @@ -148,6 +148,140 @@ public void TestBindCoreMethod_WithOptionsSection() "BindCore should get the Options section from configuration"); } + [Test] + public void TestBindCoreMethod_WithBoolParam() + { + var inputParameters = new InputParameter[] + { + InputFactory.EndpointParameter( + "endpoint", + InputPrimitiveType.String, + defaultValue: InputFactory.Constant.String("https://default.endpoint.io"), + scope: InputParameterScope.Client, + isEndpoint: true), + InputFactory.MethodParameter( + "enableRetry", + InputPrimitiveType.Boolean, + isRequired: true, + scope: InputParameterScope.Client) + }; + var client = InputFactory.Client("TestClient", parameters: inputParameters); + var clientProvider = new ClientProvider(client); + var settingsProvider = clientProvider.ClientSettings; + + Assert.IsNotNull(settingsProvider); + + var bindCoreMethod = settingsProvider!.Methods.FirstOrDefault(m => m.Signature.Name == "BindCore"); + Assert.IsNotNull(bindCoreMethod); + + var bodyString = bindCoreMethod!.BodyStatements!.ToDisplayString(); + Assert.IsTrue(bodyString.Contains("bool.TryParse"), "BindCore should use bool.TryParse for bool parameter binding"); + Assert.IsTrue(bodyString.Contains("EnableRetry"), "BindCore should assign to EnableRetry property"); + } + + [Test] + public void TestBindCoreMethod_WithIntParam() + { + var inputParameters = new InputParameter[] + { + InputFactory.EndpointParameter( + "endpoint", + InputPrimitiveType.String, + defaultValue: InputFactory.Constant.String("https://default.endpoint.io"), + scope: InputParameterScope.Client, + isEndpoint: true), + InputFactory.MethodParameter( + "maxRetries", + InputPrimitiveType.Int32, + isRequired: true, + scope: InputParameterScope.Client) + }; + var client = InputFactory.Client("TestClient", parameters: inputParameters); + var clientProvider = new ClientProvider(client); + var settingsProvider = clientProvider.ClientSettings; + + Assert.IsNotNull(settingsProvider); + + var bindCoreMethod = settingsProvider!.Methods.FirstOrDefault(m => m.Signature.Name == "BindCore"); + Assert.IsNotNull(bindCoreMethod); + + var bodyString = bindCoreMethod!.BodyStatements!.ToDisplayString(); + Assert.IsTrue(bodyString.Contains("int.TryParse"), "BindCore should use int.TryParse for int parameter binding"); + Assert.IsTrue(bodyString.Contains("MaxRetries"), "BindCore should assign to MaxRetries property"); + } + + [Test] + public void TestBindCoreMethod_WithStringParam() + { + var inputParameters = new InputParameter[] + { + InputFactory.EndpointParameter( + "endpoint", + InputPrimitiveType.String, + defaultValue: InputFactory.Constant.String("https://default.endpoint.io"), + scope: InputParameterScope.Client, + isEndpoint: true), + InputFactory.MethodParameter( + "tenantId", + InputPrimitiveType.String, + isRequired: true, + scope: InputParameterScope.Client) + }; + var client = InputFactory.Client("TestClient", parameters: inputParameters); + var clientProvider = new ClientProvider(client); + var settingsProvider = clientProvider.ClientSettings; + + Assert.IsNotNull(settingsProvider); + + var bindCoreMethod = settingsProvider!.Methods.FirstOrDefault(m => m.Signature.Name == "BindCore"); + Assert.IsNotNull(bindCoreMethod); + + var bodyString = bindCoreMethod!.BodyStatements!.ToDisplayString(); + Assert.IsTrue(bodyString.Contains("IsNullOrEmpty"), "BindCore should use string.IsNullOrEmpty for string parameter binding"); + Assert.IsTrue(bodyString.Contains("TenantId"), "BindCore should assign to TenantId property"); + } + + [Test] + public void TestProperties_WithMultipleParamTypes() + { + var inputParameters = new InputParameter[] + { + InputFactory.EndpointParameter( + "endpoint", + InputPrimitiveType.String, + defaultValue: InputFactory.Constant.String("https://default.endpoint.io"), + scope: InputParameterScope.Client, + isEndpoint: true), + InputFactory.MethodParameter( + "enableRetry", + InputPrimitiveType.Boolean, + isRequired: true, + scope: InputParameterScope.Client), + InputFactory.MethodParameter( + "maxRetries", + InputPrimitiveType.Int32, + isRequired: true, + scope: InputParameterScope.Client), + InputFactory.MethodParameter( + "tenantId", + InputPrimitiveType.String, + isRequired: true, + scope: InputParameterScope.Client) + }; + var client = InputFactory.Client("TestClient", parameters: inputParameters); + var clientProvider = new ClientProvider(client); + var settingsProvider = clientProvider.ClientSettings; + + Assert.IsNotNull(settingsProvider); + + var properties = settingsProvider!.Properties; + Assert.IsNotNull(properties.FirstOrDefault(p => p.Name == "Endpoint"), "Settings should have Endpoint property"); + Assert.IsNotNull(properties.FirstOrDefault(p => p.Name == "EnableRetry"), "Settings should have EnableRetry property"); + Assert.IsNotNull(properties.FirstOrDefault(p => p.Name == "MaxRetries"), "Settings should have MaxRetries property"); + Assert.IsNotNull(properties.FirstOrDefault(p => p.Name == "TenantId"), "Settings should have TenantId property"); + Assert.IsNotNull(properties.FirstOrDefault(p => p.Name == "Options"), "Settings should have Options property"); + } + [Test] public void TestExperimentalAttribute() { From dc67cdba9c0aa91c00b3967c6cd82430abfb7515 Mon Sep 17 00:00:00 2001 From: jolov Date: Wed, 11 Mar 2026 17:59:08 -0700 Subject: [PATCH 26/38] regen --- .../Sample-TypeSpec/src/Generated/Metrics.cs | 2 + .../src/Generated/SampleTypeSpecClient.cs | 37 ++++++++----------- .../Generated/SampleTypeSpecClientOptions.cs | 4 ++ .../Generated/SampleTypeSpecClientSettings.cs | 5 +-- 4 files changed, 23 insertions(+), 25 deletions(-) diff --git a/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Metrics.cs b/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Metrics.cs index 8f9c0ffffb6..edaaefc2d5d 100644 --- a/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Metrics.cs +++ b/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Metrics.cs @@ -47,6 +47,8 @@ public Metrics(Uri endpoint, SampleTypeSpecClientOptions options) { Argument.AssertNotNull(endpoint, nameof(endpoint)); + Argument.AssertNotNull(endpoint, nameof(endpoint)); + options ??= new SampleTypeSpecClientOptions(); _endpoint = endpoint; diff --git a/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/SampleTypeSpecClient.cs b/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/SampleTypeSpecClient.cs index 7674fd653d7..68333d650a6 100644 --- a/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/SampleTypeSpecClient.cs +++ b/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/SampleTypeSpecClient.cs @@ -21,13 +21,9 @@ namespace SampleTypeSpec public partial class SampleTypeSpecClient { private readonly Uri _endpoint; - /// A credential used to authenticate to the service. - private readonly ApiKeyCredential _keyCredential; private const string AuthorizationHeader = "my-api-key"; - /// A credential provider used to authenticate to the service. - private readonly AuthenticationTokenProvider _tokenProvider; /// The OAuth2 flows supported by the service. - private readonly Dictionary[] _flows = new Dictionary[] + private static readonly Dictionary[] _flows = new Dictionary[] { new Dictionary { @@ -57,45 +53,42 @@ protected SampleTypeSpecClient() } /// Initializes a new instance of SampleTypeSpecClient. + /// The authentication policy to use for pipeline creation. /// Service endpoint. - /// A credential used to authenticate to the service. /// The options for configuring the client. - /// or is null. - public SampleTypeSpecClient(Uri endpoint, ApiKeyCredential credential, SampleTypeSpecClientOptions options) + internal SampleTypeSpecClient(AuthenticationPolicy authenticationPolicy, Uri endpoint, SampleTypeSpecClientOptions options) { Argument.AssertNotNull(endpoint, nameof(endpoint)); - Argument.AssertNotNull(credential, nameof(credential)); options ??= new SampleTypeSpecClientOptions(); _endpoint = endpoint; - _keyCredential = credential; - Pipeline = ClientPipeline.Create(options, Array.Empty(), new PipelinePolicy[] { new UserAgentPolicy(typeof(SampleTypeSpecClient).Assembly), ApiKeyAuthenticationPolicy.CreateHeaderApiKeyPolicy(_keyCredential, AuthorizationHeader) }, Array.Empty()); + Pipeline = ClientPipeline.Create(options, Array.Empty(), new PipelinePolicy[] { new UserAgentPolicy(typeof(SampleTypeSpecClient).Assembly), authenticationPolicy }, Array.Empty()); _apiVersion = options.Version; } + /// Initializes a new instance of SampleTypeSpecClient. + /// Service endpoint. + /// A credential used to authenticate to the service. + /// The options for configuring the client. + /// or is null. + public SampleTypeSpecClient(Uri endpoint, ApiKeyCredential credential, SampleTypeSpecClientOptions options) : this(ApiKeyAuthenticationPolicy.CreateHeaderApiKeyPolicy(credential, AuthorizationHeader), endpoint, options) + { + } + /// Initializes a new instance of SampleTypeSpecClient. /// Service endpoint. /// A credential provider used to authenticate to the service. /// The options for configuring the client. /// or is null. - public SampleTypeSpecClient(Uri endpoint, AuthenticationTokenProvider tokenProvider, SampleTypeSpecClientOptions options) + public SampleTypeSpecClient(Uri endpoint, AuthenticationTokenProvider tokenProvider, SampleTypeSpecClientOptions options) : this(new BearerTokenPolicy(tokenProvider, _flows), endpoint, options) { - Argument.AssertNotNull(endpoint, nameof(endpoint)); - Argument.AssertNotNull(tokenProvider, nameof(tokenProvider)); - - options ??= new SampleTypeSpecClientOptions(); - - _endpoint = endpoint; - _tokenProvider = tokenProvider; - Pipeline = ClientPipeline.Create(options, Array.Empty(), new PipelinePolicy[] { new UserAgentPolicy(typeof(SampleTypeSpecClient).Assembly), new BearerTokenPolicy(_tokenProvider, _flows) }, Array.Empty()); - _apiVersion = options.Version; } /// Initializes a new instance of SampleTypeSpecClient from a . /// The settings for SampleTypeSpecClient. [Experimental("SCME0002")] - public SampleTypeSpecClient(SampleTypeSpecClientSettings settings) : this(settings?.SampleTypeSpecUrl, settings?.CredentialProvider as AuthenticationTokenProvider, settings?.Options) + public SampleTypeSpecClient(SampleTypeSpecClientSettings settings) : this(AuthenticationPolicy.Create(settings), settings?.SampleTypeSpecUrl, settings?.Options) { } diff --git a/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/SampleTypeSpecClientOptions.cs b/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/SampleTypeSpecClientOptions.cs index f697b689145..e26fb92bc89 100644 --- a/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/SampleTypeSpecClientOptions.cs +++ b/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/SampleTypeSpecClientOptions.cs @@ -39,6 +39,10 @@ internal SampleTypeSpecClientOptions(IConfigurationSection section) : base(secti { return; } + if (section["Version"] is string version) + { + Version = version; + } } /// Gets the Version. diff --git a/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/SampleTypeSpecClientSettings.cs b/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/SampleTypeSpecClientSettings.cs index d3a58b30dc6..ecda8d3d801 100644 --- a/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/SampleTypeSpecClientSettings.cs +++ b/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/SampleTypeSpecClientSettings.cs @@ -26,10 +26,9 @@ public partial class SampleTypeSpecClientSettings : ClientSettings /// The configuration section. protected override void BindCore(IConfigurationSection section) { - string endpoint = section["SampleTypeSpecUrl"]; - if (!string.IsNullOrEmpty(endpoint)) + if (Uri.TryCreate(section["SampleTypeSpecUrl"], UriKind.Absolute, out Uri sampleTypeSpecUrl)) { - SampleTypeSpecUrl = new Uri(endpoint); + SampleTypeSpecUrl = sampleTypeSpecUrl; } IConfigurationSection optionsSection = section.GetSection("Options"); if (optionsSection.Exists()) From 650560b6ecff36b56c9d058e37e5767c34ec6776 Mon Sep 17 00:00:00 2001 From: jolov Date: Thu, 12 Mar 2026 08:09:21 -0700 Subject: [PATCH 27/38] regen --- .../Local/Sample-TypeSpec/src/Generated/Metrics.cs | 1 + .../http/payload/xml/src/Generated/ModelWithDatetimeValue.cs | 3 +++ .../http/payload/xml/src/Generated/ModelWithEnumValue.cs | 3 +++ .../http/special-words/src/Generated/ExtensibleStrings.cs | 3 +++ 4 files changed, 10 insertions(+) diff --git a/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Metrics.cs b/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Metrics.cs index 3800cde35bd..453ad4fedf3 100644 --- a/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Metrics.cs +++ b/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Metrics.cs @@ -56,6 +56,7 @@ public Metrics(Uri endpoint, string metricsNamespace, SampleTypeSpecClientOption Argument.AssertNotNullOrEmpty(metricsNamespace, nameof(metricsNamespace)); Argument.AssertNotNull(endpoint, nameof(endpoint)); + Argument.AssertNotNullOrEmpty(metricsNamespace, nameof(metricsNamespace)); options ??= new SampleTypeSpecClientOptions(); diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/xml/src/Generated/ModelWithDatetimeValue.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/xml/src/Generated/ModelWithDatetimeValue.cs index d2d2be2b477..f986467c432 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/xml/src/Generated/ModelWithDatetimeValue.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/xml/src/Generated/ModelWithDatetimeValue.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -13,6 +14,8 @@ public partial class ModelWithDatetimeValue { protected ModelWithDatetimeValue() => throw null; + internal ModelWithDatetimeValue(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult Get(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/xml/src/Generated/ModelWithEnumValue.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/xml/src/Generated/ModelWithEnumValue.cs index cf8151f7576..92f3738b2ec 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/xml/src/Generated/ModelWithEnumValue.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/xml/src/Generated/ModelWithEnumValue.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -13,6 +14,8 @@ public partial class ModelWithEnumValue { protected ModelWithEnumValue() => throw null; + internal ModelWithEnumValue(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult Get(RequestOptions options) => throw null; diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/special-words/src/Generated/ExtensibleStrings.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/special-words/src/Generated/ExtensibleStrings.cs index eaa136ac8ca..a806732aa86 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector/http/special-words/src/Generated/ExtensibleStrings.cs +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/special-words/src/Generated/ExtensibleStrings.cs @@ -2,6 +2,7 @@ #nullable disable +using System; using System.ClientModel; using System.ClientModel.Primitives; using System.Threading; @@ -13,6 +14,8 @@ public partial class ExtensibleStrings { protected ExtensibleStrings() => throw null; + internal ExtensibleStrings(ClientPipeline pipeline, Uri endpoint) => throw null; + public ClientPipeline Pipeline => throw null; public virtual ClientResult PutExtensibleStringValue(string accept, BinaryContent content, RequestOptions options = null) => throw null; From 2377e65ac6d87df509dbc411c53cdce5d3c28d95 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 12 Mar 2026 15:32:17 +0000 Subject: [PATCH 28/38] fix: remove duplicated assertions in sub-client constructors The BuildPrimaryConstructorBody was adding explicit parameter validation for all constructors, but public constructors already get validation from the framework's automatic validation in MethodProviderHelpers. Added addExplicitValidation parameter to only emit validation for internal constructors where the framework doesn't auto-add it. Co-authored-by: JoshLove-msft <54595583+JoshLove-msft@users.noreply.github.com> --- .../src/Providers/ClientProvider.cs | 32 ++++++++++--------- .../Sample-TypeSpec/src/Generated/Metrics.cs | 3 -- 2 files changed, 17 insertions(+), 18 deletions(-) diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Providers/ClientProvider.cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Providers/ClientProvider.cs index 07dcc3a4731..a296420f62f 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Providers/ClientProvider.cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Providers/ClientProvider.cs @@ -593,7 +593,7 @@ protected override ConstructorProvider[] BuildConstructors() AuthFields? firstAuthFields = _apiKeyAuthFields as AuthFields ?? _oauth2Fields; var internalConstructor = new ConstructorProvider( new ConstructorSignature(Type, _publicCtorDescription, MethodSignatureModifiers.Internal, internalConstructorParameters), - BuildPrimaryConstructorBody(internalConstructorParameters, firstAuthFields, authPolicyParam, ClientOptions, ClientOptionsParameter), + BuildPrimaryConstructorBody(internalConstructorParameters, firstAuthFields, authPolicyParam, ClientOptions, ClientOptionsParameter, addExplicitValidation: true), this); primaryConstructors.Add(internalConstructor); } @@ -851,30 +851,32 @@ private IReadOnlyList GetRequiredParameters(FieldProvider? au return param; } - private MethodBodyStatement[] BuildPrimaryConstructorBody(IReadOnlyList primaryConstructorParameters, AuthFields? authFields, ParameterProvider? authPolicyParam, ClientOptionsProvider? clientOptionsProvider, ParameterProvider? clientOptionsParameter) + private MethodBodyStatement[] BuildPrimaryConstructorBody(IReadOnlyList primaryConstructorParameters, AuthFields? authFields, ParameterProvider? authPolicyParam, ClientOptionsProvider? clientOptionsProvider, ParameterProvider? clientOptionsParameter, bool addExplicitValidation = false) { if (clientOptionsProvider is null || clientOptionsParameter is null) { return [MethodBodyStatement.Empty]; } - // Add parameter validation assertions. - // Since the implementation constructor is internal, the framework's automatic validation - // (which only applies to public methods) won't add these. We add them explicitly because - // this is the sole implementation constructor and public constructors are pass-throughs. List body = []; - bool hasValidation = false; - foreach (var p in primaryConstructorParameters) + // Add parameter validation assertions explicitly only for internal constructors. + // The framework's automatic validation only applies to public methods, so internal + // implementation constructors need explicit validation since they contain the body. + if (addExplicitValidation) { - if (p.Validation != ParameterValidationType.None) + bool hasValidation = false; + foreach (var p in primaryConstructorParameters) { - body.Add(ArgumentSnippets.ValidateParameter(p)); - hasValidation = true; + if (p.Validation != ParameterValidationType.None) + { + body.Add(ArgumentSnippets.ValidateParameter(p)); + hasValidation = true; + } + } + if (hasValidation) + { + body.Add(MethodBodyStatement.EmptyLine); } - } - if (hasValidation) - { - body.Add(MethodBodyStatement.EmptyLine); } AssignmentExpression endpointAssignment; diff --git a/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Metrics.cs b/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Metrics.cs index 453ad4fedf3..8e55488af08 100644 --- a/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Metrics.cs +++ b/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/Metrics.cs @@ -55,9 +55,6 @@ public Metrics(Uri endpoint, string metricsNamespace, SampleTypeSpecClientOption Argument.AssertNotNull(endpoint, nameof(endpoint)); Argument.AssertNotNullOrEmpty(metricsNamespace, nameof(metricsNamespace)); - Argument.AssertNotNull(endpoint, nameof(endpoint)); - Argument.AssertNotNullOrEmpty(metricsNamespace, nameof(metricsNamespace)); - options ??= new SampleTypeSpecClientOptions(); _endpoint = endpoint; From b5a4ab54ab0f29f95b14f768c481eb70480d6239 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 12 Mar 2026 18:16:29 +0000 Subject: [PATCH 29/38] Add Uri, List, and enum type bindings in ClientSettingsProvider with tests Co-authored-by: JoshLove-msft <54595583+JoshLove-msft@users.noreply.github.com> --- .../src/Providers/ClientSettingsProvider.cs | 104 ++++++++++++++ .../Providers/ClientSettingsProviderTests.cs | 136 ++++++++++++++++++ 2 files changed, 240 insertions(+) diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Providers/ClientSettingsProvider.cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Providers/ClientSettingsProvider.cs index 80da96eb78b..25bcbeea07a 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Providers/ClientSettingsProvider.cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Providers/ClientSettingsProvider.cs @@ -133,8 +133,22 @@ protected override MethodProvider[] BuildMethods() foreach (var param in OtherRequiredParams) { var propName = param.Name.ToIdentifierName(); + + // Handle non-framework types (custom struct/enum) if (!param.Type.IsFrameworkType) { + // Custom struct/enum (extensible): if (section["Name"] is string val) { Name = new TypeName(val); } + if (param.Type.IsEnum) + { + AppendEnumBinding(body, sectionParam, propName, param); + } + continue; + } + + // Handle collection types (string[]/List) + if (param.Type.IsList) + { + AppendStringListBinding(body, sectionParam, propName, param); continue; } @@ -164,6 +178,11 @@ protected override MethodProvider[] BuildMethods() { AppendTryParseBinding(body, sectionParam, propName, param, typeof(TimeSpan)); } + // For Uri: if (Uri.TryCreate(section[name], UriKind.Absolute, out Uri val)) PropName = val; + else if (frameworkType == typeof(Uri)) + { + AppendUriTryCreateBinding(body, sectionParam, propName, param); + } } if (_clientProvider.ClientOptions != null) @@ -213,5 +232,90 @@ private static void AppendTryParseBinding( ifStatement.Add(This.Property(propName).Assign(parsedVar).Terminate()); body.Add(ifStatement); } + + /// + /// Appends a Uri.TryCreate binding: if (Uri.TryCreate(section[name], UriKind.Absolute, out Uri val)) PropName = val; + /// + private static void AppendUriTryCreateBinding( + List body, + ParameterProvider sectionParam, + string propName, + ParameterProvider param) + { + var outUriDecl = new DeclarationExpression(typeof(Uri), param.Name.ToVariableName(), out var uriVar, isOut: true); + var ifStatement = new IfStatement(Static(typeof(Uri)).Invoke("TryCreate", + new ValueExpression[] + { + new IndexerExpression(sectionParam, Literal(propName)), + new MemberExpression(typeof(UriKind), nameof(UriKind.Absolute)), + outUriDecl + })); + ifStatement.Add(This.Property(propName).Assign(uriVar).Terminate()); + body.Add(ifStatement); + } + + /// + /// Appends a string list binding: IConfigurationSection s = section.GetSection(name); + /// if (s.Exists()) { PropName = s.GetChildren().Where(c => c.Value is not null).Select(c => c.Value!).ToList(); } + /// + private static void AppendStringListBinding( + List body, + ParameterProvider sectionParam, + string propName, + ParameterProvider param) + { + // Only handle List for now + if (param.Type.Arguments.Count == 0 || + !param.Type.Arguments[0].IsFrameworkType || + param.Type.Arguments[0].FrameworkType != typeof(string)) + { + return; + } + + // IConfigurationSection listSection = section.GetSection("PropName"); + var sectionVar = new VariableExpression(IConfigurationSectionType, param.Name.ToVariableName() + "Section"); + body.Add(Declare(sectionVar, sectionParam.Invoke("GetSection", Literal(propName)))); + + // if (listSection.Exists()) + var ifExistsStatement = new IfStatement(sectionVar.Invoke("Exists")); + + // listSection.GetChildren().Where(c => c.Value is not null).Select(c => c.Value!).ToList() + var cDecl = new CodeWriterDeclaration("c"); + var cVar = new VariableExpression(IConfigurationSectionType, cDecl); + var whereCondition = new BinaryOperatorExpression("is not", cVar.Property("Value"), Null); + var whereLambda = new FuncExpression([cDecl], whereCondition); + var whereResult = sectionVar.Invoke("GetChildren") + .Invoke("Where", [whereLambda], null, false, extensionType: typeof(Enumerable)); + + var c2Decl = new CodeWriterDeclaration("c"); + var c2Var = new VariableExpression(IConfigurationSectionType, c2Decl); + var selectBody = new UnaryOperatorExpression("!", c2Var.Property("Value"), true); + var selectLambda = new FuncExpression([c2Decl], selectBody); + var selectResult = whereResult + .Invoke("Select", [selectLambda], null, false, extensionType: typeof(Enumerable)); + + var toListResult = selectResult.ToList(); + + ifExistsStatement.Add(This.Property(propName).Assign(toListResult).Terminate()); + body.Add(ifExistsStatement); + } + + /// + /// Appends an extensible enum binding: if (section[name] is string val) { PropName = new TypeName(val); } + /// + private static void AppendEnumBinding( + List body, + ParameterProvider sectionParam, + string propName, + ParameterProvider param) + { + var decl = new DeclarationExpression(typeof(string), param.Name.ToVariableName(), out var declVar); + var isPattern = new BinaryOperatorExpression("is", + new IndexerExpression(sectionParam, Literal(propName)), + decl); + var ifStatement = new IfStatement(isPattern); + ifStatement.Add(This.Property(propName).Assign(New.Instance(param.Type, declVar)).Terminate()); + body.Add(ifStatement); + } } } diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientSettingsProviderTests.cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientSettingsProviderTests.cs index 93ef5b91980..c87ebb5113a 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientSettingsProviderTests.cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientSettingsProviderTests.cs @@ -282,6 +282,142 @@ public void TestProperties_WithMultipleParamTypes() Assert.IsNotNull(properties.FirstOrDefault(p => p.Name == "Options"), "Settings should have Options property"); } + [Test] + public void TestBindCoreMethod_WithUriParam() + { + var inputParameters = new InputParameter[] + { + InputFactory.EndpointParameter( + "endpoint", + InputPrimitiveType.String, + defaultValue: InputFactory.Constant.String("https://default.endpoint.io"), + scope: InputParameterScope.Client, + isEndpoint: true), + InputFactory.MethodParameter( + "redirectUri", + InputPrimitiveType.Url, + isRequired: true, + scope: InputParameterScope.Client) + }; + var client = InputFactory.Client("TestClient", parameters: inputParameters); + var clientProvider = new ClientProvider(client); + var settingsProvider = clientProvider.ClientSettings; + + Assert.IsNotNull(settingsProvider); + + var bindCoreMethod = settingsProvider!.Methods.FirstOrDefault(m => m.Signature.Name == "BindCore"); + Assert.IsNotNull(bindCoreMethod); + + var bodyString = bindCoreMethod!.BodyStatements!.ToDisplayString(); + Assert.IsTrue(bodyString.Contains("Uri.TryCreate"), "BindCore should use Uri.TryCreate for Uri parameter binding"); + Assert.IsTrue(bodyString.Contains("UriKind.Absolute"), "BindCore should use UriKind.Absolute"); + Assert.IsTrue(bodyString.Contains("RedirectUri"), "BindCore should assign to RedirectUri property"); + } + + [Test] + public void TestBindCoreMethod_WithStringListParam() + { + var inputParameters = new InputParameter[] + { + InputFactory.EndpointParameter( + "endpoint", + InputPrimitiveType.String, + defaultValue: InputFactory.Constant.String("https://default.endpoint.io"), + scope: InputParameterScope.Client, + isEndpoint: true), + InputFactory.MethodParameter( + "allowedTenants", + InputFactory.Array(InputPrimitiveType.String), + isRequired: true, + scope: InputParameterScope.Client) + }; + var client = InputFactory.Client("TestClient", parameters: inputParameters); + var clientProvider = new ClientProvider(client); + var settingsProvider = clientProvider.ClientSettings; + + Assert.IsNotNull(settingsProvider); + + var bindCoreMethod = settingsProvider!.Methods.FirstOrDefault(m => m.Signature.Name == "BindCore"); + Assert.IsNotNull(bindCoreMethod); + + var bodyString = bindCoreMethod!.BodyStatements!.ToDisplayString(); + Assert.IsTrue(bodyString.Contains("GetSection"), "BindCore should use GetSection for list parameter binding"); + Assert.IsTrue(bodyString.Contains("GetChildren"), "BindCore should use GetChildren for list parameter binding"); + Assert.IsTrue(bodyString.Contains("Where"), "BindCore should use Where to filter null values"); + Assert.IsTrue(bodyString.Contains("Select"), "BindCore should use Select to extract values"); + Assert.IsTrue(bodyString.Contains("ToList"), "BindCore should use ToList to materialize the list"); + } + + [Test] + public void TestBindCoreMethod_WithEnumParam() + { + var enumType = InputFactory.StringEnum( + "AppAudience", + [("Public", "public"), ("Private", "private")], + isExtensible: true); + + MockHelpers.LoadMockGenerator(inputEnums: () => [enumType]); + + var inputParameters = new InputParameter[] + { + InputFactory.EndpointParameter( + "endpoint", + InputPrimitiveType.String, + defaultValue: InputFactory.Constant.String("https://default.endpoint.io"), + scope: InputParameterScope.Client, + isEndpoint: true), + InputFactory.MethodParameter( + "audience", + enumType, + isRequired: true, + scope: InputParameterScope.Client) + }; + var client = InputFactory.Client("TestClient", parameters: inputParameters); + var clientProvider = new ClientProvider(client); + var settingsProvider = clientProvider.ClientSettings; + + Assert.IsNotNull(settingsProvider); + + var bindCoreMethod = settingsProvider!.Methods.FirstOrDefault(m => m.Signature.Name == "BindCore"); + Assert.IsNotNull(bindCoreMethod); + + var bodyString = bindCoreMethod!.BodyStatements!.ToDisplayString(); + Assert.IsTrue(bodyString.Contains("is string"), "BindCore should use 'is string' pattern for enum parameter binding"); + Assert.IsTrue(bodyString.Contains("new"), "BindCore should create new enum instance"); + Assert.IsTrue(bodyString.Contains("Audience"), "BindCore should assign to Audience property"); + } + + [Test] + public void TestBindCoreMethod_WithTimeSpanParam() + { + var inputParameters = new InputParameter[] + { + InputFactory.EndpointParameter( + "endpoint", + InputPrimitiveType.String, + defaultValue: InputFactory.Constant.String("https://default.endpoint.io"), + scope: InputParameterScope.Client, + isEndpoint: true), + InputFactory.MethodParameter( + "networkTimeout", + InputPrimitiveType.PlainTime, + isRequired: true, + scope: InputParameterScope.Client) + }; + var client = InputFactory.Client("TestClient", parameters: inputParameters); + var clientProvider = new ClientProvider(client); + var settingsProvider = clientProvider.ClientSettings; + + Assert.IsNotNull(settingsProvider); + + var bindCoreMethod = settingsProvider!.Methods.FirstOrDefault(m => m.Signature.Name == "BindCore"); + Assert.IsNotNull(bindCoreMethod); + + var bodyString = bindCoreMethod!.BodyStatements!.ToDisplayString(); + Assert.IsTrue(bodyString.Contains("TimeSpan.TryParse"), "BindCore should use TimeSpan.TryParse for TimeSpan parameter binding"); + Assert.IsTrue(bodyString.Contains("NetworkTimeout"), "BindCore should assign to NetworkTimeout property"); + } + [Test] public void TestExperimentalAttribute() { From 45d1f82594129b7007bc9b8821610eb1e022fd78 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 12 Mar 2026 18:29:48 +0000 Subject: [PATCH 30/38] Fix comment to accurately reflect enum-only handling for non-framework types Co-authored-by: JoshLove-msft <54595583+JoshLove-msft@users.noreply.github.com> --- .../src/Providers/ClientSettingsProvider.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Providers/ClientSettingsProvider.cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Providers/ClientSettingsProvider.cs index 25bcbeea07a..ae141167897 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Providers/ClientSettingsProvider.cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Providers/ClientSettingsProvider.cs @@ -134,10 +134,10 @@ protected override MethodProvider[] BuildMethods() { var propName = param.Name.ToIdentifierName(); - // Handle non-framework types (custom struct/enum) + // Handle non-framework types (extensible enums) if (!param.Type.IsFrameworkType) { - // Custom struct/enum (extensible): if (section["Name"] is string val) { Name = new TypeName(val); } + // Extensible enum: if (section["Name"] is string val) { Name = new TypeName(val); } if (param.Type.IsEnum) { AppendEnumBinding(body, sectionParam, propName, param); From 51fbd669a65705ff8575567602f4f03fc7dd0dba Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 12 Mar 2026 19:50:59 +0000 Subject: [PATCH 31/38] fix: use Enum.TryParse for fixed enums in ClientSettingsProvider BindCore Co-authored-by: JoshLove-msft <54595583+JoshLove-msft@users.noreply.github.com> --- .../src/Providers/ClientSettingsProvider.cs | 34 ++++++++++++++-- .../Providers/ClientSettingsProviderTests.cs | 39 +++++++++++++++++++ 2 files changed, 70 insertions(+), 3 deletions(-) diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Providers/ClientSettingsProvider.cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Providers/ClientSettingsProvider.cs index ae141167897..df9a40dd4d2 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Providers/ClientSettingsProvider.cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Providers/ClientSettingsProvider.cs @@ -134,13 +134,21 @@ protected override MethodProvider[] BuildMethods() { var propName = param.Name.ToIdentifierName(); - // Handle non-framework types (extensible enums) + // Handle non-framework types (enums) if (!param.Type.IsFrameworkType) { - // Extensible enum: if (section["Name"] is string val) { Name = new TypeName(val); } if (param.Type.IsEnum) { - AppendEnumBinding(body, sectionParam, propName, param); + if (param.Type.IsStruct) + { + // Extensible enum (readonly struct): if (section["Name"] is string val) { Name = new TypeName(val); } + AppendEnumBinding(body, sectionParam, propName, param); + } + else + { + // Fixed enum: if (Enum.TryParse(section["Name"], out TypeName val)) { Name = val; } + AppendFixedEnumBinding(body, sectionParam, propName, param); + } } continue; } @@ -317,5 +325,25 @@ private static void AppendEnumBinding( ifStatement.Add(This.Property(propName).Assign(New.Instance(param.Type, declVar)).Terminate()); body.Add(ifStatement); } + + /// + /// Appends a fixed enum binding: if (Enum.TryParse(section[name], out TypeName val)) { PropName = val; } + /// + private static void AppendFixedEnumBinding( + List body, + ParameterProvider sectionParam, + string propName, + ParameterProvider param) + { + var outDecl = new DeclarationExpression(param.Type, param.Name.ToVariableName(), out var parsedVar, isOut: true); + var ifStatement = new IfStatement(Static(typeof(Enum)).Invoke("TryParse", + new ValueExpression[] + { + new IndexerExpression(sectionParam, Literal(propName)), + outDecl + })); + ifStatement.Add(This.Property(propName).Assign(parsedVar).Terminate()); + body.Add(ifStatement); + } } } diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientSettingsProviderTests.cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientSettingsProviderTests.cs index c87ebb5113a..ec2b56b4c00 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientSettingsProviderTests.cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientSettingsProviderTests.cs @@ -387,6 +387,45 @@ public void TestBindCoreMethod_WithEnumParam() Assert.IsTrue(bodyString.Contains("Audience"), "BindCore should assign to Audience property"); } + [Test] + public void TestBindCoreMethod_WithFixedEnumParam() + { + var enumType = InputFactory.StringEnum( + "ClientMode", + [("Default", "default"), ("MultiClient", "multi-client")], + isExtensible: false); + + MockHelpers.LoadMockGenerator(inputEnums: () => [enumType]); + + var inputParameters = new InputParameter[] + { + InputFactory.EndpointParameter( + "endpoint", + InputPrimitiveType.String, + defaultValue: InputFactory.Constant.String("https://default.endpoint.io"), + scope: InputParameterScope.Client, + isEndpoint: true), + InputFactory.MethodParameter( + "mode", + enumType, + isRequired: true, + scope: InputParameterScope.Client) + }; + var client = InputFactory.Client("TestClient", parameters: inputParameters); + var clientProvider = new ClientProvider(client); + var settingsProvider = clientProvider.ClientSettings; + + Assert.IsNotNull(settingsProvider); + + var bindCoreMethod = settingsProvider!.Methods.FirstOrDefault(m => m.Signature.Name == "BindCore"); + Assert.IsNotNull(bindCoreMethod); + + var bodyString = bindCoreMethod!.BodyStatements!.ToDisplayString(); + Assert.IsTrue(bodyString.Contains("Enum.TryParse"), "BindCore should use Enum.TryParse for fixed enum parameter binding"); + Assert.IsTrue(bodyString.Contains("Mode"), "BindCore should assign to Mode property"); + Assert.IsFalse(bodyString.Contains("new ClientMode"), "BindCore should NOT use new for fixed enum binding"); + } + [Test] public void TestBindCoreMethod_WithTimeSpanParam() { From 60a3de0cbad5b18b3147bd24d08a165aeee81d8b Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 12 Mar 2026 20:32:40 +0000 Subject: [PATCH 32/38] Add complex object binding handler and test for ClientSettingsProvider Co-authored-by: JoshLove-msft <54595583+JoshLove-msft@users.noreply.github.com> --- .../src/Providers/ClientSettingsProvider.cs | 25 +++++++++++ .../Providers/ClientSettingsProviderTests.cs | 43 +++++++++++++++++++ 2 files changed, 68 insertions(+) diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Providers/ClientSettingsProvider.cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Providers/ClientSettingsProvider.cs index df9a40dd4d2..826ae701c2e 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Providers/ClientSettingsProvider.cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Providers/ClientSettingsProvider.cs @@ -150,6 +150,11 @@ protected override MethodProvider[] BuildMethods() AppendFixedEnumBinding(body, sectionParam, propName, param); } } + else + { + // Complex object: section.GetSection(name) + .Exists() + new Type(section) + AppendComplexObjectBinding(body, sectionParam, propName, param); + } continue; } @@ -345,5 +350,25 @@ private static void AppendFixedEnumBinding( ifStatement.Add(This.Property(propName).Assign(parsedVar).Terminate()); body.Add(ifStatement); } + + /// + /// Appends a complex object binding: IConfigurationSection s = section.GetSection(name); + /// if (s.Exists()) { PropName = new TypeName(s); } + /// + private static void AppendComplexObjectBinding( + List body, + ParameterProvider sectionParam, + string propName, + ParameterProvider param) + { + // IConfigurationSection {name}Section = section.GetSection("PropName"); + var sectionVar = new VariableExpression(IConfigurationSectionType, param.Name.ToVariableName() + "Section"); + body.Add(Declare(sectionVar, sectionParam.Invoke("GetSection", Literal(propName)))); + + // if ({name}Section.Exists()) { PropName = new TypeName({name}Section); } + var ifExistsStatement = new IfStatement(sectionVar.Invoke("Exists")); + ifExistsStatement.Add(This.Property(propName).Assign(New.Instance(param.Type, sectionVar)).Terminate()); + body.Add(ifExistsStatement); + } } } diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientSettingsProviderTests.cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientSettingsProviderTests.cs index ec2b56b4c00..3abb18b6cf7 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientSettingsProviderTests.cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientSettingsProviderTests.cs @@ -457,6 +457,49 @@ public void TestBindCoreMethod_WithTimeSpanParam() Assert.IsTrue(bodyString.Contains("NetworkTimeout"), "BindCore should assign to NetworkTimeout property"); } + [Test] + public void TestBindCoreMethod_WithComplexObjectParam() + { + var complexModel = InputFactory.Model( + "CustomOptions", + properties: new[] + { + InputFactory.Property("setting1", InputPrimitiveType.String, isRequired: true, wireName: "setting1"), + InputFactory.Property("setting2", InputPrimitiveType.Int32, isRequired: false, wireName: "setting2") + }); + + MockHelpers.LoadMockGenerator(inputModels: () => [complexModel]); + + var inputParameters = new InputParameter[] + { + InputFactory.EndpointParameter( + "endpoint", + InputPrimitiveType.String, + defaultValue: InputFactory.Constant.String("https://default.endpoint.io"), + scope: InputParameterScope.Client, + isEndpoint: true), + InputFactory.MethodParameter( + "customOptions", + complexModel, + isRequired: true, + scope: InputParameterScope.Client) + }; + var client = InputFactory.Client("TestClient", parameters: inputParameters); + var clientProvider = new ClientProvider(client); + var settingsProvider = clientProvider.ClientSettings; + + Assert.IsNotNull(settingsProvider); + + var bindCoreMethod = settingsProvider!.Methods.FirstOrDefault(m => m.Signature.Name == "BindCore"); + Assert.IsNotNull(bindCoreMethod); + + var bodyString = bindCoreMethod!.BodyStatements!.ToDisplayString(); + Assert.IsTrue(bodyString.Contains("GetSection"), "BindCore should use GetSection for complex object binding"); + Assert.IsTrue(bodyString.Contains("Exists"), "BindCore should check Exists for complex object binding"); + Assert.IsTrue(bodyString.Contains("new"), "BindCore should create new instance for complex object binding"); + Assert.IsTrue(bodyString.Contains("CustomOptions"), "BindCore should reference the CustomOptions type"); + } + [Test] public void TestExperimentalAttribute() { From 18bcfd136455778b33214819db246d59acc0b810 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 12 Mar 2026 20:36:57 +0000 Subject: [PATCH 33/38] Improve complex object test assertion specificity Co-authored-by: JoshLove-msft <54595583+JoshLove-msft@users.noreply.github.com> --- .../test/Providers/ClientSettingsProviderTests.cs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientSettingsProviderTests.cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientSettingsProviderTests.cs index 3abb18b6cf7..b7c54ba807a 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientSettingsProviderTests.cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientSettingsProviderTests.cs @@ -496,8 +496,7 @@ public void TestBindCoreMethod_WithComplexObjectParam() var bodyString = bindCoreMethod!.BodyStatements!.ToDisplayString(); Assert.IsTrue(bodyString.Contains("GetSection"), "BindCore should use GetSection for complex object binding"); Assert.IsTrue(bodyString.Contains("Exists"), "BindCore should check Exists for complex object binding"); - Assert.IsTrue(bodyString.Contains("new"), "BindCore should create new instance for complex object binding"); - Assert.IsTrue(bodyString.Contains("CustomOptions"), "BindCore should reference the CustomOptions type"); + Assert.IsTrue(bodyString.Contains("CustomOptions") && bodyString.Contains("new"), "BindCore should create new CustomOptions instance for complex object binding"); } [Test] From ca2320b11e46b09df9cf34f57af0b9328e38721b Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 12 Mar 2026 21:06:29 +0000 Subject: [PATCH 34/38] Add type-aware binding for ClientOptions IConfigurationSection constructor Refactored binding helper methods in ClientSettingsProvider to be internal static and reusable. ClientOptionsProvider now uses AppendBindingForProperty for type-aware binding of all property types (string, bool, int, TimeSpan, Uri, List, extensible/fixed enums, complex objects) instead of treating all properties as strings. Added tests for bool, int, string, extensible enum, fixed enum, and complex object property bindings in ClientOptionsProviderTests. Co-authored-by: JoshLove-msft <54595583+JoshLove-msft@users.noreply.github.com> --- .../src/Providers/BinaryContentProvider.cs | 4 +- .../src/Providers/ClientOptionsProvider.cs | 16 +- .../src/Providers/ClientResultProvider.cs | 6 +- .../src/Providers/ClientSettingsProvider.cs | 214 ++++++++--------- .../Providers/CollectionResultDefinition.cs | 2 +- .../PipelineMessageClassifierProvider.cs | 6 +- .../src/Providers/PipelineRequestProvider.cs | 2 +- .../src/Providers/ScmMethodProvider.cs | 2 +- .../Providers/ScmMethodProviderCollection.cs | 14 +- .../SerializationFormatDefinition.cs | 2 +- .../src/Snippets/JsonElementSnippets.cs | 2 +- .../Sample_TypeSpec/TreeXmlTests.cs | 4 +- .../Abstractions/RequestContentApiTests.cs | 2 +- .../Providers/ClientOptionsProviderTests.cs | 218 +++++++++++++++++- .../CollectionResultDefinitionTests.cs | 8 +- .../ListPageableTests.cs | 4 +- .../BinaryContentHelperDefinitionTests.cs | 2 +- ...artFormDataBinaryContentDefinitionTests.cs | 4 +- ...RequestHeadersExtensionsDefinitionTests.cs | 2 +- .../EnumProviderSerializationTests.cs | 6 +- .../DiscriminatorTests.cs | 2 +- .../DynamicModelSerializationTests.cs | 12 +- .../ModelCustomizationTests.cs | 4 +- .../MrwSerializationTypeDefinitionTests.cs | 64 ++--- .../RestClientProviderTests.cs | 8 +- .../ScmModelProvider/ScmModelProviderTests.cs | 2 +- .../test/TestHelpers/TestRequestContentApi.cs | 2 +- 27 files changed, 412 insertions(+), 202 deletions(-) diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Providers/BinaryContentProvider.cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Providers/BinaryContentProvider.cs index d7e452714fd..6b0d2fbcfcf 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Providers/BinaryContentProvider.cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Providers/BinaryContentProvider.cs @@ -3,10 +3,10 @@ using System.ClientModel; using Microsoft.TypeSpec.Generator.ClientModel.Snippets; -using static Microsoft.TypeSpec.Generator.Snippets.Snippet; using Microsoft.TypeSpec.Generator.Expressions; -using Microsoft.TypeSpec.Generator.Statements; using Microsoft.TypeSpec.Generator.Primitives; +using Microsoft.TypeSpec.Generator.Statements; +using static Microsoft.TypeSpec.Generator.Snippets.Snippet; namespace Microsoft.TypeSpec.Generator.ClientModel.Providers { diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Providers/ClientOptionsProvider.cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Providers/ClientOptionsProvider.cs index a60fa8d273b..3f2a1aed342 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Providers/ClientOptionsProvider.cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Providers/ClientOptionsProvider.cs @@ -341,7 +341,7 @@ private ConstructorProvider BuildConfigurationSectionConstructor() // Build a set of version property names for O(1) lookup var versionPropertyNames = VersionProperties?.Values.Select(vp => vp.Name).ToHashSet(); - // Bind non-version properties from configuration + // Bind non-version properties from configuration using type-aware binding foreach (var property in Properties) { if (versionPropertyNames?.Contains(property.Name) == true) @@ -349,14 +349,12 @@ private ConstructorProvider BuildConfigurationSectionConstructor() continue; } - // string? propValue = section["PropertyName"]; - var propValueVar = new VariableExpression(new CSharpType(typeof(string), isNullable: true), $"{property.Name.ToVariableName()}FromConfig"); - body.Add(Declare(propValueVar, new IndexerExpression(sectionParam, Literal(property.Name)))); - - // if (!string.IsNullOrEmpty(propValue)) { Property = propValue; } - var ifProp = new IfStatement(Not(StringSnippets.IsNullOrEmpty(propValueVar.As()))); - ifProp.Add(This.Property(property.Name).Assign(propValueVar).Terminate()); - body.Add(ifProp); + ClientSettingsProvider.AppendBindingForProperty( + body, + sectionParam, + property.Name, + property.Name.ToVariableName(), + property.Type); } return new ConstructorProvider( diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Providers/ClientResultProvider.cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Providers/ClientResultProvider.cs index 50c312cc161..ab246abdb3d 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Providers/ClientResultProvider.cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Providers/ClientResultProvider.cs @@ -1,14 +1,14 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -using System.ClientModel.Primitives; using System.ClientModel; +using System.ClientModel.Primitives; using Microsoft.TypeSpec.Generator.Expressions; using Microsoft.TypeSpec.Generator.Input; -using Microsoft.TypeSpec.Generator.Snippets; -using static Microsoft.TypeSpec.Generator.Snippets.Snippet; using Microsoft.TypeSpec.Generator.Primitives; using Microsoft.TypeSpec.Generator.Providers; +using Microsoft.TypeSpec.Generator.Snippets; +using static Microsoft.TypeSpec.Generator.Snippets.Snippet; namespace Microsoft.TypeSpec.Generator.ClientModel.Providers { diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Providers/ClientSettingsProvider.cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Providers/ClientSettingsProvider.cs index 826ae701c2e..0a6ed1fd3c0 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Providers/ClientSettingsProvider.cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Providers/ClientSettingsProvider.cs @@ -117,98 +117,18 @@ protected override MethodProvider[] BuildMethods() if (EndpointPropertyName != null) { - // if (Uri.TryCreate(section["EndpointPropertyName"], UriKind.Absolute, out Uri varName)) { EndpointProperty = varName; } - var outUriDecl = new DeclarationExpression(typeof(Uri), EndpointPropertyName.ToVariableName(), out var uriVar, isOut: true); - var ifStatement = new IfStatement(Static(typeof(Uri)).Invoke("TryCreate", - new ValueExpression[] - { - new IndexerExpression(sectionParam, Literal(EndpointPropertyName)), - new MemberExpression(typeof(UriKind), nameof(UriKind.Absolute)), - outUriDecl - })); - ifStatement.Add(This.Property(EndpointPropertyName).Assign(uriVar).Terminate()); - body.Add(ifStatement); + AppendUriTryCreateBinding(body, sectionParam, EndpointPropertyName, EndpointPropertyName.ToVariableName()); } foreach (var param in OtherRequiredParams) { var propName = param.Name.ToIdentifierName(); - - // Handle non-framework types (enums) - if (!param.Type.IsFrameworkType) - { - if (param.Type.IsEnum) - { - if (param.Type.IsStruct) - { - // Extensible enum (readonly struct): if (section["Name"] is string val) { Name = new TypeName(val); } - AppendEnumBinding(body, sectionParam, propName, param); - } - else - { - // Fixed enum: if (Enum.TryParse(section["Name"], out TypeName val)) { Name = val; } - AppendFixedEnumBinding(body, sectionParam, propName, param); - } - } - else - { - // Complex object: section.GetSection(name) + .Exists() + new Type(section) - AppendComplexObjectBinding(body, sectionParam, propName, param); - } - continue; - } - - // Handle collection types (string[]/List) - if (param.Type.IsList) - { - AppendStringListBinding(body, sectionParam, propName, param); - continue; - } - - var frameworkType = param.Type.FrameworkType; - - // For string types: if (!string.IsNullOrEmpty(val)) PropName = val; - if (frameworkType == typeof(string)) - { - var valVar = new VariableExpression(new CSharpType(typeof(string), isNullable: true), param.Name.ToVariableName()); - body.Add(Declare(valVar, new IndexerExpression(sectionParam, Literal(propName)))); - var ifStatement = new IfStatement(Not(StringSnippets.IsNullOrEmpty(valVar.As()))); - ifStatement.Add(This.Property(propName).Assign(valVar).Terminate()); - body.Add(ifStatement); - } - // For bool: if (bool.TryParse(section[name], out bool val)) PropName = val; - else if (frameworkType == typeof(bool)) - { - AppendTryParseBinding(body, sectionParam, propName, param, typeof(bool)); - } - // For int: if (int.TryParse(section[name], out int val)) PropName = val; - else if (frameworkType == typeof(int)) - { - AppendTryParseBinding(body, sectionParam, propName, param, typeof(int)); - } - // For TimeSpan: if (TimeSpan.TryParse(section[name], out TimeSpan val)) PropName = val; - else if (frameworkType == typeof(TimeSpan)) - { - AppendTryParseBinding(body, sectionParam, propName, param, typeof(TimeSpan)); - } - // For Uri: if (Uri.TryCreate(section[name], UriKind.Absolute, out Uri val)) PropName = val; - else if (frameworkType == typeof(Uri)) - { - AppendUriTryCreateBinding(body, sectionParam, propName, param); - } + AppendBindingForProperty(body, sectionParam, propName, param.Name.ToVariableName(), param.Type); } if (_clientProvider.ClientOptions != null) { - // IConfigurationSection optionsSection = section.GetSection("Options"); - var optionsSectionVar = new VariableExpression(IConfigurationSectionType, "optionsSection"); - body.Add(Declare(optionsSectionVar, sectionParam.Invoke("GetSection", Literal("Options")))); - - // if (optionsSection.Exists()) { Options = new ClientOptions(optionsSection); } - var ifOptionsStatement = new IfStatement(optionsSectionVar.Invoke("Exists")); - ifOptionsStatement.Add(This.Property("Options").Assign( - New.Instance(_clientProvider.ClientOptions.Type, optionsSectionVar)).Terminate()); - body.Add(ifOptionsStatement); + AppendComplexObjectBinding(body, sectionParam, "Options", "options", _clientProvider.ClientOptions.Type); } var bindCoreMethod = new MethodProvider( @@ -225,17 +145,95 @@ protected override MethodProvider[] BuildMethods() return [bindCoreMethod]; } + /// + /// Dispatches to the appropriate binding method based on the property type. + /// + internal static void AppendBindingForProperty( + List body, + ParameterProvider sectionParam, + string propName, + string varName, + CSharpType type) + { + // Handle non-framework types (enums, complex objects) + if (!type.IsFrameworkType) + { + if (type.IsEnum) + { + if (type.IsStruct) + { + AppendEnumBinding(body, sectionParam, propName, varName, type); + } + else + { + AppendFixedEnumBinding(body, sectionParam, propName, varName, type); + } + } + else + { + AppendComplexObjectBinding(body, sectionParam, propName, varName, type); + } + return; + } + + // Handle collection types (string[]/List) + if (type.IsList) + { + AppendStringListBinding(body, sectionParam, propName, varName, type); + return; + } + + var frameworkType = type.FrameworkType; + + if (frameworkType == typeof(string)) + { + AppendStringBinding(body, sectionParam, propName, varName); + } + else if (frameworkType == typeof(bool)) + { + AppendTryParseBinding(body, sectionParam, propName, varName, typeof(bool)); + } + else if (frameworkType == typeof(int)) + { + AppendTryParseBinding(body, sectionParam, propName, varName, typeof(int)); + } + else if (frameworkType == typeof(TimeSpan)) + { + AppendTryParseBinding(body, sectionParam, propName, varName, typeof(TimeSpan)); + } + else if (frameworkType == typeof(Uri)) + { + AppendUriTryCreateBinding(body, sectionParam, propName, varName); + } + } + + /// + /// Appends a string binding: string? val = section[name]; if (!string.IsNullOrEmpty(val)) PropName = val; + /// + internal static void AppendStringBinding( + List body, + ParameterProvider sectionParam, + string propName, + string varName) + { + var valVar = new VariableExpression(new CSharpType(typeof(string), isNullable: true), varName); + body.Add(Declare(valVar, new IndexerExpression(sectionParam, Literal(propName)))); + var ifStatement = new IfStatement(Not(StringSnippets.IsNullOrEmpty(valVar.As()))); + ifStatement.Add(This.Property(propName).Assign(valVar).Terminate()); + body.Add(ifStatement); + } + /// /// Appends a TryParse-based binding statement: if (Type.TryParse(section[name], out Type val)) PropName = val; /// - private static void AppendTryParseBinding( + internal static void AppendTryParseBinding( List body, ParameterProvider sectionParam, string propName, - ParameterProvider param, + string varName, Type parseType) { - var outDecl = new DeclarationExpression(parseType, param.Name.ToVariableName(), out var parsedVar, isOut: true); + var outDecl = new DeclarationExpression(parseType, varName, out var parsedVar, isOut: true); var ifStatement = new IfStatement(Static(parseType).Invoke("TryParse", new ValueExpression[] { @@ -249,13 +247,13 @@ private static void AppendTryParseBinding( /// /// Appends a Uri.TryCreate binding: if (Uri.TryCreate(section[name], UriKind.Absolute, out Uri val)) PropName = val; /// - private static void AppendUriTryCreateBinding( + internal static void AppendUriTryCreateBinding( List body, ParameterProvider sectionParam, string propName, - ParameterProvider param) + string varName) { - var outUriDecl = new DeclarationExpression(typeof(Uri), param.Name.ToVariableName(), out var uriVar, isOut: true); + var outUriDecl = new DeclarationExpression(typeof(Uri), varName, out var uriVar, isOut: true); var ifStatement = new IfStatement(Static(typeof(Uri)).Invoke("TryCreate", new ValueExpression[] { @@ -271,22 +269,23 @@ private static void AppendUriTryCreateBinding( /// Appends a string list binding: IConfigurationSection s = section.GetSection(name); /// if (s.Exists()) { PropName = s.GetChildren().Where(c => c.Value is not null).Select(c => c.Value!).ToList(); } /// - private static void AppendStringListBinding( + internal static void AppendStringListBinding( List body, ParameterProvider sectionParam, string propName, - ParameterProvider param) + string varName, + CSharpType type) { // Only handle List for now - if (param.Type.Arguments.Count == 0 || - !param.Type.Arguments[0].IsFrameworkType || - param.Type.Arguments[0].FrameworkType != typeof(string)) + if (type.Arguments.Count == 0 || + !type.Arguments[0].IsFrameworkType || + type.Arguments[0].FrameworkType != typeof(string)) { return; } // IConfigurationSection listSection = section.GetSection("PropName"); - var sectionVar = new VariableExpression(IConfigurationSectionType, param.Name.ToVariableName() + "Section"); + var sectionVar = new VariableExpression(IConfigurationSectionType, varName + "Section"); body.Add(Declare(sectionVar, sectionParam.Invoke("GetSection", Literal(propName)))); // if (listSection.Exists()) @@ -316,31 +315,33 @@ private static void AppendStringListBinding( /// /// Appends an extensible enum binding: if (section[name] is string val) { PropName = new TypeName(val); } /// - private static void AppendEnumBinding( + internal static void AppendEnumBinding( List body, ParameterProvider sectionParam, string propName, - ParameterProvider param) + string varName, + CSharpType type) { - var decl = new DeclarationExpression(typeof(string), param.Name.ToVariableName(), out var declVar); + var decl = new DeclarationExpression(typeof(string), varName, out var declVar); var isPattern = new BinaryOperatorExpression("is", new IndexerExpression(sectionParam, Literal(propName)), decl); var ifStatement = new IfStatement(isPattern); - ifStatement.Add(This.Property(propName).Assign(New.Instance(param.Type, declVar)).Terminate()); + ifStatement.Add(This.Property(propName).Assign(New.Instance(type, declVar)).Terminate()); body.Add(ifStatement); } /// /// Appends a fixed enum binding: if (Enum.TryParse(section[name], out TypeName val)) { PropName = val; } /// - private static void AppendFixedEnumBinding( + internal static void AppendFixedEnumBinding( List body, ParameterProvider sectionParam, string propName, - ParameterProvider param) + string varName, + CSharpType type) { - var outDecl = new DeclarationExpression(param.Type, param.Name.ToVariableName(), out var parsedVar, isOut: true); + var outDecl = new DeclarationExpression(type, varName, out var parsedVar, isOut: true); var ifStatement = new IfStatement(Static(typeof(Enum)).Invoke("TryParse", new ValueExpression[] { @@ -355,19 +356,20 @@ private static void AppendFixedEnumBinding( /// Appends a complex object binding: IConfigurationSection s = section.GetSection(name); /// if (s.Exists()) { PropName = new TypeName(s); } /// - private static void AppendComplexObjectBinding( + internal static void AppendComplexObjectBinding( List body, ParameterProvider sectionParam, string propName, - ParameterProvider param) + string varName, + CSharpType type) { // IConfigurationSection {name}Section = section.GetSection("PropName"); - var sectionVar = new VariableExpression(IConfigurationSectionType, param.Name.ToVariableName() + "Section"); + var sectionVar = new VariableExpression(IConfigurationSectionType, varName + "Section"); body.Add(Declare(sectionVar, sectionParam.Invoke("GetSection", Literal(propName)))); // if ({name}Section.Exists()) { PropName = new TypeName({name}Section); } var ifExistsStatement = new IfStatement(sectionVar.Invoke("Exists")); - ifExistsStatement.Add(This.Property(propName).Assign(New.Instance(param.Type, sectionVar)).Terminate()); + ifExistsStatement.Add(This.Property(propName).Assign(New.Instance(type, sectionVar)).Terminate()); body.Add(ifExistsStatement); } } diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Providers/CollectionResultDefinition.cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Providers/CollectionResultDefinition.cs index d704c3eec74..b85fc44c6a9 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Providers/CollectionResultDefinition.cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Providers/CollectionResultDefinition.cs @@ -531,7 +531,7 @@ private ScopedApi InvokeCreateRequestForNextLink(ValueExpressio Client.RestClient.GetCreateNextLinkRequestMethod(Operation).Signature.Name; return ClientField.Invoke( createNextLinkRequestMethodName, - [nextPageUri, ..RequestFields]) + [nextPageUri, .. RequestFields]) .As(); } diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Providers/PipelineMessageClassifierProvider.cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Providers/PipelineMessageClassifierProvider.cs index 9e42f218ff4..32b550c2384 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Providers/PipelineMessageClassifierProvider.cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Providers/PipelineMessageClassifierProvider.cs @@ -1,12 +1,12 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -using Microsoft.TypeSpec.Generator.Expressions; -using static Microsoft.TypeSpec.Generator.Snippets.Snippet; using System.ClientModel.Primitives; -using Microsoft.TypeSpec.Generator.Primitives; using System.Collections.Generic; using System.Linq; +using Microsoft.TypeSpec.Generator.Expressions; +using Microsoft.TypeSpec.Generator.Primitives; +using static Microsoft.TypeSpec.Generator.Snippets.Snippet; namespace Microsoft.TypeSpec.Generator.ClientModel.Providers { diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Providers/PipelineRequestProvider.cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Providers/PipelineRequestProvider.cs index e3d0819ba31..63c100116e0 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Providers/PipelineRequestProvider.cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Providers/PipelineRequestProvider.cs @@ -1,11 +1,11 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. +using System; using System.ClientModel.Primitives; using System.Collections.Generic; using Microsoft.TypeSpec.Generator.Expressions; using Microsoft.TypeSpec.Generator.Statements; -using System; namespace Microsoft.TypeSpec.Generator.ClientModel.Providers { diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Providers/ScmMethodProvider.cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Providers/ScmMethodProvider.cs index fc4847b10e6..9bc034f8378 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Providers/ScmMethodProvider.cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Providers/ScmMethodProvider.cs @@ -1,11 +1,11 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. +using Microsoft.TypeSpec.Generator.ClientModel.Primitives; using Microsoft.TypeSpec.Generator.Input; using Microsoft.TypeSpec.Generator.Primitives; using Microsoft.TypeSpec.Generator.Providers; using Microsoft.TypeSpec.Generator.Statements; -using Microsoft.TypeSpec.Generator.ClientModel.Primitives; namespace Microsoft.TypeSpec.Generator.ClientModel.Providers { diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Providers/ScmMethodProviderCollection.cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Providers/ScmMethodProviderCollection.cs index 6879f6c7b7f..9b8fb7433dc 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Providers/ScmMethodProviderCollection.cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Providers/ScmMethodProviderCollection.cs @@ -698,13 +698,13 @@ private IReadOnlyList GetProtocolMethodArguments(Dictionary 1 } && nonBodyProperties?.ContainsKey(protocolParam.Name) != true) { // The MethodParameterSegments represents a path (e.g., ['Params', 'foo'] means params.foo) - var rootParameterName = protocolParam.InputParameter.MethodParameterSegments[0].Name; - if (!convenienceParamsMap.TryGetValue(rootParameterName, out var convenienceParam) || - // Body parameters are handled separately - convenienceParam.Location == ParameterLocation.Body) - { - continue; - } + var rootParameterName = protocolParam.InputParameter.MethodParameterSegments[0].Name; + if (!convenienceParamsMap.TryGetValue(rootParameterName, out var convenienceParam) || + // Body parameters are handled separately + convenienceParam.Location == ParameterLocation.Body) + { + continue; + } // Navigate through the property path var propertySegments = protocolParam.InputParameter.MethodParameterSegments diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Providers/SerializationFormatDefinition.cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Providers/SerializationFormatDefinition.cs index 79e0987acf6..13233bee220 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Providers/SerializationFormatDefinition.cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Providers/SerializationFormatDefinition.cs @@ -73,7 +73,7 @@ protected override IReadOnlyList BuildEnumValues() var members = new EnumTypeMember[enumValues.Count]; for (int i = 0; i < enumValues.Count; i++) { - var (name, value, description ) = enumValues[i]; + var (name, value, description) = enumValues[i]; var field = new FieldProvider( FieldModifiers.Public | FieldModifiers.Static, EnumUnderlyingType, diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Snippets/JsonElementSnippets.cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Snippets/JsonElementSnippets.cs index f9951bc523d..f320ef94429 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Snippets/JsonElementSnippets.cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Snippets/JsonElementSnippets.cs @@ -105,7 +105,7 @@ public static ScopedApi TryGetInt64(this ScopedApi jsonElemen public static ScopedApi TryGetSingle(this ScopedApi jsonElement, out ScopedApi floatValue) { var floatValueDeclaration = new VariableExpression(typeof(float), "floatValue"); - floatValue= floatValueDeclaration.As(); + floatValue = floatValueDeclaration.As(); var invocation = new InvokeMethodExpression(jsonElement, nameof(JsonElement.TryGetSingle), [new DeclarationExpression(floatValueDeclaration, true)]); return invocation.As(); } diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/ModelReaderWriterValidation/TestProjects/Sample_TypeSpec/TreeXmlTests.cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/ModelReaderWriterValidation/TestProjects/Sample_TypeSpec/TreeXmlTests.cs index 34024d47cc2..d9ac35840d3 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/ModelReaderWriterValidation/TestProjects/Sample_TypeSpec/TreeXmlTests.cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/ModelReaderWriterValidation/TestProjects/Sample_TypeSpec/TreeXmlTests.cs @@ -89,8 +89,8 @@ public void ToBinaryContent_WithJsonFormat_ProducesJsonPayload() var binaryContent = (BinaryContent)method!.Invoke(tree, new object[] { "J" })!; // Verify the MediaType is set correctly for JSON - Assert.That(binaryContent.MediaType, - Is.EqualTo("application/json"), + Assert.That(binaryContent.MediaType, + Is.EqualTo("application/json"), "MediaType should be application/json for format 'J'"); } diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/Abstractions/RequestContentApiTests.cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/Abstractions/RequestContentApiTests.cs index 49dd83bbb03..c0cf268aa1a 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/Abstractions/RequestContentApiTests.cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/Abstractions/RequestContentApiTests.cs @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. +// Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. using System.ClientModel; diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientOptionsProviderTests.cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientOptionsProviderTests.cs index ffc5670c4da..2fe18535d4e 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientOptionsProviderTests.cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientOptionsProviderTests.cs @@ -376,7 +376,7 @@ await MockHelpers.LoadMockGeneratorAsync( var body = constructor?.BodyStatements?.ToDisplayString(); Assert.IsNotNull(body); - + // Verify the switch statement contains custom enum members with their correct string values Assert.IsTrue(body?.Contains("ServiceVersion.V2023_10_01_Preview_1 => \"2023-10-01-preview-1\"")); Assert.IsTrue(body?.Contains("ServiceVersion.V2023_11_01 => \"2023-11-01\"")); @@ -414,17 +414,17 @@ public void SingletonCreatedForMultipleClientsWithStandardParameters() public void SingleClientCreatesClientSpecificOptions() { var client = InputFactory.Client("TestClient", clientNamespace: "TestNamespace"); - + MockHelpers.LoadMockGenerator(clients: () => [client]); var clientProvider = ScmCodeModelGenerator.Instance.TypeFactory.CreateClient(client); Assert.IsNotNull(clientProvider); - + var options = clientProvider!.ClientOptions; Assert.IsNotNull(options); - + // The name should be based on the client name Assert.AreEqual("TestClientOptions", options!.Name); } @@ -712,5 +712,215 @@ public void MultiServiceCombinedClient_WithThreeServices_GeneratesExpectedClient Assert.AreEqual(Helpers.GetExpectedFromFile(), file.Content); } + + [Test] + public void TestConfigurationSectionConstructorBody_WithBoolProperty() + { + var boolParam = InputFactory.MethodParameter( + "enableRetry", + InputPrimitiveType.Boolean, + isRequired: false, + defaultValue: new InputConstant(true, InputPrimitiveType.Boolean), + scope: InputParameterScope.Client); + + var client = InputFactory.Client("TestClient", parameters: [boolParam]); + + MockHelpers.LoadMockGenerator(clients: () => [client]); + + var clientProvider = ScmCodeModelGenerator.Instance.TypeFactory.CreateClient(client); + var clientOptionsProvider = clientProvider!.ClientOptions; + + Assert.IsNotNull(clientOptionsProvider); + + var configSectionCtor = clientOptionsProvider!.Constructors + .FirstOrDefault(c => c.Signature.Parameters.Any(p => p.Name == "section")); + Assert.IsNotNull(configSectionCtor); + + var bodyString = configSectionCtor!.BodyStatements!.ToDisplayString(); + Assert.IsTrue(bodyString.Contains("bool.TryParse"), + "IConfigurationSection constructor should use bool.TryParse for bool property binding"); + Assert.IsTrue(bodyString.Contains("EnableRetry"), + "IConfigurationSection constructor should assign to EnableRetry property"); + } + + [Test] + public void TestConfigurationSectionConstructorBody_WithIntProperty() + { + var intParam = InputFactory.MethodParameter( + "maxRetries", + InputPrimitiveType.Int32, + isRequired: false, + defaultValue: new InputConstant(3, InputPrimitiveType.Int32), + scope: InputParameterScope.Client); + + var client = InputFactory.Client("TestClient", parameters: [intParam]); + + MockHelpers.LoadMockGenerator(clients: () => [client]); + + var clientProvider = ScmCodeModelGenerator.Instance.TypeFactory.CreateClient(client); + var clientOptionsProvider = clientProvider!.ClientOptions; + + Assert.IsNotNull(clientOptionsProvider); + + var configSectionCtor = clientOptionsProvider!.Constructors + .FirstOrDefault(c => c.Signature.Parameters.Any(p => p.Name == "section")); + Assert.IsNotNull(configSectionCtor); + + var bodyString = configSectionCtor!.BodyStatements!.ToDisplayString(); + Assert.IsTrue(bodyString.Contains("int.TryParse"), + "IConfigurationSection constructor should use int.TryParse for int property binding"); + Assert.IsTrue(bodyString.Contains("MaxRetries"), + "IConfigurationSection constructor should assign to MaxRetries property"); + } + + [Test] + public void TestConfigurationSectionConstructorBody_WithEnumProperty() + { + var enumType = InputFactory.StringEnum( + "AppAudience", + [("Public", "public"), ("Private", "private")], + isExtensible: true); + + var enumParam = InputFactory.MethodParameter( + "audience", + enumType, + isRequired: false, + defaultValue: new InputConstant("public", enumType), + scope: InputParameterScope.Client); + + var client = InputFactory.Client("TestClient", parameters: [enumParam]); + + MockHelpers.LoadMockGenerator( + clients: () => [client], + inputEnums: () => [enumType]); + + var clientProvider = ScmCodeModelGenerator.Instance.TypeFactory.CreateClient(client); + var clientOptionsProvider = clientProvider!.ClientOptions; + + Assert.IsNotNull(clientOptionsProvider); + + var configSectionCtor = clientOptionsProvider!.Constructors + .FirstOrDefault(c => c.Signature.Parameters.Any(p => p.Name == "section")); + Assert.IsNotNull(configSectionCtor); + + var bodyString = configSectionCtor!.BodyStatements!.ToDisplayString(); + Assert.IsTrue(bodyString.Contains("is string"), + "IConfigurationSection constructor should use 'is string' pattern for extensible enum property binding"); + Assert.IsTrue(bodyString.Contains("new"), + "IConfigurationSection constructor should create new enum instance"); + Assert.IsTrue(bodyString.Contains("Audience"), + "IConfigurationSection constructor should assign to Audience property"); + } + + [Test] + public void TestConfigurationSectionConstructorBody_WithStringProperty() + { + var stringParam = InputFactory.MethodParameter( + "tenantId", + InputPrimitiveType.String, + isRequired: false, + defaultValue: InputFactory.Constant.String("default"), + scope: InputParameterScope.Client); + + var client = InputFactory.Client("TestClient", parameters: [stringParam]); + + MockHelpers.LoadMockGenerator(clients: () => [client]); + + var clientProvider = ScmCodeModelGenerator.Instance.TypeFactory.CreateClient(client); + var clientOptionsProvider = clientProvider!.ClientOptions; + + Assert.IsNotNull(clientOptionsProvider); + + var configSectionCtor = clientOptionsProvider!.Constructors + .FirstOrDefault(c => c.Signature.Parameters.Any(p => p.Name == "section")); + Assert.IsNotNull(configSectionCtor); + + var bodyString = configSectionCtor!.BodyStatements!.ToDisplayString(); + Assert.IsTrue(bodyString.Contains("IsNullOrEmpty"), + "IConfigurationSection constructor should use string.IsNullOrEmpty for string property binding"); + Assert.IsTrue(bodyString.Contains("TenantId"), + "IConfigurationSection constructor should assign to TenantId property"); + } + + [Test] + public void TestConfigurationSectionConstructorBody_WithComplexObjectProperty() + { + var complexModel = InputFactory.Model( + "CustomOptions", + properties: new[] + { + InputFactory.Property("setting1", InputPrimitiveType.String, isRequired: true, wireName: "setting1"), + InputFactory.Property("setting2", InputPrimitiveType.Int32, isRequired: false, wireName: "setting2") + }); + + var complexParam = InputFactory.MethodParameter( + "customOptions", + complexModel, + isRequired: false, + defaultValue: new InputConstant(null, complexModel), + scope: InputParameterScope.Client); + + var client = InputFactory.Client("TestClient", parameters: [complexParam]); + + MockHelpers.LoadMockGenerator( + clients: () => [client], + inputModels: () => [complexModel]); + + var clientProvider = ScmCodeModelGenerator.Instance.TypeFactory.CreateClient(client); + var clientOptionsProvider = clientProvider!.ClientOptions; + + Assert.IsNotNull(clientOptionsProvider); + + var configSectionCtor = clientOptionsProvider!.Constructors + .FirstOrDefault(c => c.Signature.Parameters.Any(p => p.Name == "section")); + Assert.IsNotNull(configSectionCtor); + + var bodyString = configSectionCtor!.BodyStatements!.ToDisplayString(); + Assert.IsTrue(bodyString.Contains("GetSection"), + "IConfigurationSection constructor should use GetSection for complex object property binding"); + Assert.IsTrue(bodyString.Contains("Exists"), + "IConfigurationSection constructor should check Exists for complex object property binding"); + Assert.IsTrue(bodyString.Contains("CustomOptions") && bodyString.Contains("new"), + "IConfigurationSection constructor should create new CustomOptions instance for complex object property binding"); + } + + [Test] + public void TestConfigurationSectionConstructorBody_WithFixedEnumProperty() + { + var enumType = InputFactory.StringEnum( + "ClientMode", + [("Default", "default"), ("MultiClient", "multi-client")], + isExtensible: false); + + var enumParam = InputFactory.MethodParameter( + "mode", + enumType, + isRequired: false, + defaultValue: new InputConstant("default", enumType), + scope: InputParameterScope.Client); + + var client = InputFactory.Client("TestClient", parameters: [enumParam]); + + MockHelpers.LoadMockGenerator( + clients: () => [client], + inputEnums: () => [enumType]); + + var clientProvider = ScmCodeModelGenerator.Instance.TypeFactory.CreateClient(client); + var clientOptionsProvider = clientProvider!.ClientOptions; + + Assert.IsNotNull(clientOptionsProvider); + + var configSectionCtor = clientOptionsProvider!.Constructors + .FirstOrDefault(c => c.Signature.Parameters.Any(p => p.Name == "section")); + Assert.IsNotNull(configSectionCtor); + + var bodyString = configSectionCtor!.BodyStatements!.ToDisplayString(); + Assert.IsTrue(bodyString.Contains("Enum.TryParse"), + "IConfigurationSection constructor should use Enum.TryParse for fixed enum property binding"); + Assert.IsTrue(bodyString.Contains("Mode"), + "IConfigurationSection constructor should assign to Mode property"); + Assert.IsFalse(bodyString.Contains("new ClientMode"), + "IConfigurationSection constructor should NOT use new for fixed enum property binding"); + } } } diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/CollectionResultDefinitions/CollectionResultDefinitionTests.cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/CollectionResultDefinitions/CollectionResultDefinitionTests.cs index b9957e4c6e9..6947ee8104e 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/CollectionResultDefinitions/CollectionResultDefinitionTests.cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/CollectionResultDefinitions/CollectionResultDefinitionTests.cs @@ -165,9 +165,9 @@ public void TestEmptyStringHandlingForStringContinuationToken() var writer = new TypeProviderWriter(collectionResultDefinition!); var file = writer.Write(); - + // Verify the generated code includes empty string check - Assert.IsTrue(file.Content.Contains("string.IsNullOrEmpty"), + Assert.IsTrue(file.Content.Contains("string.IsNullOrEmpty"), "Generated code should check for empty strings in continuation tokens"); } @@ -199,9 +199,9 @@ public void TestEmptyStringHandlingForUriNextLink() var writer = new TypeProviderWriter(collectionResultDefinition!); var file = writer.Write(); - + // Verify the generated code handles URI types correctly (null check is sufficient for Uri type) - Assert.IsTrue(file.Content.Contains("if ((nextPageUri == null))"), + Assert.IsTrue(file.Content.Contains("if ((nextPageUri == null))"), "Generated code should check for null URI"); } diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/CollectionResultDefinitions/ListPageableTests.cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/CollectionResultDefinitions/ListPageableTests.cs index 2aaddae9e52..56b0b87fe10 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/CollectionResultDefinitions/ListPageableTests.cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/CollectionResultDefinitions/ListPageableTests.cs @@ -63,7 +63,7 @@ public void TopParameterRenamedToMaxCountInPagingOperation() .OfType().ToList(); Assert.IsTrue(restClientProviders.Count > 0, "RestClientProvider should be generated"); - + var parameterNames = restClientProviders .SelectMany(p => p.Methods) .SelectMany(m => m.Signature.Parameters) @@ -134,7 +134,7 @@ public async Task TopParameterPreservedWhenExistsInLastContractView() Assert.AreEqual("top", topParam!.Name, "Parameter name should be 'top' (from LastContractView), not 'maxCount' (conversion should be prevented)"); } - + [Test] public void NoNextLinkOrContinuationTokenOfT() { diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/Definitions/BinaryContentHelperDefinitionTests.cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/Definitions/BinaryContentHelperDefinitionTests.cs index 3e9fbe0bbfa..715bdb21e5b 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/Definitions/BinaryContentHelperDefinitionTests.cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/Definitions/BinaryContentHelperDefinitionTests.cs @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. +// Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. using System; diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/Definitions/MultiPartFormDataBinaryContentDefinitionTests.cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/Definitions/MultiPartFormDataBinaryContentDefinitionTests.cs index 19015ea0588..f7481fa91b6 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/Definitions/MultiPartFormDataBinaryContentDefinitionTests.cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/Definitions/MultiPartFormDataBinaryContentDefinitionTests.cs @@ -1,11 +1,11 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. +// Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. using System.Linq; using Microsoft.TypeSpec.Generator.ClientModel.Providers; using Microsoft.TypeSpec.Generator.Tests.Common; -using NUnit.Framework; using Moq; +using NUnit.Framework; namespace Microsoft.TypeSpec.Generator.ClientModel.Tests.Providers.Definitions { diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/Definitions/PipelineRequestHeadersExtensionsDefinitionTests.cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/Definitions/PipelineRequestHeadersExtensionsDefinitionTests.cs index 241dece98eb..66b026ff2d4 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/Definitions/PipelineRequestHeadersExtensionsDefinitionTests.cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/Definitions/PipelineRequestHeadersExtensionsDefinitionTests.cs @@ -1,8 +1,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -using System.Collections.Generic; using System.ClientModel.Primitives; +using System.Collections.Generic; using System.Linq; using Microsoft.TypeSpec.Generator.ClientModel.Providers; using Microsoft.TypeSpec.Generator.Primitives; diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/EnumProvider/EnumProviderSerializationTests.cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/EnumProvider/EnumProviderSerializationTests.cs index d4355c3920d..1ba06a081f6 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/EnumProvider/EnumProviderSerializationTests.cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/EnumProvider/EnumProviderSerializationTests.cs @@ -25,17 +25,17 @@ private static object[] ValidateTypes(bool isExtensible) { var intType = InputFactory.Int32Enum( "mockInputEnum", - [ ("One", 1), ("Two", 2)], + [("One", 1), ("Two", 2)], isExtensible: isExtensible); var floatType = InputFactory.Float32Enum( "mockInputEnum", - [ ("One", 1f), ("Two", 2f)], + [("One", 1f), ("Two", 2f)], isExtensible: isExtensible); var stringType = InputFactory.StringEnum( "mockInputEnum", - [ ("One", "1"), ("Two", "2")], + [("One", "1"), ("Two", "2")], isExtensible: isExtensible); return [intType, floatType, stringType]; diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MrwSerializationTypeDefinitions/DiscriminatorTests.cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MrwSerializationTypeDefinitions/DiscriminatorTests.cs index e5945ad27b1..e09cb635a1f 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MrwSerializationTypeDefinitions/DiscriminatorTests.cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MrwSerializationTypeDefinitions/DiscriminatorTests.cs @@ -139,7 +139,7 @@ public void UnknownVariantDeserializeShouldUseBaseProperties() var serialization = unknownModel!.SerializationProviders.FirstOrDefault(); Assert.IsNotNull(serialization); var deserializeMethod = serialization!.Methods.FirstOrDefault(m => m.Signature.Name == "DeserializeUnknownPet"); - foreach(var property in _baseModel.Properties) + foreach (var property in _baseModel.Properties) { Assert.IsNotNull( deserializeMethod!.BodyStatements!.ToDisplayString().Contains($"if (property.NameEquals(\"{property.Name}\"u8))"), diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MrwSerializationTypeDefinitions/DynamicModelSerializationTests.cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MrwSerializationTypeDefinitions/DynamicModelSerializationTests.cs index a06cbeb18ea..3613629c0be 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MrwSerializationTypeDefinitions/DynamicModelSerializationTests.cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MrwSerializationTypeDefinitions/DynamicModelSerializationTests.cs @@ -1318,7 +1318,7 @@ public void DerivedModelWithoutOwnDynamicPropertiesDoesNotGeneratePropagators() Assert.IsNotNull(model); Assert.IsTrue(model!.IsDynamicModel, "Derived model should be marked as dynamic because base is dynamic"); Assert.IsFalse(model.HasDynamicProperties, "Derived model should not have dynamic properties when neither it nor base have dynamic property types"); - + var serialization = model.SerializationProviders.SingleOrDefault(); Assert.IsNotNull(serialization); @@ -1367,12 +1367,12 @@ public void DerivedModelWithoutDynamicPropertiesButBaseHasDynamicProperties() ]); MockHelpers.LoadMockGenerator(inputModels: () => [baseModel, derivedModel, baseDynamicModel]); - + // Validate base model has dynamic properties and propagators var baseModelProvider = ScmCodeModelGenerator.Instance.TypeFactory.CreateModel(baseModel) as ClientModel.Providers.ScmModelProvider; Assert.IsNotNull(baseModelProvider); Assert.IsTrue(baseModelProvider!.HasDynamicProperties, "Base model should have dynamic properties"); - + var baseSerialization = baseModelProvider.SerializationProviders.SingleOrDefault(); Assert.IsNotNull(baseSerialization); var baseMethods = baseSerialization!.Methods; @@ -1384,7 +1384,7 @@ public void DerivedModelWithoutDynamicPropertiesButBaseHasDynamicProperties() Assert.IsNotNull(derivedModelProvider); Assert.IsTrue(derivedModelProvider!.IsDynamicModel, "Derived model should be marked as dynamic because base is dynamic"); Assert.IsFalse(derivedModelProvider.HasDynamicProperties, "Derived model should not have dynamic properties when it has no dynamic property types of its own"); - + var derivedSerialization = derivedModelProvider.SerializationProviders.SingleOrDefault(); Assert.IsNotNull(derivedSerialization); @@ -1423,7 +1423,7 @@ public void WriteDynamicDerivedModelWithNonDiscriminatedBase() ]); MockHelpers.LoadMockGenerator(inputModels: () => [baseModel, dynamicDerivedModel]); - + // Verify base model is NOT dynamic var baseModelProvider = ScmCodeModelGenerator.Instance.TypeFactory.CreateModel(baseModel) as ClientModel.Providers.ScmModelProvider; Assert.IsNotNull(baseModelProvider); @@ -1479,7 +1479,7 @@ public void DeserializeDynamicDerivedModelWithNonDiscriminatedBase() Assert.IsTrue(derivedModelProvider!.IsDynamicModel, "Derived model should be dynamic"); Assert.IsTrue(derivedModelProvider.Constructors.Count > 0); -var serialization = derivedModelProvider.SerializationProviders.SingleOrDefault(); + var serialization = derivedModelProvider.SerializationProviders.SingleOrDefault(); Assert.IsNotNull(serialization); var writer = new TypeProviderWriter(new FilteredMethodsTypeProvider( diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MrwSerializationTypeDefinitions/ModelCustomizationTests.cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MrwSerializationTypeDefinitions/ModelCustomizationTests.cs index fcff349c3f3..1ed43b979a1 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MrwSerializationTypeDefinitions/ModelCustomizationTests.cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MrwSerializationTypeDefinitions/ModelCustomizationTests.cs @@ -367,13 +367,13 @@ public async Task CustomizedExplicitOperatorNotGenerated() var customCodeView = modelProvider.CustomCodeView; Assert.IsNotNull(customCodeView, "CustomCodeView should be detected"); var customMethods = customCodeView!.Methods; - var customOperator = customMethods.FirstOrDefault(m => + var customOperator = customMethods.FirstOrDefault(m => m.Signature.Modifiers.HasFlag(MethodSignatureModifiers.Explicit) && m.Signature.Modifiers.HasFlag(MethodSignatureModifiers.Operator)); Assert.IsNotNull(customOperator, "Custom explicit operator should be detected in CustomCodeView"); // Verify that the custom explicit operator is recognized and not generated - var explicitOperator = serializationProvider!.Methods.FirstOrDefault(m => + var explicitOperator = serializationProvider!.Methods.FirstOrDefault(m => m.Signature.Modifiers.HasFlag(MethodSignatureModifiers.Explicit) && m.Signature.Modifiers.HasFlag(MethodSignatureModifiers.Operator)); Assert.IsNull(explicitOperator, "Custom explicit operator should not be generated"); diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MrwSerializationTypeDefinitions/MrwSerializationTypeDefinitionTests.cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MrwSerializationTypeDefinitions/MrwSerializationTypeDefinitionTests.cs index 8aab43af3e5..1ea6851d8b1 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MrwSerializationTypeDefinitions/MrwSerializationTypeDefinitionTests.cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/MrwSerializationTypeDefinitions/MrwSerializationTypeDefinitionTests.cs @@ -29,7 +29,7 @@ internal static (ModelProvider Model, MrwSerializationTypeDefinition Serializati var generator = MockHelpers.LoadMockGenerator( inputModels: () => [inputModel], createSerializationsCore: (inputType, typeProvider) => - inputType is InputModelType modelType ? [new MrwSerializationTypeDefinition(modelType, (typeProvider as ModelProvider)!)]: []); + inputType is InputModelType modelType ? [new MrwSerializationTypeDefinition(modelType, (typeProvider as ModelProvider)!)] : []); if (isRootInput) { generator.Object.TypeFactory.RootInputModels.Add(inputModel); @@ -1145,7 +1145,7 @@ public void TestGetDeserializationMethodInvocationForType_InDeserializationMetho var generator = MockHelpers.LoadMockGenerator( inputModels: () => [inputModel, innerModel], createSerializationsCore: (inputType, typeProvider) => - inputType is InputModelType modelType ? [new MrwSerializationTypeDefinition(modelType, (typeProvider as ModelProvider)!)]: []); + inputType is InputModelType modelType ? [new MrwSerializationTypeDefinition(modelType, (typeProvider as ModelProvider)!)] : []); generator.Object.TypeFactory.RootInputModels.Add(inputModel); generator.Object.TypeFactory.RootOutputModels.Add(inputModel); @@ -1183,7 +1183,7 @@ public void TestGetDeserializationMethodInvocationForType_CollectionOfModels() var generator = MockHelpers.LoadMockGenerator( inputModels: () => [inputModel, innerModel], createSerializationsCore: (inputType, typeProvider) => - inputType is InputModelType modelType ? [new MrwSerializationTypeDefinition(modelType, (typeProvider as ModelProvider)!)]: []); + inputType is InputModelType modelType ? [new MrwSerializationTypeDefinition(modelType, (typeProvider as ModelProvider)!)] : []); generator.Object.TypeFactory.RootInputModels.Add(inputModel); generator.Object.TypeFactory.RootOutputModels.Add(inputModel); @@ -1220,7 +1220,7 @@ public void TestGetDeserializationMethodInvocationForType_DictionaryOfModels() var generator = MockHelpers.LoadMockGenerator( inputModels: () => [inputModel, valueModel], createSerializationsCore: (inputType, typeProvider) => - inputType is InputModelType modelType ? [new MrwSerializationTypeDefinition(modelType, (typeProvider as ModelProvider)!)]: []); + inputType is InputModelType modelType ? [new MrwSerializationTypeDefinition(modelType, (typeProvider as ModelProvider)!)] : []); generator.Object.TypeFactory.RootInputModels.Add(inputModel); generator.Object.TypeFactory.RootOutputModels.Add(inputModel); @@ -1250,9 +1250,9 @@ public void TestSerializationTypeNameMatchesModelProviderName() var (model, serialization) = CreateModelAndSerialization(inputModel); // The serialization type name should match the model provider name - Assert.AreEqual(model.Name, serialization.Name, + Assert.AreEqual(model.Name, serialization.Name, "Serialization type name should match ModelProvider name"); - + // The deserialization method should also use the model provider name var deserializationMethod = serialization.BuildDeserializationMethod(); Assert.IsNotNull(deserializationMethod); @@ -1269,29 +1269,29 @@ public void TestArrayEncodingSerializationStatement(string encoding, string expe Enum.TryParse(encoding, ignoreCase: true, out var arrayEncoding); var arrayType = new InputArrayType("TestArray", "TypeSpec.Array", InputPrimitiveType.String); var arrayProperty = new InputModelProperty( - "TestArray", + "TestArray", "Test array property summary", - "Test array property", - arrayType, - true, - false, - null, - false, - "testArray", - false, - false, - null, + "Test array property", + arrayType, + true, + false, + null, + false, + "testArray", + false, + false, + null, new(json: new("testArray")), arrayEncoding); - + var properties = new List { arrayProperty }; var inputModel = new InputModelType("TestModel", "TestNamespace", "TestModel", "public", null, null, "Test model.", InputModelTypeUsage.Input, properties, null, Array.Empty(), null, null, new Dictionary(), null, false, new(), false); var (_, serialization) = CreateModelAndSerialization(inputModel); var writeMethod = serialization.BuildJsonModelWriteCoreMethod(); var methodBody = writeMethod.BodyStatements!.ToDisplayString(); - - Assert.IsTrue(methodBody.Contains($"string.Join(\"{expectedDelimiter}\", TestArray)"), + + Assert.IsTrue(methodBody.Contains($"string.Join(\"{expectedDelimiter}\", TestArray)"), $"Expected serialization to use string.Join with delimiter '{expectedDelimiter}', but got: {methodBody}"); } @@ -1304,21 +1304,21 @@ public void TestArrayEncodingDeserializationStatement(string encoding, string ex Enum.TryParse(encoding, ignoreCase: true, out var arrayEncoding); var arrayType = new InputArrayType("TestArray", "TypeSpec.Array", InputPrimitiveType.String); var arrayProperty = new InputModelProperty( - "TestArray", + "TestArray", "Test array property summary", - "Test array property", - arrayType, - true, - false, - null, - false, - "testArray", - false, - false, - null, + "Test array property", + arrayType, + true, + false, + null, + false, + "testArray", + false, + false, + null, new(json: new("testArray")), arrayEncoding); - + var properties = new List { arrayProperty }; var inputModel = new InputModelType("TestModel", "TestNamespace", "TestModel", "public", null, null, "Test model.", InputModelTypeUsage.Input, properties, null, Array.Empty(), null, null, new Dictionary(), null, false, new(), false); diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/RestClientProviders/RestClientProviderTests.cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/RestClientProviders/RestClientProviderTests.cs index 1e0509129c9..0111de0dc0e 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/RestClientProviders/RestClientProviderTests.cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/RestClientProviders/RestClientProviderTests.cs @@ -8,13 +8,13 @@ using Microsoft.CodeAnalysis; using Microsoft.TypeSpec.Generator.ClientModel.Providers; using Microsoft.TypeSpec.Generator.Input; +using Microsoft.TypeSpec.Generator.Input.Extensions; using Microsoft.TypeSpec.Generator.Primitives; using Microsoft.TypeSpec.Generator.Providers; -using Microsoft.TypeSpec.Generator.Tests.Common; -using NUnit.Framework; using Microsoft.TypeSpec.Generator.Snippets; using Microsoft.TypeSpec.Generator.Statements; -using Microsoft.TypeSpec.Generator.Input.Extensions; +using Microsoft.TypeSpec.Generator.Tests.Common; +using NUnit.Framework; namespace Microsoft.TypeSpec.Generator.ClientModel.Tests.Providers.RestClientProviders { @@ -533,7 +533,7 @@ public void ValidateGetResponseClassifiersThrowsWhenNoSuccess() try { - var methods = restClientProvider.Methods; + var methods = restClientProvider.Methods; } catch (InvalidOperationException e) { diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ScmModelProvider/ScmModelProviderTests.cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ScmModelProvider/ScmModelProviderTests.cs index 9dfe03131ff..86d0fce01d6 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ScmModelProvider/ScmModelProviderTests.cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ScmModelProvider/ScmModelProviderTests.cs @@ -62,7 +62,7 @@ public void TestSingleDiscriminatorDynamicModel(bool validateBase) InputFactory.Property("kind", InputPrimitiveType.String, isRequired: true, isDiscriminator: true), InputFactory.Property("name", InputPrimitiveType.String, isRequired: true) ], - discriminatedModels: new Dictionary() { {"cat", catModel } }); + discriminatedModels: new Dictionary() { { "cat", catModel } }); MockHelpers.LoadMockGenerator(inputModels: () => [baseModel, catModel]); var outputLibrary = ScmCodeModelGenerator.Instance.OutputLibrary; diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/TestHelpers/TestRequestContentApi.cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/TestHelpers/TestRequestContentApi.cs index 106afd687af..3c84cc249ea 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/TestHelpers/TestRequestContentApi.cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/TestHelpers/TestRequestContentApi.cs @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. +// Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. using Microsoft.TypeSpec.Generator.ClientModel.Providers; From 76a42097989157ece6cbac963a2e5455daccae73 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 12 Mar 2026 22:18:26 +0000 Subject: [PATCH 35/38] Address review feedback: use Declare/Is snippets, ToVariableName, add numeric types Co-authored-by: jorgerangel-msft <102122018+jorgerangel-msft@users.noreply.github.com> --- .../src/Providers/ClientSettingsProvider.cs | 37 +++++--- .../Providers/ClientSettingsProviderTests.cs | 93 +++++++++++++++++++ 2 files changed, 117 insertions(+), 13 deletions(-) diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Providers/ClientSettingsProvider.cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Providers/ClientSettingsProvider.cs index 0a6ed1fd3c0..fbd6d0e350b 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Providers/ClientSettingsProvider.cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Providers/ClientSettingsProvider.cs @@ -197,6 +197,18 @@ internal static void AppendBindingForProperty( { AppendTryParseBinding(body, sectionParam, propName, varName, typeof(int)); } + else if (frameworkType == typeof(long)) + { + AppendTryParseBinding(body, sectionParam, propName, varName, typeof(long)); + } + else if (frameworkType == typeof(float)) + { + AppendTryParseBinding(body, sectionParam, propName, varName, typeof(float)); + } + else if (frameworkType == typeof(double)) + { + AppendTryParseBinding(body, sectionParam, propName, varName, typeof(double)); + } else if (frameworkType == typeof(TimeSpan)) { AppendTryParseBinding(body, sectionParam, propName, varName, typeof(TimeSpan)); @@ -205,6 +217,10 @@ internal static void AppendBindingForProperty( { AppendUriTryCreateBinding(body, sectionParam, propName, varName); } + else + { + AppendComplexObjectBinding(body, sectionParam, propName, varName, type); + } } /// @@ -285,24 +301,22 @@ internal static void AppendStringListBinding( } // IConfigurationSection listSection = section.GetSection("PropName"); - var sectionVar = new VariableExpression(IConfigurationSectionType, varName + "Section"); + var sectionVar = new VariableExpression(IConfigurationSectionType, (propName + "Section").ToVariableName()); body.Add(Declare(sectionVar, sectionParam.Invoke("GetSection", Literal(propName)))); // if (listSection.Exists()) var ifExistsStatement = new IfStatement(sectionVar.Invoke("Exists")); // listSection.GetChildren().Where(c => c.Value is not null).Select(c => c.Value!).ToList() - var cDecl = new CodeWriterDeclaration("c"); - var cVar = new VariableExpression(IConfigurationSectionType, cDecl); + var cVar = new VariableExpression(IConfigurationSectionType, "c"); var whereCondition = new BinaryOperatorExpression("is not", cVar.Property("Value"), Null); - var whereLambda = new FuncExpression([cDecl], whereCondition); + var whereLambda = new FuncExpression([cVar.Declaration], whereCondition); var whereResult = sectionVar.Invoke("GetChildren") .Invoke("Where", [whereLambda], null, false, extensionType: typeof(Enumerable)); - var c2Decl = new CodeWriterDeclaration("c"); - var c2Var = new VariableExpression(IConfigurationSectionType, c2Decl); + var c2Var = new VariableExpression(IConfigurationSectionType, "c"); var selectBody = new UnaryOperatorExpression("!", c2Var.Property("Value"), true); - var selectLambda = new FuncExpression([c2Decl], selectBody); + var selectLambda = new FuncExpression([c2Var.Declaration], selectBody); var selectResult = whereResult .Invoke("Select", [selectLambda], null, false, extensionType: typeof(Enumerable)); @@ -322,11 +336,8 @@ internal static void AppendEnumBinding( string varName, CSharpType type) { - var decl = new DeclarationExpression(typeof(string), varName, out var declVar); - var isPattern = new BinaryOperatorExpression("is", - new IndexerExpression(sectionParam, Literal(propName)), - decl); - var ifStatement = new IfStatement(isPattern); + var decl = Declare(varName, new CSharpType(typeof(string)), out var declVar); + var ifStatement = new IfStatement(new IndexerExpression(sectionParam, Literal(propName)).Is(decl)); ifStatement.Add(This.Property(propName).Assign(New.Instance(type, declVar)).Terminate()); body.Add(ifStatement); } @@ -364,7 +375,7 @@ internal static void AppendComplexObjectBinding( CSharpType type) { // IConfigurationSection {name}Section = section.GetSection("PropName"); - var sectionVar = new VariableExpression(IConfigurationSectionType, varName + "Section"); + var sectionVar = new VariableExpression(IConfigurationSectionType, (propName + "Section").ToVariableName()); body.Add(Declare(sectionVar, sectionParam.Invoke("GetSection", Literal(propName)))); // if ({name}Section.Exists()) { PropName = new TypeName({name}Section); } diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientSettingsProviderTests.cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientSettingsProviderTests.cs index b7c54ba807a..8979299d6cb 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientSettingsProviderTests.cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientSettingsProviderTests.cs @@ -499,6 +499,99 @@ public void TestBindCoreMethod_WithComplexObjectParam() Assert.IsTrue(bodyString.Contains("CustomOptions") && bodyString.Contains("new"), "BindCore should create new CustomOptions instance for complex object binding"); } + [Test] + public void TestBindCoreMethod_WithLongParam() + { + var inputParameters = new InputParameter[] + { + InputFactory.EndpointParameter( + "endpoint", + InputPrimitiveType.String, + defaultValue: InputFactory.Constant.String("https://default.endpoint.io"), + scope: InputParameterScope.Client, + isEndpoint: true), + InputFactory.MethodParameter( + "maxSize", + InputPrimitiveType.Int64, + isRequired: true, + scope: InputParameterScope.Client) + }; + var client = InputFactory.Client("TestClient", parameters: inputParameters); + var clientProvider = new ClientProvider(client); + var settingsProvider = clientProvider.ClientSettings; + + Assert.IsNotNull(settingsProvider); + + var bindCoreMethod = settingsProvider!.Methods.FirstOrDefault(m => m.Signature.Name == "BindCore"); + Assert.IsNotNull(bindCoreMethod); + + var bodyString = bindCoreMethod!.BodyStatements!.ToDisplayString(); + Assert.IsTrue(bodyString.Contains("long.TryParse"), "BindCore should use long.TryParse for long parameter binding"); + Assert.IsTrue(bodyString.Contains("MaxSize"), "BindCore should assign to MaxSize property"); + } + + [Test] + public void TestBindCoreMethod_WithFloatParam() + { + var inputParameters = new InputParameter[] + { + InputFactory.EndpointParameter( + "endpoint", + InputPrimitiveType.String, + defaultValue: InputFactory.Constant.String("https://default.endpoint.io"), + scope: InputParameterScope.Client, + isEndpoint: true), + InputFactory.MethodParameter( + "temperature", + InputPrimitiveType.Float32, + isRequired: true, + scope: InputParameterScope.Client) + }; + var client = InputFactory.Client("TestClient", parameters: inputParameters); + var clientProvider = new ClientProvider(client); + var settingsProvider = clientProvider.ClientSettings; + + Assert.IsNotNull(settingsProvider); + + var bindCoreMethod = settingsProvider!.Methods.FirstOrDefault(m => m.Signature.Name == "BindCore"); + Assert.IsNotNull(bindCoreMethod); + + var bodyString = bindCoreMethod!.BodyStatements!.ToDisplayString(); + Assert.IsTrue(bodyString.Contains("float.TryParse"), "BindCore should use float.TryParse for float parameter binding"); + Assert.IsTrue(bodyString.Contains("Temperature"), "BindCore should assign to Temperature property"); + } + + [Test] + public void TestBindCoreMethod_WithDoubleParam() + { + var inputParameters = new InputParameter[] + { + InputFactory.EndpointParameter( + "endpoint", + InputPrimitiveType.String, + defaultValue: InputFactory.Constant.String("https://default.endpoint.io"), + scope: InputParameterScope.Client, + isEndpoint: true), + InputFactory.MethodParameter( + "precision", + InputPrimitiveType.Float64, + isRequired: true, + scope: InputParameterScope.Client) + }; + var client = InputFactory.Client("TestClient", parameters: inputParameters); + var clientProvider = new ClientProvider(client); + var settingsProvider = clientProvider.ClientSettings; + + Assert.IsNotNull(settingsProvider); + + var bindCoreMethod = settingsProvider!.Methods.FirstOrDefault(m => m.Signature.Name == "BindCore"); + Assert.IsNotNull(bindCoreMethod); + + var bodyString = bindCoreMethod!.BodyStatements!.ToDisplayString(); + Assert.IsTrue(bodyString.Contains("double.TryParse"), "BindCore should use double.TryParse for double parameter binding"); + Assert.IsTrue(bodyString.Contains("Precision"), "BindCore should assign to Precision property"); + } + [Test] public void TestExperimentalAttribute() { From 4510af8024cfbfcd4fa8f1338106096b9b987191 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 12 Mar 2026 22:34:26 +0000 Subject: [PATCH 36/38] refactor: use Declare snippet for variable declarations instead of manual VariableExpression Co-authored-by: jorgerangel-msft <102122018+jorgerangel-msft@users.noreply.github.com> --- .../src/Providers/ClientSettingsProvider.cs | 21 ++++++++----------- 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Providers/ClientSettingsProvider.cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Providers/ClientSettingsProvider.cs index fbd6d0e350b..a1c0ad4fb39 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Providers/ClientSettingsProvider.cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Providers/ClientSettingsProvider.cs @@ -232,8 +232,7 @@ internal static void AppendStringBinding( string propName, string varName) { - var valVar = new VariableExpression(new CSharpType(typeof(string), isNullable: true), varName); - body.Add(Declare(valVar, new IndexerExpression(sectionParam, Literal(propName)))); + body.Add(Declare(varName, new CSharpType(typeof(string), isNullable: true), new IndexerExpression(sectionParam, Literal(propName)), out var valVar)); var ifStatement = new IfStatement(Not(StringSnippets.IsNullOrEmpty(valVar.As()))); ifStatement.Add(This.Property(propName).Assign(valVar).Terminate()); body.Add(ifStatement); @@ -301,22 +300,21 @@ internal static void AppendStringListBinding( } // IConfigurationSection listSection = section.GetSection("PropName"); - var sectionVar = new VariableExpression(IConfigurationSectionType, (propName + "Section").ToVariableName()); - body.Add(Declare(sectionVar, sectionParam.Invoke("GetSection", Literal(propName)))); + body.Add(Declare((propName + "Section").ToVariableName(), IConfigurationSectionType, sectionParam.Invoke("GetSection", Literal(propName)), out var sectionVar)); // if (listSection.Exists()) var ifExistsStatement = new IfStatement(sectionVar.Invoke("Exists")); // listSection.GetChildren().Where(c => c.Value is not null).Select(c => c.Value!).ToList() - var cVar = new VariableExpression(IConfigurationSectionType, "c"); - var whereCondition = new BinaryOperatorExpression("is not", cVar.Property("Value"), Null); - var whereLambda = new FuncExpression([cVar.Declaration], whereCondition); + var cWhereVar = new VariableExpression(IConfigurationSectionType, "c"); + var whereCondition = new BinaryOperatorExpression("is not", cWhereVar.Property("Value"), Null); + var whereLambda = new FuncExpression([cWhereVar.Declaration], whereCondition); var whereResult = sectionVar.Invoke("GetChildren") .Invoke("Where", [whereLambda], null, false, extensionType: typeof(Enumerable)); - var c2Var = new VariableExpression(IConfigurationSectionType, "c"); - var selectBody = new UnaryOperatorExpression("!", c2Var.Property("Value"), true); - var selectLambda = new FuncExpression([c2Var.Declaration], selectBody); + var cSelectVar = new VariableExpression(IConfigurationSectionType, "c"); + var selectBody = new UnaryOperatorExpression("!", cSelectVar.Property("Value"), true); + var selectLambda = new FuncExpression([cSelectVar.Declaration], selectBody); var selectResult = whereResult .Invoke("Select", [selectLambda], null, false, extensionType: typeof(Enumerable)); @@ -375,8 +373,7 @@ internal static void AppendComplexObjectBinding( CSharpType type) { // IConfigurationSection {name}Section = section.GetSection("PropName"); - var sectionVar = new VariableExpression(IConfigurationSectionType, (propName + "Section").ToVariableName()); - body.Add(Declare(sectionVar, sectionParam.Invoke("GetSection", Literal(propName)))); + body.Add(Declare((propName + "Section").ToVariableName(), IConfigurationSectionType, sectionParam.Invoke("GetSection", Literal(propName)), out var sectionVar)); // if ({name}Section.Exists()) { PropName = new TypeName({name}Section); } var ifExistsStatement = new IfStatement(sectionVar.Invoke("Exists")); From 4a47811327ebf0d201dd5ffa174b063bb657ecad Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 12 Mar 2026 23:03:33 +0000 Subject: [PATCH 37/38] Replace BinaryOperatorExpression("is not") with Not(Is(Null)) snippet Co-authored-by: JoshLove-msft <102122018+JoshLove-msft@users.noreply.github.com> --- .../src/Providers/ClientSettingsProvider.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Providers/ClientSettingsProvider.cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Providers/ClientSettingsProvider.cs index a1c0ad4fb39..aaabb0975a1 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Providers/ClientSettingsProvider.cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Providers/ClientSettingsProvider.cs @@ -307,7 +307,7 @@ internal static void AppendStringListBinding( // listSection.GetChildren().Where(c => c.Value is not null).Select(c => c.Value!).ToList() var cWhereVar = new VariableExpression(IConfigurationSectionType, "c"); - var whereCondition = new BinaryOperatorExpression("is not", cWhereVar.Property("Value"), Null); + var whereCondition = Not(cWhereVar.Property("Value").Is(Null)); var whereLambda = new FuncExpression([cWhereVar.Declaration], whereCondition); var whereResult = sectionVar.Invoke("GetChildren") .Invoke("Where", [whereLambda], null, false, extensionType: typeof(Enumerable)); From dddef97412550a8414c5a7503b68a090fcf8a261 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 12 Mar 2026 23:22:43 +0000 Subject: [PATCH 38/38] feat: add IsNot snippet to ValueExpression and ParameterProvider, use in ClientSettingsProvider Co-authored-by: JoshLove-msft <54595583+JoshLove-msft@users.noreply.github.com> --- .../src/Providers/ClientSettingsProvider.cs | 2 +- .../test/Providers/ClientSettingsProviderTests.cs | 1 + .../src/Expressions/ValueExpression.cs | 2 ++ .../Microsoft.TypeSpec.Generator/src/Snippets/Snippet.cs | 1 + 4 files changed, 5 insertions(+), 1 deletion(-) diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Providers/ClientSettingsProvider.cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Providers/ClientSettingsProvider.cs index aaabb0975a1..046d9d0e9c6 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Providers/ClientSettingsProvider.cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Providers/ClientSettingsProvider.cs @@ -307,7 +307,7 @@ internal static void AppendStringListBinding( // listSection.GetChildren().Where(c => c.Value is not null).Select(c => c.Value!).ToList() var cWhereVar = new VariableExpression(IConfigurationSectionType, "c"); - var whereCondition = Not(cWhereVar.Property("Value").Is(Null)); + var whereCondition = cWhereVar.Property("Value").IsNot(Null); var whereLambda = new FuncExpression([cWhereVar.Declaration], whereCondition); var whereResult = sectionVar.Invoke("GetChildren") .Invoke("Where", [whereLambda], null, false, extensionType: typeof(Enumerable)); diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientSettingsProviderTests.cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientSettingsProviderTests.cs index 8979299d6cb..9c9fc994075 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientSettingsProviderTests.cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientSettingsProviderTests.cs @@ -344,6 +344,7 @@ public void TestBindCoreMethod_WithStringListParam() Assert.IsTrue(bodyString.Contains("GetSection"), "BindCore should use GetSection for list parameter binding"); Assert.IsTrue(bodyString.Contains("GetChildren"), "BindCore should use GetChildren for list parameter binding"); Assert.IsTrue(bodyString.Contains("Where"), "BindCore should use Where to filter null values"); + Assert.IsTrue(bodyString.Contains("is not null"), "BindCore should use 'is not null' pattern in Where filter"); Assert.IsTrue(bodyString.Contains("Select"), "BindCore should use Select to extract values"); Assert.IsTrue(bodyString.Contains("ToList"), "BindCore should use ToList to materialize the list"); } diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator/src/Expressions/ValueExpression.cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator/src/Expressions/ValueExpression.cs index 35de326bf4d..0e37d14cd15 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator/src/Expressions/ValueExpression.cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator/src/Expressions/ValueExpression.cs @@ -126,6 +126,8 @@ public InvokeMethodExpression Invoke(string methodName, IReadOnlyList Is(ValueExpression other) => new BinaryOperatorExpression("is", this, other).As(); + public ScopedApi IsNot(ValueExpression other) => new BinaryOperatorExpression("is not", this, other).As(); + public UnaryOperatorExpression Increment() => new UnaryOperatorExpression("++", this, true); public ValueExpression AndExpr(ValueExpression other) => new BinaryOperatorExpression("and", this, other); diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator/src/Snippets/Snippet.cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator/src/Snippets/Snippet.cs index 783263be300..bfb6e7360ff 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator/src/Snippets/Snippet.cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator/src/Snippets/Snippet.cs @@ -15,6 +15,7 @@ public static partial class Snippet { public static ScopedApi Equal(this ParameterProvider parameter, ValueExpression other) => new BinaryOperatorExpression("==", parameter, other).As(); public static ScopedApi Is(this ParameterProvider parameter, ValueExpression other) => new BinaryOperatorExpression("is", parameter, other).As(); + public static ScopedApi IsNot(this ParameterProvider parameter, ValueExpression other) => new BinaryOperatorExpression("is not", parameter, other).As(); public static ScopedApi As(this ParameterProvider parameter, CSharpType type) => ((ValueExpression)parameter).As(type); public static ScopedApi As(this ParameterProvider parameter) => ((ValueExpression)parameter).As();