// <auto-generated/>

#nullable disable

using System;
using System.ClientModel;
using System.ClientModel.Primitives;
using System.Collections.Generic;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;

namespace SampleTypeSpec
{
    /// <summary> This is a sample typespec project. </summary>
    public partial class SampleTypeSpecClient
    {
        private readonly Uri _endpoint;
        /// <summary> A credential used to authenticate to the service. </summary>
        private readonly ApiKeyCredential _keyCredential;
        private const string AuthorizationHeader = "my-api-key";
        /// <summary> A credential provider used to authenticate to the service. </summary>
        private readonly AuthenticationTokenProvider _tokenProvider;
        /// <summary> The OAuth2 flows supported by the service. </summary>
        private readonly Dictionary<string, object>[] _flows = new Dictionary<string, object>[] 
        {
            new Dictionary<string, object>
            {
                { GetTokenOptions.ScopesPropertyName, new string[] { "read" } },
                { GetTokenOptions.AuthorizationUrlPropertyName, "https://api.example.com/oauth2/authorize" },
                { GetTokenOptions.RefreshUrlPropertyName, "https://api.example.com/oauth2/refresh" }
            }
        };
        private readonly string _apiVersion;
        private readonly string _metricsNamespace;
        private AnimalOperations _cachedAnimalOperations;
        private PetOperations _cachedPetOperations;
        private DogOperations _cachedDogOperations;
        private PlantOperations _cachedPlantOperations;
        private Metrics _cachedMetrics;

        /// <summary> Initializes a new instance of SampleTypeSpecClient for mocking. </summary>
        protected SampleTypeSpecClient()
        {
        }

        /// <summary> Initializes a new instance of SampleTypeSpecClient. </summary>
        /// <param name="endpoint"> Service endpoint. </param>
        /// <param name="metricsNamespace"></param>
        /// <param name="credential"> A credential used to authenticate to the service. </param>
        /// <exception cref="ArgumentNullException"> <paramref name="endpoint"/>, <paramref name="metricsNamespace"/> or <paramref name="credential"/> is null. </exception>
        /// <exception cref="ArgumentException"> <paramref name="metricsNamespace"/> is an empty string, and was expected to be non-empty. </exception>
        public SampleTypeSpecClient(Uri endpoint, string metricsNamespace, ApiKeyCredential credential) : this(endpoint, metricsNamespace, credential, new SampleTypeSpecClientOptions())
        {
        }

        /// <summary> Initializes a new instance of SampleTypeSpecClient. </summary>
        /// <param name="endpoint"> Service endpoint. </param>
        /// <param name="metricsNamespace"></param>
        /// <param name="tokenProvider"> A credential provider used to authenticate to the service. </param>
        /// <exception cref="ArgumentNullException"> <paramref name="endpoint"/>, <paramref name="metricsNamespace"/> or <paramref name="tokenProvider"/> is null. </exception>
        /// <exception cref="ArgumentException"> <paramref name="metricsNamespace"/> is an empty string, and was expected to be non-empty. </exception>
        public SampleTypeSpecClient(Uri endpoint, string metricsNamespace, AuthenticationTokenProvider tokenProvider) : this(endpoint, metricsNamespace, tokenProvider, new SampleTypeSpecClientOptions())
        {
        }

        /// <summary> Initializes a new instance of SampleTypeSpecClient. </summary>
        /// <param name="endpoint"> Service endpoint. </param>
        /// <param name="metricsNamespace"></param>
        /// <param name="credential"> A credential used to authenticate to the service. </param>
        /// <param name="options"> The options for configuring the client. </param>
        /// <exception cref="ArgumentNullException"> <paramref name="endpoint"/>, <paramref name="metricsNamespace"/> or <paramref name="credential"/> is null. </exception>
        /// <exception cref="ArgumentException"> <paramref name="metricsNamespace"/> is an empty string, and was expected to be non-empty. </exception>
        public SampleTypeSpecClient(Uri endpoint, string metricsNamespace, ApiKeyCredential credential, SampleTypeSpecClientOptions options)
        {
            Argument.AssertNotNull(endpoint, nameof(endpoint));
            Argument.AssertNotNullOrEmpty(metricsNamespace, nameof(metricsNamespace));
            Argument.AssertNotNull(credential, nameof(credential));

            options ??= new SampleTypeSpecClientOptions();

            _endpoint = endpoint;
            _metricsNamespace = metricsNamespace;
            _keyCredential = credential;
            Pipeline = ClientPipeline.Create(options, Array.Empty<PipelinePolicy>(), new PipelinePolicy[] { new UserAgentPolicy(typeof(SampleTypeSpecClient).Assembly), ApiKeyAuthenticationPolicy.CreateHeaderApiKeyPolicy(_keyCredential, AuthorizationHeader) }, Array.Empty<PipelinePolicy>());
            _apiVersion = options.Version;
        }

        /// <summary> Initializes a new instance of SampleTypeSpecClient. </summary>
        /// <param name="endpoint"> Service endpoint. </param>
        /// <param name="metricsNamespace"></param>
        /// <param name="tokenProvider"> A credential provider used to authenticate to the service. </param>
        /// <param name="options"> The options for configuring the client. </param>
        /// <exception cref="ArgumentNullException"> <paramref name="endpoint"/>, <paramref name="metricsNamespace"/> or <paramref name="tokenProvider"/> is null. </exception>
        /// <exception cref="ArgumentException"> <paramref name="metricsNamespace"/> is an empty string, and was expected to be non-empty. </exception>
        public SampleTypeSpecClient(Uri endpoint, string metricsNamespace, AuthenticationTokenProvider tokenProvider, SampleTypeSpecClientOptions options)
        {
            Argument.AssertNotNull(endpoint, nameof(endpoint));
            Argument.AssertNotNullOrEmpty(metricsNamespace, nameof(metricsNamespace));
            Argument.AssertNotNull(tokenProvider, nameof(tokenProvider));

            options ??= new SampleTypeSpecClientOptions();

            _endpoint = endpoint;
            _metricsNamespace = metricsNamespace;
            _tokenProvider = tokenProvider;
            Pipeline = ClientPipeline.Create(options, Array.Empty<PipelinePolicy>(), new PipelinePolicy[] { new UserAgentPolicy(typeof(SampleTypeSpecClient).Assembly), new BearerTokenPolicy(_tokenProvider, _flows) }, Array.Empty<PipelinePolicy>());
            _apiVersion = options.Version;
        }

        /// <summary> The HTTP pipeline for sending and receiving REST requests and responses. </summary>
        public ClientPipeline Pipeline { get; }

        /// <summary>
        /// [Protocol Method] Return hi
        /// <list type="bullet">
        /// <item>
        /// <description> This <see href="https://aka.ms/azsdk/net/protocol-methods">protocol method</see> allows explicit creation of the request and processing of the response for advanced scenarios. </description>
        /// </item>
        /// </list>
        /// </summary>
        /// <param name="headParameter"></param>
        /// <param name="queryParameter"></param>
        /// <param name="optionalQuery"></param>
        /// <param name="options"> The request options, which can override default behaviors of the client pipeline on a per-call basis. </param>
        /// <exception cref="ArgumentNullException"> <paramref name="headParameter"/> or <paramref name="queryParameter"/> is null. </exception>
        /// <exception cref="ArgumentException"> <paramref name="headParameter"/> or <paramref name="queryParameter"/> is an empty string, and was expected to be non-empty. </exception>
        /// <exception cref="ClientResultException"> Service returned a non-success status code. </exception>
        /// <returns> The response returned from the service. </returns>
        public virtual ClientResult SayHi(string headParameter, string queryParameter, string optionalQuery, RequestOptions options)
        {
            try
            {
                System.Console.WriteLine("Entering method SayHi.");
                Argument.AssertNotNullOrEmpty(headParameter, nameof(headParameter));
                Argument.AssertNotNullOrEmpty(queryParameter, nameof(queryParameter));

                using PipelineMessage message = CreateSayHiRequest(headParameter, queryParameter, optionalQuery, options);
                return ClientResult.FromResponse(Pipeline.ProcessMessage(message, options));
            }
            catch (Exception ex)
            {
                System.Console.WriteLine($"An exception was thrown in method SayHi: {ex}");
                throw;
            }
            finally
            {
                System.Console.WriteLine("Exiting method SayHi.");
            }
        }

        /// <summary>
        /// [Protocol Method] Return hi
        /// <list type="bullet">
        /// <item>
        /// <description> This <see href="https://aka.ms/azsdk/net/protocol-methods">protocol method</see> allows explicit creation of the request and processing of the response for advanced scenarios. </description>
        /// </item>
        /// </list>
        /// </summary>
        /// <param name="headParameter"></param>
        /// <param name="queryParameter"></param>
        /// <param name="optionalQuery"></param>
        /// <param name="options"> The request options, which can override default behaviors of the client pipeline on a per-call basis. </param>
        /// <exception cref="ArgumentNullException"> <paramref name="headParameter"/> or <paramref name="queryParameter"/> is null. </exception>
        /// <exception cref="ArgumentException"> <paramref name="headParameter"/> or <paramref name="queryParameter"/> is an empty string, and was expected to be non-empty. </exception>
        /// <exception cref="ClientResultException"> Service returned a non-success status code. </exception>
        /// <returns> The response returned from the service. </returns>
        public virtual async Task<ClientResult> SayHiAsync(string headParameter, string queryParameter, string optionalQuery, RequestOptions options)
        {
            try
            {
                System.Console.WriteLine("Entering method SayHiAsync.");
                Argument.AssertNotNullOrEmpty(headParameter, nameof(headParameter));
                Argument.AssertNotNullOrEmpty(queryParameter, nameof(queryParameter));

                using PipelineMessage message = CreateSayHiRequest(headParameter, queryParameter, optionalQuery, options);
                return ClientResult.FromResponse(await Pipeline.ProcessMessageAsync(message, options).ConfigureAwait(false));
            }
            catch (Exception ex)
            {
                System.Console.WriteLine($"An exception was thrown in method SayHiAsync: {ex}");
                throw;
            }
            finally
            {
                System.Console.WriteLine("Exiting method SayHiAsync.");
            }
        }

        /// <summary> Return hi. </summary>
        /// <param name="headParameter"></param>
        /// <param name="queryParameter"></param>
        /// <param name="optionalQuery"></param>
        /// <param name="cancellationToken"> The cancellation token that can be used to cancel the operation. </param>
        /// <exception cref="ArgumentNullException"> <paramref name="headParameter"/> or <paramref name="queryParameter"/> is null. </exception>
        /// <exception cref="ArgumentException"> <paramref name="headParameter"/> or <paramref name="queryParameter"/> is an empty string, and was expected to be non-empty. </exception>
        /// <exception cref="ClientResultException"> Service returned a non-success status code. </exception>
        public virtual ClientResult<Thing> SayHi(string headParameter, string queryParameter, string optionalQuery = default, CancellationToken cancellationToken = default)
        {
            try
            {
                System.Console.WriteLine("Entering method SayHi.");
                Argument.AssertNotNullOrEmpty(headParameter, nameof(headParameter));
                Argument.AssertNotNullOrEmpty(queryParameter, nameof(queryParameter));

                ClientResult result = SayHi(headParameter, queryParameter, optionalQuery, cancellationToken.ToRequestOptions());
                return ClientResult.FromValue((Thing)result, result.GetRawResponse());
            }
            catch (Exception ex)
            {
                System.Console.WriteLine($"An exception was thrown in method SayHi: {ex}");
                throw;
            }
            finally
            {
                System.Console.WriteLine("Exiting method SayHi.");
            }
        }

        /// <summary> Return hi. </summary>
        /// <param name="headParameter"></param>
        /// <param name="queryParameter"></param>
        /// <param name="optionalQuery"></param>
        /// <param name="cancellationToken"> The cancellation token that can be used to cancel the operation. </param>
        /// <exception cref="ArgumentNullException"> <paramref name="headParameter"/> or <paramref name="queryParameter"/> is null. </exception>
        /// <exception cref="ArgumentException"> <paramref name="headParameter"/> or <paramref name="queryParameter"/> is an empty string, and was expected to be non-empty. </exception>
        /// <exception cref="ClientResultException"> Service returned a non-success status code. </exception>
        public virtual async Task<ClientResult<Thing>> SayHiAsync(string headParameter, string queryParameter, string optionalQuery = default, CancellationToken cancellationToken = default)
        {
            try
            {
                System.Console.WriteLine("Entering method SayHiAsync.");
                Argument.AssertNotNullOrEmpty(headParameter, nameof(headParameter));
                Argument.AssertNotNullOrEmpty(queryParameter, nameof(queryParameter));

                ClientResult result = await SayHiAsync(headParameter, queryParameter, optionalQuery, cancellationToken.ToRequestOptions()).ConfigureAwait(false);
                return ClientResult.FromValue((Thing)result, result.GetRawResponse());
            }
            catch (Exception ex)
            {
                System.Console.WriteLine($"An exception was thrown in method SayHiAsync: {ex}");
                throw;
            }
            finally
            {
                System.Console.WriteLine("Exiting method SayHiAsync.");
            }
        }

        /// <summary>
        /// [Protocol Method] Return hi again
        /// <list type="bullet">
        /// <item>
        /// <description> This <see href="https://aka.ms/azsdk/net/protocol-methods">protocol method</see> allows explicit creation of the request and processing of the response for advanced scenarios. </description>
        /// </item>
        /// </list>
        /// </summary>
        /// <param name="p2"></param>
        /// <param name="p1"></param>
        /// <param name="content"> The content to send as the body of the request. </param>
        /// <param name="options"> The request options, which can override default behaviors of the client pipeline on a per-call basis. </param>
        /// <exception cref="ArgumentNullException"> <paramref name="p2"/>, <paramref name="p1"/> or <paramref name="content"/> is null. </exception>
        /// <exception cref="ArgumentException"> <paramref name="p2"/> or <paramref name="p1"/> is an empty string, and was expected to be non-empty. </exception>
        /// <exception cref="ClientResultException"> Service returned a non-success status code. </exception>
        /// <returns> The response returned from the service. </returns>
        public virtual ClientResult HelloAgain(string p2, string p1, BinaryContent content, RequestOptions options = null)
        {
            try
            {
                System.Console.WriteLine("Entering method HelloAgain.");
                Argument.AssertNotNullOrEmpty(p2, nameof(p2));
                Argument.AssertNotNullOrEmpty(p1, nameof(p1));
                Argument.AssertNotNull(content, nameof(content));

                using PipelineMessage message = CreateHelloAgainRequest(p2, p1, content, options);
                return ClientResult.FromResponse(Pipeline.ProcessMessage(message, options));
            }
            catch (Exception ex)
            {
                System.Console.WriteLine($"An exception was thrown in method HelloAgain: {ex}");
                throw;
            }
            finally
            {
                System.Console.WriteLine("Exiting method HelloAgain.");
            }
        }

        /// <summary>
        /// [Protocol Method] Return hi again
        /// <list type="bullet">
        /// <item>
        /// <description> This <see href="https://aka.ms/azsdk/net/protocol-methods">protocol method</see> allows explicit creation of the request and processing of the response for advanced scenarios. </description>
        /// </item>
        /// </list>
        /// </summary>
        /// <param name="p2"></param>
        /// <param name="p1"></param>
        /// <param name="content"> The content to send as the body of the request. </param>
        /// <param name="options"> The request options, which can override default behaviors of the client pipeline on a per-call basis. </param>
        /// <exception cref="ArgumentNullException"> <paramref name="p2"/>, <paramref name="p1"/> or <paramref name="content"/> is null. </exception>
        /// <exception cref="ArgumentException"> <paramref name="p2"/> or <paramref name="p1"/> is an empty string, and was expected to be non-empty. </exception>
        /// <exception cref="ClientResultException"> Service returned a non-success status code. </exception>
        /// <returns> The response returned from the service. </returns>
        public virtual async Task<ClientResult> HelloAgainAsync(string p2, string p1, BinaryContent content, RequestOptions options = null)
        {
            try
            {
                System.Console.WriteLine("Entering method HelloAgainAsync.");
                Argument.AssertNotNullOrEmpty(p2, nameof(p2));
                Argument.AssertNotNullOrEmpty(p1, nameof(p1));
                Argument.AssertNotNull(content, nameof(content));

                using PipelineMessage message = CreateHelloAgainRequest(p2, p1, content, options);
                return ClientResult.FromResponse(await Pipeline.ProcessMessageAsync(message, options).ConfigureAwait(false));
            }
            catch (Exception ex)
            {
                System.Console.WriteLine($"An exception was thrown in method HelloAgainAsync: {ex}");
                throw;
            }
            finally
            {
                System.Console.WriteLine("Exiting method HelloAgainAsync.");
            }
        }

        /// <summary> Return hi again. </summary>
        /// <param name="p2"></param>
        /// <param name="p1"></param>
        /// <param name="action"></param>
        /// <param name="cancellationToken"> The cancellation token that can be used to cancel the operation. </param>
        /// <exception cref="ArgumentNullException"> <paramref name="p2"/>, <paramref name="p1"/> or <paramref name="action"/> is null. </exception>
        /// <exception cref="ArgumentException"> <paramref name="p2"/> or <paramref name="p1"/> is an empty string, and was expected to be non-empty. </exception>
        /// <exception cref="ClientResultException"> Service returned a non-success status code. </exception>
        public virtual ClientResult<RoundTripModel> HelloAgain(string p2, string p1, RoundTripModel action, CancellationToken cancellationToken = default)
        {
            try
            {
                System.Console.WriteLine("Entering method HelloAgain.");
                Argument.AssertNotNullOrEmpty(p2, nameof(p2));
                Argument.AssertNotNullOrEmpty(p1, nameof(p1));
                Argument.AssertNotNull(action, nameof(action));

                ClientResult result = HelloAgain(p2, p1, action, cancellationToken.ToRequestOptions());
                return ClientResult.FromValue((RoundTripModel)result, result.GetRawResponse());
            }
            catch (Exception ex)
            {
                System.Console.WriteLine($"An exception was thrown in method HelloAgain: {ex}");
                throw;
            }
            finally
            {
                System.Console.WriteLine("Exiting method HelloAgain.");
            }
        }

        /// <summary> Return hi again. </summary>
        /// <param name="p2"></param>
        /// <param name="p1"></param>
        /// <param name="action"></param>
        /// <param name="cancellationToken"> The cancellation token that can be used to cancel the operation. </param>
        /// <exception cref="ArgumentNullException"> <paramref name="p2"/>, <paramref name="p1"/> or <paramref name="action"/> is null. </exception>
        /// <exception cref="ArgumentException"> <paramref name="p2"/> or <paramref name="p1"/> is an empty string, and was expected to be non-empty. </exception>
        /// <exception cref="ClientResultException"> Service returned a non-success status code. </exception>
        public virtual async Task<ClientResult<RoundTripModel>> HelloAgainAsync(string p2, string p1, RoundTripModel action, CancellationToken cancellationToken = default)
        {
            try
            {
                System.Console.WriteLine("Entering method HelloAgainAsync.");
                Argument.AssertNotNullOrEmpty(p2, nameof(p2));
                Argument.AssertNotNullOrEmpty(p1, nameof(p1));
                Argument.AssertNotNull(action, nameof(action));

                ClientResult result = await HelloAgainAsync(p2, p1, action, cancellationToken.ToRequestOptions()).ConfigureAwait(false);
                return ClientResult.FromValue((RoundTripModel)result, result.GetRawResponse());
            }
            catch (Exception ex)
            {
                System.Console.WriteLine($"An exception was thrown in method HelloAgainAsync: {ex}");
                throw;
            }
            finally
            {
                System.Console.WriteLine("Exiting method HelloAgainAsync.");
            }
        }

        /// <summary>
        /// [Protocol Method] Return hi again
        /// <list type="bullet">
        /// <item>
        /// <description> This <see href="https://aka.ms/azsdk/net/protocol-methods">protocol method</see> allows explicit creation of the request and processing of the response for advanced scenarios. </description>
        /// </item>
        /// </list>
        /// </summary>
        /// <param name="p2"></param>
        /// <param name="p1"></param>
        /// <param name="content"> The content to send as the body of the request. </param>
        /// <param name="options"> The request options, which can override default behaviors of the client pipeline on a per-call basis. </param>
        /// <exception cref="ArgumentNullException"> <paramref name="p2"/>, <paramref name="p1"/> or <paramref name="content"/> is null. </exception>
        /// <exception cref="ArgumentException"> <paramref name="p2"/> or <paramref name="p1"/> is an empty string, and was expected to be non-empty. </exception>
        /// <exception cref="ClientResultException"> Service returned a non-success status code. </exception>
        /// <returns> The response returned from the service. </returns>
        public virtual ClientResult NoContentType(string p2, string p1, BinaryContent content, RequestOptions options = null)
        {
            try
            {
                System.Console.WriteLine("Entering method NoContentType.");
                Argument.AssertNotNullOrEmpty(p2, nameof(p2));
                Argument.AssertNotNullOrEmpty(p1, nameof(p1));
                Argument.AssertNotNull(content, nameof(content));

                using PipelineMessage message = CreateNoContentTypeRequest(p2, p1, content, options);
                return ClientResult.FromResponse(Pipeline.ProcessMessage(message, options));
            }
            catch (Exception ex)
            {
                System.Console.WriteLine($"An exception was thrown in method NoContentType: {ex}");
                throw;
            }
            finally
            {
                System.Console.WriteLine("Exiting method NoContentType.");
            }
        }

        /// <summary>
        /// [Protocol Method] Return hi again
        /// <list type="bullet">
        /// <item>
        /// <description> This <see href="https://aka.ms/azsdk/net/protocol-methods">protocol method</see> allows explicit creation of the request and processing of the response for advanced scenarios. </description>
        /// </item>
        /// </list>
        /// </summary>
        /// <param name="p2"></param>
        /// <param name="p1"></param>
        /// <param name="content"> The content to send as the body of the request. </param>
        /// <param name="options"> The request options, which can override default behaviors of the client pipeline on a per-call basis. </param>
        /// <exception cref="ArgumentNullException"> <paramref name="p2"/>, <paramref name="p1"/> or <paramref name="content"/> is null. </exception>
        /// <exception cref="ArgumentException"> <paramref name="p2"/> or <paramref name="p1"/> is an empty string, and was expected to be non-empty. </exception>
        /// <exception cref="ClientResultException"> Service returned a non-success status code. </exception>
        /// <returns> The response returned from the service. </returns>
        public virtual async Task<ClientResult> NoContentTypeAsync(string p2, string p1, BinaryContent content, RequestOptions options = null)
        {
            try
            {
                System.Console.WriteLine("Entering method NoContentTypeAsync.");
                Argument.AssertNotNullOrEmpty(p2, nameof(p2));
                Argument.AssertNotNullOrEmpty(p1, nameof(p1));
                Argument.AssertNotNull(content, nameof(content));

                using PipelineMessage message = CreateNoContentTypeRequest(p2, p1, content, options);
                return ClientResult.FromResponse(await Pipeline.ProcessMessageAsync(message, options).ConfigureAwait(false));
            }
            catch (Exception ex)
            {
                System.Console.WriteLine($"An exception was thrown in method NoContentTypeAsync: {ex}");
                throw;
            }
            finally
            {
                System.Console.WriteLine("Exiting method NoContentTypeAsync.");
            }
        }

        /// <summary> Return hi again. </summary>
        /// <param name="info"></param>
        /// <param name="cancellationToken"> The cancellation token that can be used to cancel the operation. </param>
        /// <exception cref="ArgumentNullException"> <paramref name="info"/> is null. </exception>
        /// <exception cref="ClientResultException"> Service returned a non-success status code. </exception>
        public virtual ClientResult<RoundTripModel> NoContentType(Wrapper info, CancellationToken cancellationToken = default)
        {
            try
            {
                System.Console.WriteLine("Entering method NoContentType.");
                Argument.AssertNotNull(info, nameof(info));

                ClientResult result = NoContentType(info.P2, info.P1, info.Action, cancellationToken.ToRequestOptions());
                return ClientResult.FromValue((RoundTripModel)result, result.GetRawResponse());
            }
            catch (Exception ex)
            {
                System.Console.WriteLine($"An exception was thrown in method NoContentType: {ex}");
                throw;
            }
            finally
            {
                System.Console.WriteLine("Exiting method NoContentType.");
            }
        }

        /// <summary> Return hi again. </summary>
        /// <param name="info"></param>
        /// <param name="cancellationToken"> The cancellation token that can be used to cancel the operation. </param>
        /// <exception cref="ArgumentNullException"> <paramref name="info"/> is null. </exception>
        /// <exception cref="ClientResultException"> Service returned a non-success status code. </exception>
        public virtual async Task<ClientResult<RoundTripModel>> NoContentTypeAsync(Wrapper info, CancellationToken cancellationToken = default)
        {
            try
            {
                System.Console.WriteLine("Entering method NoContentTypeAsync.");
                Argument.AssertNotNull(info, nameof(info));

                ClientResult result = await NoContentTypeAsync(info.P2, info.P1, info.Action, cancellationToken.ToRequestOptions()).ConfigureAwait(false);
                return ClientResult.FromValue((RoundTripModel)result, result.GetRawResponse());
            }
            catch (Exception ex)
            {
                System.Console.WriteLine($"An exception was thrown in method NoContentTypeAsync: {ex}");
                throw;
            }
            finally
            {
                System.Console.WriteLine("Exiting method NoContentTypeAsync.");
            }
        }

        /// <summary>
        /// [Protocol Method] Return hi in demo2
        /// <list type="bullet">
        /// <item>
        /// <description> This <see href="https://aka.ms/azsdk/net/protocol-methods">protocol method</see> allows explicit creation of the request and processing of the response for advanced scenarios. </description>
        /// </item>
        /// </list>
        /// </summary>
        /// <param name="options"> The request options, which can override default behaviors of the client pipeline on a per-call basis. </param>
        /// <exception cref="ClientResultException"> Service returned a non-success status code. </exception>
        /// <returns> The response returned from the service. </returns>
        public virtual ClientResult HelloDemo2(RequestOptions options)
        {
            try
            {
                System.Console.WriteLine("Entering method HelloDemo2.");
                using PipelineMessage message = CreateHelloDemo2Request(options);
                return ClientResult.FromResponse(Pipeline.ProcessMessage(message, options));
            }
            catch (Exception ex)
            {
                System.Console.WriteLine($"An exception was thrown in method HelloDemo2: {ex}");
                throw;
            }
            finally
            {
                System.Console.WriteLine("Exiting method HelloDemo2.");
            }
        }

        /// <summary>
        /// [Protocol Method] Return hi in demo2
        /// <list type="bullet">
        /// <item>
        /// <description> This <see href="https://aka.ms/azsdk/net/protocol-methods">protocol method</see> allows explicit creation of the request and processing of the response for advanced scenarios. </description>
        /// </item>
        /// </list>
        /// </summary>
        /// <param name="options"> The request options, which can override default behaviors of the client pipeline on a per-call basis. </param>
        /// <exception cref="ClientResultException"> Service returned a non-success status code. </exception>
        /// <returns> The response returned from the service. </returns>
        public virtual async Task<ClientResult> HelloDemo2Async(RequestOptions options)
        {
            try
            {
                System.Console.WriteLine("Entering method HelloDemo2Async.");
                using PipelineMessage message = CreateHelloDemo2Request(options);
                return ClientResult.FromResponse(await Pipeline.ProcessMessageAsync(message, options).ConfigureAwait(false));
            }
            catch (Exception ex)
            {
                System.Console.WriteLine($"An exception was thrown in method HelloDemo2Async: {ex}");
                throw;
            }
            finally
            {
                System.Console.WriteLine("Exiting method HelloDemo2Async.");
            }
        }

        /// <summary> Return hi in demo2. </summary>
        /// <param name="cancellationToken"> The cancellation token that can be used to cancel the operation. </param>
        /// <exception cref="ClientResultException"> Service returned a non-success status code. </exception>
        public virtual ClientResult<Thing> HelloDemo2(CancellationToken cancellationToken = default)
        {
            try
            {
                System.Console.WriteLine("Entering method HelloDemo2.");
                ClientResult result = HelloDemo2(cancellationToken.ToRequestOptions());
                return ClientResult.FromValue((Thing)result, result.GetRawResponse());
            }
            catch (Exception ex)
            {
                System.Console.WriteLine($"An exception was thrown in method HelloDemo2: {ex}");
                throw;
            }
            finally
            {
                System.Console.WriteLine("Exiting method HelloDemo2.");
            }
        }

        /// <summary> Return hi in demo2. </summary>
        /// <param name="cancellationToken"> The cancellation token that can be used to cancel the operation. </param>
        /// <exception cref="ClientResultException"> Service returned a non-success status code. </exception>
        public virtual async Task<ClientResult<Thing>> HelloDemo2Async(CancellationToken cancellationToken = default)
        {
            try
            {
                System.Console.WriteLine("Entering method HelloDemo2Async.");
                ClientResult result = await HelloDemo2Async(cancellationToken.ToRequestOptions()).ConfigureAwait(false);
                return ClientResult.FromValue((Thing)result, result.GetRawResponse());
            }
            catch (Exception ex)
            {
                System.Console.WriteLine($"An exception was thrown in method HelloDemo2Async: {ex}");
                throw;
            }
            finally
            {
                System.Console.WriteLine("Exiting method HelloDemo2Async.");
            }
        }

        /// <summary>
        /// [Protocol Method] Create with literal value
        /// <list type="bullet">
        /// <item>
        /// <description> This <see href="https://aka.ms/azsdk/net/protocol-methods">protocol method</see> allows explicit creation of the request and processing of the response for advanced scenarios. </description>
        /// </item>
        /// </list>
        /// </summary>
        /// <param name="content"> The content to send as the body of the request. </param>
        /// <param name="options"> The request options, which can override default behaviors of the client pipeline on a per-call basis. </param>
        /// <exception cref="ArgumentNullException"> <paramref name="content"/> is null. </exception>
        /// <exception cref="ClientResultException"> Service returned a non-success status code. </exception>
        /// <returns> The response returned from the service. </returns>
        public virtual ClientResult CreateLiteral(BinaryContent content, RequestOptions options = null)
        {
            try
            {
                System.Console.WriteLine("Entering method CreateLiteral.");
                Argument.AssertNotNull(content, nameof(content));

                using PipelineMessage message = CreateCreateLiteralRequest(content, options);
                return ClientResult.FromResponse(Pipeline.ProcessMessage(message, options));
            }
            catch (Exception ex)
            {
                System.Console.WriteLine($"An exception was thrown in method CreateLiteral: {ex}");
                throw;
            }
            finally
            {
                System.Console.WriteLine("Exiting method CreateLiteral.");
            }
        }

        /// <summary>
        /// [Protocol Method] Create with literal value
        /// <list type="bullet">
        /// <item>
        /// <description> This <see href="https://aka.ms/azsdk/net/protocol-methods">protocol method</see> allows explicit creation of the request and processing of the response for advanced scenarios. </description>
        /// </item>
        /// </list>
        /// </summary>
        /// <param name="content"> The content to send as the body of the request. </param>
        /// <param name="options"> The request options, which can override default behaviors of the client pipeline on a per-call basis. </param>
        /// <exception cref="ArgumentNullException"> <paramref name="content"/> is null. </exception>
        /// <exception cref="ClientResultException"> Service returned a non-success status code. </exception>
        /// <returns> The response returned from the service. </returns>
        public virtual async Task<ClientResult> CreateLiteralAsync(BinaryContent content, RequestOptions options = null)
        {
            try
            {
                System.Console.WriteLine("Entering method CreateLiteralAsync.");
                Argument.AssertNotNull(content, nameof(content));

                using PipelineMessage message = CreateCreateLiteralRequest(content, options);
                return ClientResult.FromResponse(await Pipeline.ProcessMessageAsync(message, options).ConfigureAwait(false));
            }
            catch (Exception ex)
            {
                System.Console.WriteLine($"An exception was thrown in method CreateLiteralAsync: {ex}");
                throw;
            }
            finally
            {
                System.Console.WriteLine("Exiting method CreateLiteralAsync.");
            }
        }

        /// <summary> Create with literal value. </summary>
        /// <param name="body"></param>
        /// <param name="cancellationToken"> The cancellation token that can be used to cancel the operation. </param>
        /// <exception cref="ArgumentNullException"> <paramref name="body"/> is null. </exception>
        /// <exception cref="ClientResultException"> Service returned a non-success status code. </exception>
        public virtual ClientResult<Thing> CreateLiteral(Thing body, CancellationToken cancellationToken = default)
        {
            try
            {
                System.Console.WriteLine("Entering method CreateLiteral.");
                Argument.AssertNotNull(body, nameof(body));

                ClientResult result = CreateLiteral(body, cancellationToken.ToRequestOptions());
                return ClientResult.FromValue((Thing)result, result.GetRawResponse());
            }
            catch (Exception ex)
            {
                System.Console.WriteLine($"An exception was thrown in method CreateLiteral: {ex}");
                throw;
            }
            finally
            {
                System.Console.WriteLine("Exiting method CreateLiteral.");
            }
        }

        /// <summary> Create with literal value. </summary>
        /// <param name="body"></param>
        /// <param name="cancellationToken"> The cancellation token that can be used to cancel the operation. </param>
        /// <exception cref="ArgumentNullException"> <paramref name="body"/> is null. </exception>
        /// <exception cref="ClientResultException"> Service returned a non-success status code. </exception>
        public virtual async Task<ClientResult<Thing>> CreateLiteralAsync(Thing body, CancellationToken cancellationToken = default)
        {
            try
            {
                System.Console.WriteLine("Entering method CreateLiteralAsync.");
                Argument.AssertNotNull(body, nameof(body));

                ClientResult result = await CreateLiteralAsync(body, cancellationToken.ToRequestOptions()).ConfigureAwait(false);
                return ClientResult.FromValue((Thing)result, result.GetRawResponse());
            }
            catch (Exception ex)
            {
                System.Console.WriteLine($"An exception was thrown in method CreateLiteralAsync: {ex}");
                throw;
            }
            finally
            {
                System.Console.WriteLine("Exiting method CreateLiteralAsync.");
            }
        }

        /// <summary>
        /// [Protocol Method] Send literal parameters
        /// <list type="bullet">
        /// <item>
        /// <description> This <see href="https://aka.ms/azsdk/net/protocol-methods">protocol method</see> allows explicit creation of the request and processing of the response for advanced scenarios. </description>
        /// </item>
        /// </list>
        /// </summary>
        /// <param name="options"> The request options, which can override default behaviors of the client pipeline on a per-call basis. </param>
        /// <exception cref="ClientResultException"> Service returned a non-success status code. </exception>
        /// <returns> The response returned from the service. </returns>
        public virtual ClientResult HelloLiteral(RequestOptions options)
        {
            try
            {
                System.Console.WriteLine("Entering method HelloLiteral.");
                using PipelineMessage message = CreateHelloLiteralRequest(options);
                return ClientResult.FromResponse(Pipeline.ProcessMessage(message, options));
            }
            catch (Exception ex)
            {
                System.Console.WriteLine($"An exception was thrown in method HelloLiteral: {ex}");
                throw;
            }
            finally
            {
                System.Console.WriteLine("Exiting method HelloLiteral.");
            }
        }

        /// <summary>
        /// [Protocol Method] Send literal parameters
        /// <list type="bullet">
        /// <item>
        /// <description> This <see href="https://aka.ms/azsdk/net/protocol-methods">protocol method</see> allows explicit creation of the request and processing of the response for advanced scenarios. </description>
        /// </item>
        /// </list>
        /// </summary>
        /// <param name="options"> The request options, which can override default behaviors of the client pipeline on a per-call basis. </param>
        /// <exception cref="ClientResultException"> Service returned a non-success status code. </exception>
        /// <returns> The response returned from the service. </returns>
        public virtual async Task<ClientResult> HelloLiteralAsync(RequestOptions options)
        {
            try
            {
                System.Console.WriteLine("Entering method HelloLiteralAsync.");
                using PipelineMessage message = CreateHelloLiteralRequest(options);
                return ClientResult.FromResponse(await Pipeline.ProcessMessageAsync(message, options).ConfigureAwait(false));
            }
            catch (Exception ex)
            {
                System.Console.WriteLine($"An exception was thrown in method HelloLiteralAsync: {ex}");
                throw;
            }
            finally
            {
                System.Console.WriteLine("Exiting method HelloLiteralAsync.");
            }
        }

        /// <summary> Send literal parameters. </summary>
        /// <param name="cancellationToken"> The cancellation token that can be used to cancel the operation. </param>
        /// <exception cref="ClientResultException"> Service returned a non-success status code. </exception>
        public virtual ClientResult<Thing> HelloLiteral(CancellationToken cancellationToken = default)
        {
            try
            {
                System.Console.WriteLine("Entering method HelloLiteral.");
                ClientResult result = HelloLiteral(cancellationToken.ToRequestOptions());
                return ClientResult.FromValue((Thing)result, result.GetRawResponse());
            }
            catch (Exception ex)
            {
                System.Console.WriteLine($"An exception was thrown in method HelloLiteral: {ex}");
                throw;
            }
            finally
            {
                System.Console.WriteLine("Exiting method HelloLiteral.");
            }
        }

        /// <summary> Send literal parameters. </summary>
        /// <param name="cancellationToken"> The cancellation token that can be used to cancel the operation. </param>
        /// <exception cref="ClientResultException"> Service returned a non-success status code. </exception>
        public virtual async Task<ClientResult<Thing>> HelloLiteralAsync(CancellationToken cancellationToken = default)
        {
            try
            {
                System.Console.WriteLine("Entering method HelloLiteralAsync.");
                ClientResult result = await HelloLiteralAsync(cancellationToken.ToRequestOptions()).ConfigureAwait(false);
                return ClientResult.FromValue((Thing)result, result.GetRawResponse());
            }
            catch (Exception ex)
            {
                System.Console.WriteLine($"An exception was thrown in method HelloLiteralAsync: {ex}");
                throw;
            }
            finally
            {
                System.Console.WriteLine("Exiting method HelloLiteralAsync.");
            }
        }

        /// <summary>
        /// [Protocol Method] top level method
        /// <list type="bullet">
        /// <item>
        /// <description> This <see href="https://aka.ms/azsdk/net/protocol-methods">protocol method</see> allows explicit creation of the request and processing of the response for advanced scenarios. </description>
        /// </item>
        /// </list>
        /// </summary>
        /// <param name="action"></param>
        /// <param name="options"> The request options, which can override default behaviors of the client pipeline on a per-call basis. </param>
        /// <exception cref="ClientResultException"> Service returned a non-success status code. </exception>
        /// <returns> The response returned from the service. </returns>
        public virtual ClientResult TopAction(DateTimeOffset action, RequestOptions options)
        {
            try
            {
                System.Console.WriteLine("Entering method TopAction.");
                using PipelineMessage message = CreateTopActionRequest(action, options);
                return ClientResult.FromResponse(Pipeline.ProcessMessage(message, options));
            }
            catch (Exception ex)
            {
                System.Console.WriteLine($"An exception was thrown in method TopAction: {ex}");
                throw;
            }
            finally
            {
                System.Console.WriteLine("Exiting method TopAction.");
            }
        }

        /// <summary>
        /// [Protocol Method] top level method
        /// <list type="bullet">
        /// <item>
        /// <description> This <see href="https://aka.ms/azsdk/net/protocol-methods">protocol method</see> allows explicit creation of the request and processing of the response for advanced scenarios. </description>
        /// </item>
        /// </list>
        /// </summary>
        /// <param name="action"></param>
        /// <param name="options"> The request options, which can override default behaviors of the client pipeline on a per-call basis. </param>
        /// <exception cref="ClientResultException"> Service returned a non-success status code. </exception>
        /// <returns> The response returned from the service. </returns>
        public virtual async Task<ClientResult> TopActionAsync(DateTimeOffset action, RequestOptions options)
        {
            try
            {
                System.Console.WriteLine("Entering method TopActionAsync.");
                using PipelineMessage message = CreateTopActionRequest(action, options);
                return ClientResult.FromResponse(await Pipeline.ProcessMessageAsync(message, options).ConfigureAwait(false));
            }
            catch (Exception ex)
            {
                System.Console.WriteLine($"An exception was thrown in method TopActionAsync: {ex}");
                throw;
            }
            finally
            {
                System.Console.WriteLine("Exiting method TopActionAsync.");
            }
        }

        /// <summary> top level method. </summary>
        /// <param name="action"></param>
        /// <param name="cancellationToken"> The cancellation token that can be used to cancel the operation. </param>
        /// <exception cref="ClientResultException"> Service returned a non-success status code. </exception>
        public virtual ClientResult<Thing> TopAction(DateTimeOffset action, CancellationToken cancellationToken = default)
        {
            try
            {
                System.Console.WriteLine("Entering method TopAction.");
                ClientResult result = TopAction(action, cancellationToken.ToRequestOptions());
                return ClientResult.FromValue((Thing)result, result.GetRawResponse());
            }
            catch (Exception ex)
            {
                System.Console.WriteLine($"An exception was thrown in method TopAction: {ex}");
                throw;
            }
            finally
            {
                System.Console.WriteLine("Exiting method TopAction.");
            }
        }

        /// <summary> top level method. </summary>
        /// <param name="action"></param>
        /// <param name="cancellationToken"> The cancellation token that can be used to cancel the operation. </param>
        /// <exception cref="ClientResultException"> Service returned a non-success status code. </exception>
        public virtual async Task<ClientResult<Thing>> TopActionAsync(DateTimeOffset action, CancellationToken cancellationToken = default)
        {
            try
            {
                System.Console.WriteLine("Entering method TopActionAsync.");
                ClientResult result = await TopActionAsync(action, cancellationToken.ToRequestOptions()).ConfigureAwait(false);
                return ClientResult.FromValue((Thing)result, result.GetRawResponse());
            }
            catch (Exception ex)
            {
                System.Console.WriteLine($"An exception was thrown in method TopActionAsync: {ex}");
                throw;
            }
            finally
            {
                System.Console.WriteLine("Exiting method TopActionAsync.");
            }
        }

        /// <summary>
        /// [Protocol Method] top level method2
        /// <list type="bullet">
        /// <item>
        /// <description> This <see href="https://aka.ms/azsdk/net/protocol-methods">protocol method</see> allows explicit creation of the request and processing of the response for advanced scenarios. </description>
        /// </item>
        /// </list>
        /// </summary>
        /// <param name="options"> The request options, which can override default behaviors of the client pipeline on a per-call basis. </param>
        /// <exception cref="ClientResultException"> Service returned a non-success status code. </exception>
        /// <returns> The response returned from the service. </returns>
        public virtual ClientResult TopAction2(RequestOptions options = null)
        {
            try
            {
                System.Console.WriteLine("Entering method TopAction2.");
                using PipelineMessage message = CreateTopAction2Request(options);
                return ClientResult.FromResponse(Pipeline.ProcessMessage(message, options));
            }
            catch (Exception ex)
            {
                System.Console.WriteLine($"An exception was thrown in method TopAction2: {ex}");
                throw;
            }
            finally
            {
                System.Console.WriteLine("Exiting method TopAction2.");
            }
        }

        /// <summary>
        /// [Protocol Method] top level method2
        /// <list type="bullet">
        /// <item>
        /// <description> This <see href="https://aka.ms/azsdk/net/protocol-methods">protocol method</see> allows explicit creation of the request and processing of the response for advanced scenarios. </description>
        /// </item>
        /// </list>
        /// </summary>
        /// <param name="options"> The request options, which can override default behaviors of the client pipeline on a per-call basis. </param>
        /// <exception cref="ClientResultException"> Service returned a non-success status code. </exception>
        /// <returns> The response returned from the service. </returns>
        public virtual async Task<ClientResult> TopAction2Async(RequestOptions options = null)
        {
            try
            {
                System.Console.WriteLine("Entering method TopAction2Async.");
                using PipelineMessage message = CreateTopAction2Request(options);
                return ClientResult.FromResponse(await Pipeline.ProcessMessageAsync(message, options).ConfigureAwait(false));
            }
            catch (Exception ex)
            {
                System.Console.WriteLine($"An exception was thrown in method TopAction2Async: {ex}");
                throw;
            }
            finally
            {
                System.Console.WriteLine("Exiting method TopAction2Async.");
            }
        }

        /// <summary>
        /// [Protocol Method] top level patch
        /// <list type="bullet">
        /// <item>
        /// <description> This <see href="https://aka.ms/azsdk/net/protocol-methods">protocol method</see> allows explicit creation of the request and processing of the response for advanced scenarios. </description>
        /// </item>
        /// </list>
        /// </summary>
        /// <param name="content"> The content to send as the body of the request. </param>
        /// <param name="options"> The request options, which can override default behaviors of the client pipeline on a per-call basis. </param>
        /// <exception cref="ArgumentNullException"> <paramref name="content"/> is null. </exception>
        /// <exception cref="ClientResultException"> Service returned a non-success status code. </exception>
        /// <returns> The response returned from the service. </returns>
        public virtual ClientResult PatchAction(BinaryContent content, RequestOptions options = null)
        {
            try
            {
                System.Console.WriteLine("Entering method PatchAction.");
                Argument.AssertNotNull(content, nameof(content));

                using PipelineMessage message = CreatePatchActionRequest(content, options);
                return ClientResult.FromResponse(Pipeline.ProcessMessage(message, options));
            }
            catch (Exception ex)
            {
                System.Console.WriteLine($"An exception was thrown in method PatchAction: {ex}");
                throw;
            }
            finally
            {
                System.Console.WriteLine("Exiting method PatchAction.");
            }
        }

        /// <summary>
        /// [Protocol Method] top level patch
        /// <list type="bullet">
        /// <item>
        /// <description> This <see href="https://aka.ms/azsdk/net/protocol-methods">protocol method</see> allows explicit creation of the request and processing of the response for advanced scenarios. </description>
        /// </item>
        /// </list>
        /// </summary>
        /// <param name="content"> The content to send as the body of the request. </param>
        /// <param name="options"> The request options, which can override default behaviors of the client pipeline on a per-call basis. </param>
        /// <exception cref="ArgumentNullException"> <paramref name="content"/> is null. </exception>
        /// <exception cref="ClientResultException"> Service returned a non-success status code. </exception>
        /// <returns> The response returned from the service. </returns>
        public virtual async Task<ClientResult> PatchActionAsync(BinaryContent content, RequestOptions options = null)
        {
            try
            {
                System.Console.WriteLine("Entering method PatchActionAsync.");
                Argument.AssertNotNull(content, nameof(content));

                using PipelineMessage message = CreatePatchActionRequest(content, options);
                return ClientResult.FromResponse(await Pipeline.ProcessMessageAsync(message, options).ConfigureAwait(false));
            }
            catch (Exception ex)
            {
                System.Console.WriteLine($"An exception was thrown in method PatchActionAsync: {ex}");
                throw;
            }
            finally
            {
                System.Console.WriteLine("Exiting method PatchActionAsync.");
            }
        }

        /// <summary>
        /// [Protocol Method] body parameter without body decorator
        /// <list type="bullet">
        /// <item>
        /// <description> This <see href="https://aka.ms/azsdk/net/protocol-methods">protocol method</see> allows explicit creation of the request and processing of the response for advanced scenarios. </description>
        /// </item>
        /// </list>
        /// </summary>
        /// <param name="content"> The content to send as the body of the request. </param>
        /// <param name="options"> The request options, which can override default behaviors of the client pipeline on a per-call basis. </param>
        /// <exception cref="ArgumentNullException"> <paramref name="content"/> is null. </exception>
        /// <exception cref="ClientResultException"> Service returned a non-success status code. </exception>
        /// <returns> The response returned from the service. </returns>
        public virtual ClientResult AnonymousBody(BinaryContent content, RequestOptions options = null)
        {
            try
            {
                System.Console.WriteLine("Entering method AnonymousBody.");
                Argument.AssertNotNull(content, nameof(content));

                using PipelineMessage message = CreateAnonymousBodyRequest(content, options);
                return ClientResult.FromResponse(Pipeline.ProcessMessage(message, options));
            }
            catch (Exception ex)
            {
                System.Console.WriteLine($"An exception was thrown in method AnonymousBody: {ex}");
                throw;
            }
            finally
            {
                System.Console.WriteLine("Exiting method AnonymousBody.");
            }
        }

        /// <summary>
        /// [Protocol Method] body parameter without body decorator
        /// <list type="bullet">
        /// <item>
        /// <description> This <see href="https://aka.ms/azsdk/net/protocol-methods">protocol method</see> allows explicit creation of the request and processing of the response for advanced scenarios. </description>
        /// </item>
        /// </list>
        /// </summary>
        /// <param name="content"> The content to send as the body of the request. </param>
        /// <param name="options"> The request options, which can override default behaviors of the client pipeline on a per-call basis. </param>
        /// <exception cref="ArgumentNullException"> <paramref name="content"/> is null. </exception>
        /// <exception cref="ClientResultException"> Service returned a non-success status code. </exception>
        /// <returns> The response returned from the service. </returns>
        public virtual async Task<ClientResult> AnonymousBodyAsync(BinaryContent content, RequestOptions options = null)
        {
            try
            {
                System.Console.WriteLine("Entering method AnonymousBodyAsync.");
                Argument.AssertNotNull(content, nameof(content));

                using PipelineMessage message = CreateAnonymousBodyRequest(content, options);
                return ClientResult.FromResponse(await Pipeline.ProcessMessageAsync(message, options).ConfigureAwait(false));
            }
            catch (Exception ex)
            {
                System.Console.WriteLine($"An exception was thrown in method AnonymousBodyAsync: {ex}");
                throw;
            }
            finally
            {
                System.Console.WriteLine("Exiting method AnonymousBodyAsync.");
            }
        }

        /// <summary> body parameter without body decorator. </summary>
        /// <param name="name"> name of the Thing. </param>
        /// <param name="requiredUnion"> required Union. </param>
        /// <param name="requiredNullableString"> required nullable string. </param>
        /// <param name="requiredNullableLiteralString"> required nullable literal string. </param>
        /// <param name="requiredBadDescription"> description with xml &lt;|endoftext|&gt;. </param>
        /// <param name="requiredNullableList"> required nullable collection. </param>
        /// <param name="propertyWithSpecialDocs">
        /// This tests:
        /// <list type="bullet"><item><description>Simple bullet point. This bullet point is going to be very long to test how text wrapping is handled in bullet points within documentation comments. It should properly indent the wrapped lines.</description></item><item><description>Another bullet point with <b>bold text</b>. This bullet point is also intentionally long to see how the formatting is preserved when the text wraps onto multiple lines in the generated documentation.</description></item><item><description>Third bullet point with <i>italic text</i>. Similar to the previous points, this one is extended to ensure that the wrapping and formatting are correctly applied in the output.</description></item><item><description>Complex bullet point with <b>bold</b> and <i>italic</i> combined. This bullet point combines both bold and italic formatting and is long enough to test the wrapping behavior in such cases.</description></item><item><description><b>Bold bullet point</b>: A bullet point that is entirely bolded. This point is also made lengthy to observe how the bold formatting is maintained across wrapped lines.</description></item><item><description><i>Italic bullet point</i>: A bullet point that is entirely italicized. This final point is extended to verify that italic formatting is correctly applied even when the text spans multiple lines.</description></item></list>
        /// </param>
        /// <param name="optionalNullableString"> required optional string. </param>
        /// <param name="optionalLiteralString"> optional literal string. </param>
        /// <param name="optionalLiteralInt"> optional literal int. </param>
        /// <param name="optionalLiteralFloat"> optional literal float. </param>
        /// <param name="optionalLiteralBool"> optional literal bool. </param>
        /// <param name="optionalNullableList"> optional nullable collection. </param>
        /// <param name="cancellationToken"> The cancellation token that can be used to cancel the operation. </param>
        /// <exception cref="ArgumentNullException"> <paramref name="name"/>, <paramref name="requiredUnion"/>, <paramref name="requiredBadDescription"/> or <paramref name="propertyWithSpecialDocs"/> is null. </exception>
        /// <exception cref="ArgumentException"> <paramref name="name"/>, <paramref name="requiredBadDescription"/> or <paramref name="propertyWithSpecialDocs"/> is an empty string, and was expected to be non-empty. </exception>
        /// <exception cref="ClientResultException"> Service returned a non-success status code. </exception>
        public virtual ClientResult<Thing> AnonymousBody(string name, BinaryData requiredUnion, string requiredNullableString, ThingRequiredNullableLiteralString1? requiredNullableLiteralString, string requiredBadDescription, IEnumerable<int> requiredNullableList, string propertyWithSpecialDocs, string optionalNullableString = default, ThingOptionalLiteralString? optionalLiteralString = default, ThingOptionalLiteralInt? optionalLiteralInt = default, ThingOptionalLiteralFloat? optionalLiteralFloat = default, bool? optionalLiteralBool = default, IEnumerable<int> optionalNullableList = default, CancellationToken cancellationToken = default)
        {
            try
            {
                System.Console.WriteLine("Entering method AnonymousBody.");
                Argument.AssertNotNullOrEmpty(name, nameof(name));
                Argument.AssertNotNull(requiredUnion, nameof(requiredUnion));
                Argument.AssertNotNullOrEmpty(requiredBadDescription, nameof(requiredBadDescription));
                Argument.AssertNotNullOrEmpty(propertyWithSpecialDocs, nameof(propertyWithSpecialDocs));

                Thing spreadModel = new Thing(
                    name,
                    requiredUnion,
                    "accept",
                    requiredNullableString,
                    optionalNullableString,
                    123,
                    1.23F,
                    false,
                    optionalLiteralString,
                    requiredNullableLiteralString,
                    optionalLiteralInt,
                    optionalLiteralFloat,
                    optionalLiteralBool,
                    requiredBadDescription,
                    optionalNullableList?.ToList() as IList<int> ?? new ChangeTrackingList<int>(),
                    requiredNullableList?.ToList() as IList<int> ?? new ChangeTrackingList<int>(),
                    propertyWithSpecialDocs,
                    default);
                ClientResult result = AnonymousBody(spreadModel, cancellationToken.ToRequestOptions());
                return ClientResult.FromValue((Thing)result, result.GetRawResponse());
            }
            catch (Exception ex)
            {
                System.Console.WriteLine($"An exception was thrown in method AnonymousBody: {ex}");
                throw;
            }
            finally
            {
                System.Console.WriteLine("Exiting method AnonymousBody.");
            }
        }

        /// <summary> body parameter without body decorator. </summary>
        /// <param name="name"> name of the Thing. </param>
        /// <param name="requiredUnion"> required Union. </param>
        /// <param name="requiredNullableString"> required nullable string. </param>
        /// <param name="requiredNullableLiteralString"> required nullable literal string. </param>
        /// <param name="requiredBadDescription"> description with xml &lt;|endoftext|&gt;. </param>
        /// <param name="requiredNullableList"> required nullable collection. </param>
        /// <param name="propertyWithSpecialDocs">
        /// This tests:
        /// <list type="bullet"><item><description>Simple bullet point. This bullet point is going to be very long to test how text wrapping is handled in bullet points within documentation comments. It should properly indent the wrapped lines.</description></item><item><description>Another bullet point with <b>bold text</b>. This bullet point is also intentionally long to see how the formatting is preserved when the text wraps onto multiple lines in the generated documentation.</description></item><item><description>Third bullet point with <i>italic text</i>. Similar to the previous points, this one is extended to ensure that the wrapping and formatting are correctly applied in the output.</description></item><item><description>Complex bullet point with <b>bold</b> and <i>italic</i> combined. This bullet point combines both bold and italic formatting and is long enough to test the wrapping behavior in such cases.</description></item><item><description><b>Bold bullet point</b>: A bullet point that is entirely bolded. This point is also made lengthy to observe how the bold formatting is maintained across wrapped lines.</description></item><item><description><i>Italic bullet point</i>: A bullet point that is entirely italicized. This final point is extended to verify that italic formatting is correctly applied even when the text spans multiple lines.</description></item></list>
        /// </param>
        /// <param name="optionalNullableString"> required optional string. </param>
        /// <param name="optionalLiteralString"> optional literal string. </param>
        /// <param name="optionalLiteralInt"> optional literal int. </param>
        /// <param name="optionalLiteralFloat"> optional literal float. </param>
        /// <param name="optionalLiteralBool"> optional literal bool. </param>
        /// <param name="optionalNullableList"> optional nullable collection. </param>
        /// <param name="cancellationToken"> The cancellation token that can be used to cancel the operation. </param>
        /// <exception cref="ArgumentNullException"> <paramref name="name"/>, <paramref name="requiredUnion"/>, <paramref name="requiredBadDescription"/> or <paramref name="propertyWithSpecialDocs"/> is null. </exception>
        /// <exception cref="ArgumentException"> <paramref name="name"/>, <paramref name="requiredBadDescription"/> or <paramref name="propertyWithSpecialDocs"/> is an empty string, and was expected to be non-empty. </exception>
        /// <exception cref="ClientResultException"> Service returned a non-success status code. </exception>
        public virtual async Task<ClientResult<Thing>> AnonymousBodyAsync(string name, BinaryData requiredUnion, string requiredNullableString, ThingRequiredNullableLiteralString1? requiredNullableLiteralString, string requiredBadDescription, IEnumerable<int> requiredNullableList, string propertyWithSpecialDocs, string optionalNullableString = default, ThingOptionalLiteralString? optionalLiteralString = default, ThingOptionalLiteralInt? optionalLiteralInt = default, ThingOptionalLiteralFloat? optionalLiteralFloat = default, bool? optionalLiteralBool = default, IEnumerable<int> optionalNullableList = default, CancellationToken cancellationToken = default)
        {
            try
            {
                System.Console.WriteLine("Entering method AnonymousBodyAsync.");
                Argument.AssertNotNullOrEmpty(name, nameof(name));
                Argument.AssertNotNull(requiredUnion, nameof(requiredUnion));
                Argument.AssertNotNullOrEmpty(requiredBadDescription, nameof(requiredBadDescription));
                Argument.AssertNotNullOrEmpty(propertyWithSpecialDocs, nameof(propertyWithSpecialDocs));

                Thing spreadModel = new Thing(
                    name,
                    requiredUnion,
                    "accept",
                    requiredNullableString,
                    optionalNullableString,
                    123,
                    1.23F,
                    false,
                    optionalLiteralString,
                    requiredNullableLiteralString,
                    optionalLiteralInt,
                    optionalLiteralFloat,
                    optionalLiteralBool,
                    requiredBadDescription,
                    optionalNullableList?.ToList() as IList<int> ?? new ChangeTrackingList<int>(),
                    requiredNullableList?.ToList() as IList<int> ?? new ChangeTrackingList<int>(),
                    propertyWithSpecialDocs,
                    default);
                ClientResult result = await AnonymousBodyAsync(spreadModel, cancellationToken.ToRequestOptions()).ConfigureAwait(false);
                return ClientResult.FromValue((Thing)result, result.GetRawResponse());
            }
            catch (Exception ex)
            {
                System.Console.WriteLine($"An exception was thrown in method AnonymousBodyAsync: {ex}");
                throw;
            }
            finally
            {
                System.Console.WriteLine("Exiting method AnonymousBodyAsync.");
            }
        }

        /// <summary>
        /// [Protocol Method] Model can have its friendly name
        /// <list type="bullet">
        /// <item>
        /// <description> This <see href="https://aka.ms/azsdk/net/protocol-methods">protocol method</see> allows explicit creation of the request and processing of the response for advanced scenarios. </description>
        /// </item>
        /// </list>
        /// </summary>
        /// <param name="content"> The content to send as the body of the request. </param>
        /// <param name="options"> The request options, which can override default behaviors of the client pipeline on a per-call basis. </param>
        /// <exception cref="ArgumentNullException"> <paramref name="content"/> is null. </exception>
        /// <exception cref="ClientResultException"> Service returned a non-success status code. </exception>
        /// <returns> The response returned from the service. </returns>
        public virtual ClientResult FriendlyModel(BinaryContent content, RequestOptions options = null)
        {
            try
            {
                System.Console.WriteLine("Entering method FriendlyModel.");
                Argument.AssertNotNull(content, nameof(content));

                using PipelineMessage message = CreateFriendlyModelRequest(content, options);
                return ClientResult.FromResponse(Pipeline.ProcessMessage(message, options));
            }
            catch (Exception ex)
            {
                System.Console.WriteLine($"An exception was thrown in method FriendlyModel: {ex}");
                throw;
            }
            finally
            {
                System.Console.WriteLine("Exiting method FriendlyModel.");
            }
        }

        /// <summary>
        /// [Protocol Method] Model can have its friendly name
        /// <list type="bullet">
        /// <item>
        /// <description> This <see href="https://aka.ms/azsdk/net/protocol-methods">protocol method</see> allows explicit creation of the request and processing of the response for advanced scenarios. </description>
        /// </item>
        /// </list>
        /// </summary>
        /// <param name="content"> The content to send as the body of the request. </param>
        /// <param name="options"> The request options, which can override default behaviors of the client pipeline on a per-call basis. </param>
        /// <exception cref="ArgumentNullException"> <paramref name="content"/> is null. </exception>
        /// <exception cref="ClientResultException"> Service returned a non-success status code. </exception>
        /// <returns> The response returned from the service. </returns>
        public virtual async Task<ClientResult> FriendlyModelAsync(BinaryContent content, RequestOptions options = null)
        {
            try
            {
                System.Console.WriteLine("Entering method FriendlyModelAsync.");
                Argument.AssertNotNull(content, nameof(content));

                using PipelineMessage message = CreateFriendlyModelRequest(content, options);
                return ClientResult.FromResponse(await Pipeline.ProcessMessageAsync(message, options).ConfigureAwait(false));
            }
            catch (Exception ex)
            {
                System.Console.WriteLine($"An exception was thrown in method FriendlyModelAsync: {ex}");
                throw;
            }
            finally
            {
                System.Console.WriteLine("Exiting method FriendlyModelAsync.");
            }
        }

        /// <summary> Model can have its friendly name. </summary>
        /// <param name="name"> name of the NotFriend. </param>
        /// <param name="cancellationToken"> The cancellation token that can be used to cancel the operation. </param>
        /// <exception cref="ArgumentNullException"> <paramref name="name"/> is null. </exception>
        /// <exception cref="ArgumentException"> <paramref name="name"/> is an empty string, and was expected to be non-empty. </exception>
        /// <exception cref="ClientResultException"> Service returned a non-success status code. </exception>
        public virtual ClientResult<Friend> FriendlyModel(string name, CancellationToken cancellationToken = default)
        {
            try
            {
                System.Console.WriteLine("Entering method FriendlyModel.");
                Argument.AssertNotNullOrEmpty(name, nameof(name));

                Friend spreadModel = new Friend(name, default);
                ClientResult result = FriendlyModel(spreadModel, cancellationToken.ToRequestOptions());
                return ClientResult.FromValue((Friend)result, result.GetRawResponse());
            }
            catch (Exception ex)
            {
                System.Console.WriteLine($"An exception was thrown in method FriendlyModel: {ex}");
                throw;
            }
            finally
            {
                System.Console.WriteLine("Exiting method FriendlyModel.");
            }
        }

        /// <summary> Model can have its friendly name. </summary>
        /// <param name="name"> name of the NotFriend. </param>
        /// <param name="cancellationToken"> The cancellation token that can be used to cancel the operation. </param>
        /// <exception cref="ArgumentNullException"> <paramref name="name"/> is null. </exception>
        /// <exception cref="ArgumentException"> <paramref name="name"/> is an empty string, and was expected to be non-empty. </exception>
        /// <exception cref="ClientResultException"> Service returned a non-success status code. </exception>
        public virtual async Task<ClientResult<Friend>> FriendlyModelAsync(string name, CancellationToken cancellationToken = default)
        {
            try
            {
                System.Console.WriteLine("Entering method FriendlyModelAsync.");
                Argument.AssertNotNullOrEmpty(name, nameof(name));

                Friend spreadModel = new Friend(name, default);
                ClientResult result = await FriendlyModelAsync(spreadModel, cancellationToken.ToRequestOptions()).ConfigureAwait(false);
                return ClientResult.FromValue((Friend)result, result.GetRawResponse());
            }
            catch (Exception ex)
            {
                System.Console.WriteLine($"An exception was thrown in method FriendlyModelAsync: {ex}");
                throw;
            }
            finally
            {
                System.Console.WriteLine("Exiting method FriendlyModelAsync.");
            }
        }

        /// <summary>
        /// [Protocol Method] AddTimeHeader
        /// <list type="bullet">
        /// <item>
        /// <description> This <see href="https://aka.ms/azsdk/net/protocol-methods">protocol method</see> allows explicit creation of the request and processing of the response for advanced scenarios. </description>
        /// </item>
        /// </list>
        /// </summary>
        /// <param name="options"> The request options, which can override default behaviors of the client pipeline on a per-call basis. </param>
        /// <exception cref="ClientResultException"> Service returned a non-success status code. </exception>
        /// <returns> The response returned from the service. </returns>
        public virtual ClientResult AddTimeHeader(RequestOptions options)
        {
            try
            {
                System.Console.WriteLine("Entering method AddTimeHeader.");
                using PipelineMessage message = CreateAddTimeHeaderRequest(options);
                return ClientResult.FromResponse(Pipeline.ProcessMessage(message, options));
            }
            catch (Exception ex)
            {
                System.Console.WriteLine($"An exception was thrown in method AddTimeHeader: {ex}");
                throw;
            }
            finally
            {
                System.Console.WriteLine("Exiting method AddTimeHeader.");
            }
        }

        /// <summary>
        /// [Protocol Method] AddTimeHeader
        /// <list type="bullet">
        /// <item>
        /// <description> This <see href="https://aka.ms/azsdk/net/protocol-methods">protocol method</see> allows explicit creation of the request and processing of the response for advanced scenarios. </description>
        /// </item>
        /// </list>
        /// </summary>
        /// <param name="options"> The request options, which can override default behaviors of the client pipeline on a per-call basis. </param>
        /// <exception cref="ClientResultException"> Service returned a non-success status code. </exception>
        /// <returns> The response returned from the service. </returns>
        public virtual async Task<ClientResult> AddTimeHeaderAsync(RequestOptions options)
        {
            try
            {
                System.Console.WriteLine("Entering method AddTimeHeaderAsync.");
                using PipelineMessage message = CreateAddTimeHeaderRequest(options);
                return ClientResult.FromResponse(await Pipeline.ProcessMessageAsync(message, options).ConfigureAwait(false));
            }
            catch (Exception ex)
            {
                System.Console.WriteLine($"An exception was thrown in method AddTimeHeaderAsync: {ex}");
                throw;
            }
            finally
            {
                System.Console.WriteLine("Exiting method AddTimeHeaderAsync.");
            }
        }

        /// <summary> AddTimeHeader. </summary>
        /// <param name="cancellationToken"> The cancellation token that can be used to cancel the operation. </param>
        /// <exception cref="ClientResultException"> Service returned a non-success status code. </exception>
        public virtual ClientResult AddTimeHeader(CancellationToken cancellationToken = default)
        {
            try
            {
                System.Console.WriteLine("Entering method AddTimeHeader.");
                return AddTimeHeader(cancellationToken.ToRequestOptions());
            }
            catch (Exception ex)
            {
                System.Console.WriteLine($"An exception was thrown in method AddTimeHeader: {ex}");
                throw;
            }
            finally
            {
                System.Console.WriteLine("Exiting method AddTimeHeader.");
            }
        }

        /// <summary> AddTimeHeader. </summary>
        /// <param name="cancellationToken"> The cancellation token that can be used to cancel the operation. </param>
        /// <exception cref="ClientResultException"> Service returned a non-success status code. </exception>
        public virtual async Task<ClientResult> AddTimeHeaderAsync(CancellationToken cancellationToken = default)
        {
            try
            {
                System.Console.WriteLine("Entering method AddTimeHeaderAsync.");
                return await AddTimeHeaderAsync(cancellationToken.ToRequestOptions()).ConfigureAwait(false);
            }
            catch (Exception ex)
            {
                System.Console.WriteLine($"An exception was thrown in method AddTimeHeaderAsync: {ex}");
                throw;
            }
            finally
            {
                System.Console.WriteLine("Exiting method AddTimeHeaderAsync.");
            }
        }

        /// <summary>
        /// [Protocol Method] Model can have its projected name
        /// <list type="bullet">
        /// <item>
        /// <description> This <see href="https://aka.ms/azsdk/net/protocol-methods">protocol method</see> allows explicit creation of the request and processing of the response for advanced scenarios. </description>
        /// </item>
        /// </list>
        /// </summary>
        /// <param name="content"> The content to send as the body of the request. </param>
        /// <param name="options"> The request options, which can override default behaviors of the client pipeline on a per-call basis. </param>
        /// <exception cref="ArgumentNullException"> <paramref name="content"/> is null. </exception>
        /// <exception cref="ClientResultException"> Service returned a non-success status code. </exception>
        /// <returns> The response returned from the service. </returns>
        public virtual ClientResult ProjectedNameModel(BinaryContent content, RequestOptions options = null)
        {
            try
            {
                System.Console.WriteLine("Entering method ProjectedNameModel.");
                Argument.AssertNotNull(content, nameof(content));

                using PipelineMessage message = CreateProjectedNameModelRequest(content, options);
                return ClientResult.FromResponse(Pipeline.ProcessMessage(message, options));
            }
            catch (Exception ex)
            {
                System.Console.WriteLine($"An exception was thrown in method ProjectedNameModel: {ex}");
                throw;
            }
            finally
            {
                System.Console.WriteLine("Exiting method ProjectedNameModel.");
            }
        }

        /// <summary>
        /// [Protocol Method] Model can have its projected name
        /// <list type="bullet">
        /// <item>
        /// <description> This <see href="https://aka.ms/azsdk/net/protocol-methods">protocol method</see> allows explicit creation of the request and processing of the response for advanced scenarios. </description>
        /// </item>
        /// </list>
        /// </summary>
        /// <param name="content"> The content to send as the body of the request. </param>
        /// <param name="options"> The request options, which can override default behaviors of the client pipeline on a per-call basis. </param>
        /// <exception cref="ArgumentNullException"> <paramref name="content"/> is null. </exception>
        /// <exception cref="ClientResultException"> Service returned a non-success status code. </exception>
        /// <returns> The response returned from the service. </returns>
        public virtual async Task<ClientResult> ProjectedNameModelAsync(BinaryContent content, RequestOptions options = null)
        {
            try
            {
                System.Console.WriteLine("Entering method ProjectedNameModelAsync.");
                Argument.AssertNotNull(content, nameof(content));

                using PipelineMessage message = CreateProjectedNameModelRequest(content, options);
                return ClientResult.FromResponse(await Pipeline.ProcessMessageAsync(message, options).ConfigureAwait(false));
            }
            catch (Exception ex)
            {
                System.Console.WriteLine($"An exception was thrown in method ProjectedNameModelAsync: {ex}");
                throw;
            }
            finally
            {
                System.Console.WriteLine("Exiting method ProjectedNameModelAsync.");
            }
        }

        /// <summary> Model can have its projected name. </summary>
        /// <param name="otherName"> name of the ModelWithClientName. </param>
        /// <param name="cancellationToken"> The cancellation token that can be used to cancel the operation. </param>
        /// <exception cref="ArgumentNullException"> <paramref name="otherName"/> is null. </exception>
        /// <exception cref="ArgumentException"> <paramref name="otherName"/> is an empty string, and was expected to be non-empty. </exception>
        /// <exception cref="ClientResultException"> Service returned a non-success status code. </exception>
        public virtual ClientResult<RenamedModel> ProjectedNameModel(string otherName, CancellationToken cancellationToken = default)
        {
            try
            {
                System.Console.WriteLine("Entering method ProjectedNameModel.");
                Argument.AssertNotNullOrEmpty(otherName, nameof(otherName));

                RenamedModel spreadModel = new RenamedModel(otherName, default);
                ClientResult result = ProjectedNameModel(spreadModel, cancellationToken.ToRequestOptions());
                return ClientResult.FromValue((RenamedModel)result, result.GetRawResponse());
            }
            catch (Exception ex)
            {
                System.Console.WriteLine($"An exception was thrown in method ProjectedNameModel: {ex}");
                throw;
            }
            finally
            {
                System.Console.WriteLine("Exiting method ProjectedNameModel.");
            }
        }

        /// <summary> Model can have its projected name. </summary>
        /// <param name="otherName"> name of the ModelWithClientName. </param>
        /// <param name="cancellationToken"> The cancellation token that can be used to cancel the operation. </param>
        /// <exception cref="ArgumentNullException"> <paramref name="otherName"/> is null. </exception>
        /// <exception cref="ArgumentException"> <paramref name="otherName"/> is an empty string, and was expected to be non-empty. </exception>
        /// <exception cref="ClientResultException"> Service returned a non-success status code. </exception>
        public virtual async Task<ClientResult<RenamedModel>> ProjectedNameModelAsync(string otherName, CancellationToken cancellationToken = default)
        {
            try
            {
                System.Console.WriteLine("Entering method ProjectedNameModelAsync.");
                Argument.AssertNotNullOrEmpty(otherName, nameof(otherName));

                RenamedModel spreadModel = new RenamedModel(otherName, default);
                ClientResult result = await ProjectedNameModelAsync(spreadModel, cancellationToken.ToRequestOptions()).ConfigureAwait(false);
                return ClientResult.FromValue((RenamedModel)result, result.GetRawResponse());
            }
            catch (Exception ex)
            {
                System.Console.WriteLine($"An exception was thrown in method ProjectedNameModelAsync: {ex}");
                throw;
            }
            finally
            {
                System.Console.WriteLine("Exiting method ProjectedNameModelAsync.");
            }
        }

        /// <summary>
        /// [Protocol Method] return anonymous model
        /// <list type="bullet">
        /// <item>
        /// <description> This <see href="https://aka.ms/azsdk/net/protocol-methods">protocol method</see> allows explicit creation of the request and processing of the response for advanced scenarios. </description>
        /// </item>
        /// </list>
        /// </summary>
        /// <param name="options"> The request options, which can override default behaviors of the client pipeline on a per-call basis. </param>
        /// <exception cref="ClientResultException"> Service returned a non-success status code. </exception>
        /// <returns> The response returned from the service. </returns>
        public virtual ClientResult ReturnsAnonymousModel(RequestOptions options)
        {
            try
            {
                System.Console.WriteLine("Entering method ReturnsAnonymousModel.");
                using PipelineMessage message = CreateReturnsAnonymousModelRequest(options);
                return ClientResult.FromResponse(Pipeline.ProcessMessage(message, options));
            }
            catch (Exception ex)
            {
                System.Console.WriteLine($"An exception was thrown in method ReturnsAnonymousModel: {ex}");
                throw;
            }
            finally
            {
                System.Console.WriteLine("Exiting method ReturnsAnonymousModel.");
            }
        }

        /// <summary>
        /// [Protocol Method] return anonymous model
        /// <list type="bullet">
        /// <item>
        /// <description> This <see href="https://aka.ms/azsdk/net/protocol-methods">protocol method</see> allows explicit creation of the request and processing of the response for advanced scenarios. </description>
        /// </item>
        /// </list>
        /// </summary>
        /// <param name="options"> The request options, which can override default behaviors of the client pipeline on a per-call basis. </param>
        /// <exception cref="ClientResultException"> Service returned a non-success status code. </exception>
        /// <returns> The response returned from the service. </returns>
        public virtual async Task<ClientResult> ReturnsAnonymousModelAsync(RequestOptions options)
        {
            try
            {
                System.Console.WriteLine("Entering method ReturnsAnonymousModelAsync.");
                using PipelineMessage message = CreateReturnsAnonymousModelRequest(options);
                return ClientResult.FromResponse(await Pipeline.ProcessMessageAsync(message, options).ConfigureAwait(false));
            }
            catch (Exception ex)
            {
                System.Console.WriteLine($"An exception was thrown in method ReturnsAnonymousModelAsync: {ex}");
                throw;
            }
            finally
            {
                System.Console.WriteLine("Exiting method ReturnsAnonymousModelAsync.");
            }
        }

        /// <summary> return anonymous model. </summary>
        /// <param name="cancellationToken"> The cancellation token that can be used to cancel the operation. </param>
        /// <exception cref="ClientResultException"> Service returned a non-success status code. </exception>
        public virtual ClientResult<ReturnsAnonymousModelResponse> ReturnsAnonymousModel(CancellationToken cancellationToken = default)
        {
            try
            {
                System.Console.WriteLine("Entering method ReturnsAnonymousModel.");
                ClientResult result = ReturnsAnonymousModel(cancellationToken.ToRequestOptions());
                return ClientResult.FromValue((ReturnsAnonymousModelResponse)result, result.GetRawResponse());
            }
            catch (Exception ex)
            {
                System.Console.WriteLine($"An exception was thrown in method ReturnsAnonymousModel: {ex}");
                throw;
            }
            finally
            {
                System.Console.WriteLine("Exiting method ReturnsAnonymousModel.");
            }
        }

        /// <summary> return anonymous model. </summary>
        /// <param name="cancellationToken"> The cancellation token that can be used to cancel the operation. </param>
        /// <exception cref="ClientResultException"> Service returned a non-success status code. </exception>
        public virtual async Task<ClientResult<ReturnsAnonymousModelResponse>> ReturnsAnonymousModelAsync(CancellationToken cancellationToken = default)
        {
            try
            {
                System.Console.WriteLine("Entering method ReturnsAnonymousModelAsync.");
                ClientResult result = await ReturnsAnonymousModelAsync(cancellationToken.ToRequestOptions()).ConfigureAwait(false);
                return ClientResult.FromValue((ReturnsAnonymousModelResponse)result, result.GetRawResponse());
            }
            catch (Exception ex)
            {
                System.Console.WriteLine($"An exception was thrown in method ReturnsAnonymousModelAsync: {ex}");
                throw;
            }
            finally
            {
                System.Console.WriteLine("Exiting method ReturnsAnonymousModelAsync.");
            }
        }

        /// <summary>
        /// [Protocol Method] get extensible enum
        /// <list type="bullet">
        /// <item>
        /// <description> This <see href="https://aka.ms/azsdk/net/protocol-methods">protocol method</see> allows explicit creation of the request and processing of the response for advanced scenarios. </description>
        /// </item>
        /// </list>
        /// </summary>
        /// <param name="accept"></param>
        /// <param name="options"> The request options, which can override default behaviors of the client pipeline on a per-call basis. </param>
        /// <exception cref="ArgumentNullException"> <paramref name="accept"/> is null. </exception>
        /// <exception cref="ArgumentException"> <paramref name="accept"/> is an empty string, and was expected to be non-empty. </exception>
        /// <exception cref="ClientResultException"> Service returned a non-success status code. </exception>
        /// <returns> The response returned from the service. </returns>
        public virtual ClientResult GetUnknownValue(string accept, RequestOptions options)
        {
            try
            {
                System.Console.WriteLine("Entering method GetUnknownValue.");
                Argument.AssertNotNullOrEmpty(accept, nameof(accept));

                using PipelineMessage message = CreateGetUnknownValueRequest(accept, options);
                return ClientResult.FromResponse(Pipeline.ProcessMessage(message, options));
            }
            catch (Exception ex)
            {
                System.Console.WriteLine($"An exception was thrown in method GetUnknownValue: {ex}");
                throw;
            }
            finally
            {
                System.Console.WriteLine("Exiting method GetUnknownValue.");
            }
        }

        /// <summary>
        /// [Protocol Method] get extensible enum
        /// <list type="bullet">
        /// <item>
        /// <description> This <see href="https://aka.ms/azsdk/net/protocol-methods">protocol method</see> allows explicit creation of the request and processing of the response for advanced scenarios. </description>
        /// </item>
        /// </list>
        /// </summary>
        /// <param name="accept"></param>
        /// <param name="options"> The request options, which can override default behaviors of the client pipeline on a per-call basis. </param>
        /// <exception cref="ArgumentNullException"> <paramref name="accept"/> is null. </exception>
        /// <exception cref="ArgumentException"> <paramref name="accept"/> is an empty string, and was expected to be non-empty. </exception>
        /// <exception cref="ClientResultException"> Service returned a non-success status code. </exception>
        /// <returns> The response returned from the service. </returns>
        public virtual async Task<ClientResult> GetUnknownValueAsync(string accept, RequestOptions options)
        {
            try
            {
                System.Console.WriteLine("Entering method GetUnknownValueAsync.");
                Argument.AssertNotNullOrEmpty(accept, nameof(accept));

                using PipelineMessage message = CreateGetUnknownValueRequest(accept, options);
                return ClientResult.FromResponse(await Pipeline.ProcessMessageAsync(message, options).ConfigureAwait(false));
            }
            catch (Exception ex)
            {
                System.Console.WriteLine($"An exception was thrown in method GetUnknownValueAsync: {ex}");
                throw;
            }
            finally
            {
                System.Console.WriteLine("Exiting method GetUnknownValueAsync.");
            }
        }

        /// <summary> get extensible enum. </summary>
        /// <param name="accept"></param>
        /// <param name="cancellationToken"> The cancellation token that can be used to cancel the operation. </param>
        /// <exception cref="ArgumentNullException"> <paramref name="accept"/> is null. </exception>
        /// <exception cref="ArgumentException"> <paramref name="accept"/> is an empty string, and was expected to be non-empty. </exception>
        /// <exception cref="ClientResultException"> Service returned a non-success status code. </exception>
        public virtual ClientResult<string> GetUnknownValue(string accept, CancellationToken cancellationToken = default)
        {
            try
            {
                System.Console.WriteLine("Entering method GetUnknownValue.");
                Argument.AssertNotNullOrEmpty(accept, nameof(accept));

                ClientResult result = GetUnknownValue(accept, cancellationToken.ToRequestOptions());
                return ClientResult.FromValue(result.GetRawResponse().Content.ToString(), result.GetRawResponse());
            }
            catch (Exception ex)
            {
                System.Console.WriteLine($"An exception was thrown in method GetUnknownValue: {ex}");
                throw;
            }
            finally
            {
                System.Console.WriteLine("Exiting method GetUnknownValue.");
            }
        }

        /// <summary> get extensible enum. </summary>
        /// <param name="accept"></param>
        /// <param name="cancellationToken"> The cancellation token that can be used to cancel the operation. </param>
        /// <exception cref="ArgumentNullException"> <paramref name="accept"/> is null. </exception>
        /// <exception cref="ArgumentException"> <paramref name="accept"/> is an empty string, and was expected to be non-empty. </exception>
        /// <exception cref="ClientResultException"> Service returned a non-success status code. </exception>
        public virtual async Task<ClientResult<string>> GetUnknownValueAsync(string accept, CancellationToken cancellationToken = default)
        {
            try
            {
                System.Console.WriteLine("Entering method GetUnknownValueAsync.");
                Argument.AssertNotNullOrEmpty(accept, nameof(accept));

                ClientResult result = await GetUnknownValueAsync(accept, cancellationToken.ToRequestOptions()).ConfigureAwait(false);
                return ClientResult.FromValue(result.GetRawResponse().Content.ToString(), result.GetRawResponse());
            }
            catch (Exception ex)
            {
                System.Console.WriteLine($"An exception was thrown in method GetUnknownValueAsync: {ex}");
                throw;
            }
            finally
            {
                System.Console.WriteLine("Exiting method GetUnknownValueAsync.");
            }
        }

        /// <summary>
        /// [Protocol Method] When set protocol false and convenient true, then the protocol method should be internal
        /// <list type="bullet">
        /// <item>
        /// <description> This <see href="https://aka.ms/azsdk/net/protocol-methods">protocol method</see> allows explicit creation of the request and processing of the response for advanced scenarios. </description>
        /// </item>
        /// </list>
        /// </summary>
        /// <param name="content"> The content to send as the body of the request. </param>
        /// <param name="options"> The request options, which can override default behaviors of the client pipeline on a per-call basis. </param>
        /// <exception cref="ArgumentNullException"> <paramref name="content"/> is null. </exception>
        /// <exception cref="ClientResultException"> Service returned a non-success status code. </exception>
        /// <returns> The response returned from the service. </returns>
        public virtual ClientResult InternalProtocol(BinaryContent content, RequestOptions options = null)
        {
            try
            {
                System.Console.WriteLine("Entering method InternalProtocol.");
                Argument.AssertNotNull(content, nameof(content));

                using PipelineMessage message = CreateInternalProtocolRequest(content, options);
                return ClientResult.FromResponse(Pipeline.ProcessMessage(message, options));
            }
            catch (Exception ex)
            {
                System.Console.WriteLine($"An exception was thrown in method InternalProtocol: {ex}");
                throw;
            }
            finally
            {
                System.Console.WriteLine("Exiting method InternalProtocol.");
            }
        }

        /// <summary>
        /// [Protocol Method] When set protocol false and convenient true, then the protocol method should be internal
        /// <list type="bullet">
        /// <item>
        /// <description> This <see href="https://aka.ms/azsdk/net/protocol-methods">protocol method</see> allows explicit creation of the request and processing of the response for advanced scenarios. </description>
        /// </item>
        /// </list>
        /// </summary>
        /// <param name="content"> The content to send as the body of the request. </param>
        /// <param name="options"> The request options, which can override default behaviors of the client pipeline on a per-call basis. </param>
        /// <exception cref="ArgumentNullException"> <paramref name="content"/> is null. </exception>
        /// <exception cref="ClientResultException"> Service returned a non-success status code. </exception>
        /// <returns> The response returned from the service. </returns>
        public virtual async Task<ClientResult> InternalProtocolAsync(BinaryContent content, RequestOptions options = null)
        {
            try
            {
                System.Console.WriteLine("Entering method InternalProtocolAsync.");
                Argument.AssertNotNull(content, nameof(content));

                using PipelineMessage message = CreateInternalProtocolRequest(content, options);
                return ClientResult.FromResponse(await Pipeline.ProcessMessageAsync(message, options).ConfigureAwait(false));
            }
            catch (Exception ex)
            {
                System.Console.WriteLine($"An exception was thrown in method InternalProtocolAsync: {ex}");
                throw;
            }
            finally
            {
                System.Console.WriteLine("Exiting method InternalProtocolAsync.");
            }
        }

        /// <summary> When set protocol false and convenient true, then the protocol method should be internal. </summary>
        /// <param name="body"></param>
        /// <param name="cancellationToken"> The cancellation token that can be used to cancel the operation. </param>
        /// <exception cref="ArgumentNullException"> <paramref name="body"/> is null. </exception>
        /// <exception cref="ClientResultException"> Service returned a non-success status code. </exception>
        public virtual ClientResult<Thing> InternalProtocol(Thing body, CancellationToken cancellationToken = default)
        {
            try
            {
                System.Console.WriteLine("Entering method InternalProtocol.");
                Argument.AssertNotNull(body, nameof(body));

                ClientResult result = InternalProtocol(body, cancellationToken.ToRequestOptions());
                return ClientResult.FromValue((Thing)result, result.GetRawResponse());
            }
            catch (Exception ex)
            {
                System.Console.WriteLine($"An exception was thrown in method InternalProtocol: {ex}");
                throw;
            }
            finally
            {
                System.Console.WriteLine("Exiting method InternalProtocol.");
            }
        }

        /// <summary> When set protocol false and convenient true, then the protocol method should be internal. </summary>
        /// <param name="body"></param>
        /// <param name="cancellationToken"> The cancellation token that can be used to cancel the operation. </param>
        /// <exception cref="ArgumentNullException"> <paramref name="body"/> is null. </exception>
        /// <exception cref="ClientResultException"> Service returned a non-success status code. </exception>
        public virtual async Task<ClientResult<Thing>> InternalProtocolAsync(Thing body, CancellationToken cancellationToken = default)
        {
            try
            {
                System.Console.WriteLine("Entering method InternalProtocolAsync.");
                Argument.AssertNotNull(body, nameof(body));

                ClientResult result = await InternalProtocolAsync(body, cancellationToken.ToRequestOptions()).ConfigureAwait(false);
                return ClientResult.FromValue((Thing)result, result.GetRawResponse());
            }
            catch (Exception ex)
            {
                System.Console.WriteLine($"An exception was thrown in method InternalProtocolAsync: {ex}");
                throw;
            }
            finally
            {
                System.Console.WriteLine("Exiting method InternalProtocolAsync.");
            }
        }

        /// <summary>
        /// [Protocol Method] When set protocol false and convenient true, the convenient method should be generated even it has the same signature as protocol one
        /// <list type="bullet">
        /// <item>
        /// <description> This <see href="https://aka.ms/azsdk/net/protocol-methods">protocol method</see> allows explicit creation of the request and processing of the response for advanced scenarios. </description>
        /// </item>
        /// </list>
        /// </summary>
        /// <param name="options"> The request options, which can override default behaviors of the client pipeline on a per-call basis. </param>
        /// <exception cref="ClientResultException"> Service returned a non-success status code. </exception>
        /// <returns> The response returned from the service. </returns>
        public virtual ClientResult StillConvenient(RequestOptions options)
        {
            try
            {
                System.Console.WriteLine("Entering method StillConvenient.");
                using PipelineMessage message = CreateStillConvenientRequest(options);
                return ClientResult.FromResponse(Pipeline.ProcessMessage(message, options));
            }
            catch (Exception ex)
            {
                System.Console.WriteLine($"An exception was thrown in method StillConvenient: {ex}");
                throw;
            }
            finally
            {
                System.Console.WriteLine("Exiting method StillConvenient.");
            }
        }

        /// <summary>
        /// [Protocol Method] When set protocol false and convenient true, the convenient method should be generated even it has the same signature as protocol one
        /// <list type="bullet">
        /// <item>
        /// <description> This <see href="https://aka.ms/azsdk/net/protocol-methods">protocol method</see> allows explicit creation of the request and processing of the response for advanced scenarios. </description>
        /// </item>
        /// </list>
        /// </summary>
        /// <param name="options"> The request options, which can override default behaviors of the client pipeline on a per-call basis. </param>
        /// <exception cref="ClientResultException"> Service returned a non-success status code. </exception>
        /// <returns> The response returned from the service. </returns>
        public virtual async Task<ClientResult> StillConvenientAsync(RequestOptions options)
        {
            try
            {
                System.Console.WriteLine("Entering method StillConvenientAsync.");
                using PipelineMessage message = CreateStillConvenientRequest(options);
                return ClientResult.FromResponse(await Pipeline.ProcessMessageAsync(message, options).ConfigureAwait(false));
            }
            catch (Exception ex)
            {
                System.Console.WriteLine($"An exception was thrown in method StillConvenientAsync: {ex}");
                throw;
            }
            finally
            {
                System.Console.WriteLine("Exiting method StillConvenientAsync.");
            }
        }

        /// <summary> When set protocol false and convenient true, the convenient method should be generated even it has the same signature as protocol one. </summary>
        /// <param name="cancellationToken"> The cancellation token that can be used to cancel the operation. </param>
        /// <exception cref="ClientResultException"> Service returned a non-success status code. </exception>
        public virtual ClientResult StillConvenient(CancellationToken cancellationToken = default)
        {
            try
            {
                System.Console.WriteLine("Entering method StillConvenient.");
                return StillConvenient(cancellationToken.ToRequestOptions());
            }
            catch (Exception ex)
            {
                System.Console.WriteLine($"An exception was thrown in method StillConvenient: {ex}");
                throw;
            }
            finally
            {
                System.Console.WriteLine("Exiting method StillConvenient.");
            }
        }

        /// <summary> When set protocol false and convenient true, the convenient method should be generated even it has the same signature as protocol one. </summary>
        /// <param name="cancellationToken"> The cancellation token that can be used to cancel the operation. </param>
        /// <exception cref="ClientResultException"> Service returned a non-success status code. </exception>
        public virtual async Task<ClientResult> StillConvenientAsync(CancellationToken cancellationToken = default)
        {
            try
            {
                System.Console.WriteLine("Entering method StillConvenientAsync.");
                return await StillConvenientAsync(cancellationToken.ToRequestOptions()).ConfigureAwait(false);
            }
            catch (Exception ex)
            {
                System.Console.WriteLine($"An exception was thrown in method StillConvenientAsync: {ex}");
                throw;
            }
            finally
            {
                System.Console.WriteLine("Exiting method StillConvenientAsync.");
            }
        }

        /// <summary>
        /// [Protocol Method] head as boolean.
        /// <list type="bullet">
        /// <item>
        /// <description> This <see href="https://aka.ms/azsdk/net/protocol-methods">protocol method</see> allows explicit creation of the request and processing of the response for advanced scenarios. </description>
        /// </item>
        /// </list>
        /// </summary>
        /// <param name="id"></param>
        /// <param name="options"> The request options, which can override default behaviors of the client pipeline on a per-call basis. </param>
        /// <exception cref="ArgumentNullException"> <paramref name="id"/> is null. </exception>
        /// <exception cref="ArgumentException"> <paramref name="id"/> is an empty string, and was expected to be non-empty. </exception>
        /// <exception cref="ClientResultException"> Service returned a non-success status code. </exception>
        /// <returns> The response returned from the service. </returns>
        public virtual ClientResult HeadAsBoolean(string id, RequestOptions options)
        {
            try
            {
                System.Console.WriteLine("Entering method HeadAsBoolean.");
                Argument.AssertNotNullOrEmpty(id, nameof(id));

                using PipelineMessage message = CreateHeadAsBooleanRequest(id, options);
                return ClientResult.FromResponse(Pipeline.ProcessMessage(message, options));
            }
            catch (Exception ex)
            {
                System.Console.WriteLine($"An exception was thrown in method HeadAsBoolean: {ex}");
                throw;
            }
            finally
            {
                System.Console.WriteLine("Exiting method HeadAsBoolean.");
            }
        }

        /// <summary>
        /// [Protocol Method] head as boolean.
        /// <list type="bullet">
        /// <item>
        /// <description> This <see href="https://aka.ms/azsdk/net/protocol-methods">protocol method</see> allows explicit creation of the request and processing of the response for advanced scenarios. </description>
        /// </item>
        /// </list>
        /// </summary>
        /// <param name="id"></param>
        /// <param name="options"> The request options, which can override default behaviors of the client pipeline on a per-call basis. </param>
        /// <exception cref="ArgumentNullException"> <paramref name="id"/> is null. </exception>
        /// <exception cref="ArgumentException"> <paramref name="id"/> is an empty string, and was expected to be non-empty. </exception>
        /// <exception cref="ClientResultException"> Service returned a non-success status code. </exception>
        /// <returns> The response returned from the service. </returns>
        public virtual async Task<ClientResult> HeadAsBooleanAsync(string id, RequestOptions options)
        {
            try
            {
                System.Console.WriteLine("Entering method HeadAsBooleanAsync.");
                Argument.AssertNotNullOrEmpty(id, nameof(id));

                using PipelineMessage message = CreateHeadAsBooleanRequest(id, options);
                return ClientResult.FromResponse(await Pipeline.ProcessMessageAsync(message, options).ConfigureAwait(false));
            }
            catch (Exception ex)
            {
                System.Console.WriteLine($"An exception was thrown in method HeadAsBooleanAsync: {ex}");
                throw;
            }
            finally
            {
                System.Console.WriteLine("Exiting method HeadAsBooleanAsync.");
            }
        }

        /// <summary> head as boolean. </summary>
        /// <param name="id"></param>
        /// <param name="cancellationToken"> The cancellation token that can be used to cancel the operation. </param>
        /// <exception cref="ArgumentNullException"> <paramref name="id"/> is null. </exception>
        /// <exception cref="ArgumentException"> <paramref name="id"/> is an empty string, and was expected to be non-empty. </exception>
        /// <exception cref="ClientResultException"> Service returned a non-success status code. </exception>
        public virtual ClientResult HeadAsBoolean(string id, CancellationToken cancellationToken = default)
        {
            try
            {
                System.Console.WriteLine("Entering method HeadAsBoolean.");
                Argument.AssertNotNullOrEmpty(id, nameof(id));

                return HeadAsBoolean(id, cancellationToken.ToRequestOptions());
            }
            catch (Exception ex)
            {
                System.Console.WriteLine($"An exception was thrown in method HeadAsBoolean: {ex}");
                throw;
            }
            finally
            {
                System.Console.WriteLine("Exiting method HeadAsBoolean.");
            }
        }

        /// <summary> head as boolean. </summary>
        /// <param name="id"></param>
        /// <param name="cancellationToken"> The cancellation token that can be used to cancel the operation. </param>
        /// <exception cref="ArgumentNullException"> <paramref name="id"/> is null. </exception>
        /// <exception cref="ArgumentException"> <paramref name="id"/> is an empty string, and was expected to be non-empty. </exception>
        /// <exception cref="ClientResultException"> Service returned a non-success status code. </exception>
        public virtual async Task<ClientResult> HeadAsBooleanAsync(string id, CancellationToken cancellationToken = default)
        {
            try
            {
                System.Console.WriteLine("Entering method HeadAsBooleanAsync.");
                Argument.AssertNotNullOrEmpty(id, nameof(id));

                return await HeadAsBooleanAsync(id, cancellationToken.ToRequestOptions()).ConfigureAwait(false);
            }
            catch (Exception ex)
            {
                System.Console.WriteLine($"An exception was thrown in method HeadAsBooleanAsync: {ex}");
                throw;
            }
            finally
            {
                System.Console.WriteLine("Exiting method HeadAsBooleanAsync.");
            }
        }

        /// <summary>
        /// [Protocol Method] Return hi again
        /// <list type="bullet">
        /// <item>
        /// <description> This <see href="https://aka.ms/azsdk/net/protocol-methods">protocol method</see> allows explicit creation of the request and processing of the response for advanced scenarios. </description>
        /// </item>
        /// </list>
        /// </summary>
        /// <param name="p1"></param>
        /// <param name="options"> The request options, which can override default behaviors of the client pipeline on a per-call basis. </param>
        /// <exception cref="ArgumentNullException"> <paramref name="p1"/> is null. </exception>
        /// <exception cref="ArgumentException"> <paramref name="p1"/> is an empty string, and was expected to be non-empty. </exception>
        /// <exception cref="ClientResultException"> Service returned a non-success status code. </exception>
        /// <returns> The response returned from the service. </returns>
        public virtual ClientResult WithApiVersion(string p1, RequestOptions options)
        {
            try
            {
                System.Console.WriteLine("Entering method WithApiVersion.");
                Argument.AssertNotNullOrEmpty(p1, nameof(p1));

                using PipelineMessage message = CreateWithApiVersionRequest(p1, options);
                return ClientResult.FromResponse(Pipeline.ProcessMessage(message, options));
            }
            catch (Exception ex)
            {
                System.Console.WriteLine($"An exception was thrown in method WithApiVersion: {ex}");
                throw;
            }
            finally
            {
                System.Console.WriteLine("Exiting method WithApiVersion.");
            }
        }

        /// <summary>
        /// [Protocol Method] Return hi again
        /// <list type="bullet">
        /// <item>
        /// <description> This <see href="https://aka.ms/azsdk/net/protocol-methods">protocol method</see> allows explicit creation of the request and processing of the response for advanced scenarios. </description>
        /// </item>
        /// </list>
        /// </summary>
        /// <param name="p1"></param>
        /// <param name="options"> The request options, which can override default behaviors of the client pipeline on a per-call basis. </param>
        /// <exception cref="ArgumentNullException"> <paramref name="p1"/> is null. </exception>
        /// <exception cref="ArgumentException"> <paramref name="p1"/> is an empty string, and was expected to be non-empty. </exception>
        /// <exception cref="ClientResultException"> Service returned a non-success status code. </exception>
        /// <returns> The response returned from the service. </returns>
        public virtual async Task<ClientResult> WithApiVersionAsync(string p1, RequestOptions options)
        {
            try
            {
                System.Console.WriteLine("Entering method WithApiVersionAsync.");
                Argument.AssertNotNullOrEmpty(p1, nameof(p1));

                using PipelineMessage message = CreateWithApiVersionRequest(p1, options);
                return ClientResult.FromResponse(await Pipeline.ProcessMessageAsync(message, options).ConfigureAwait(false));
            }
            catch (Exception ex)
            {
                System.Console.WriteLine($"An exception was thrown in method WithApiVersionAsync: {ex}");
                throw;
            }
            finally
            {
                System.Console.WriteLine("Exiting method WithApiVersionAsync.");
            }
        }

        /// <summary> Return hi again. </summary>
        /// <param name="p1"></param>
        /// <param name="cancellationToken"> The cancellation token that can be used to cancel the operation. </param>
        /// <exception cref="ArgumentNullException"> <paramref name="p1"/> is null. </exception>
        /// <exception cref="ArgumentException"> <paramref name="p1"/> is an empty string, and was expected to be non-empty. </exception>
        /// <exception cref="ClientResultException"> Service returned a non-success status code. </exception>
        public virtual ClientResult WithApiVersion(string p1, CancellationToken cancellationToken = default)
        {
            try
            {
                System.Console.WriteLine("Entering method WithApiVersion.");
                Argument.AssertNotNullOrEmpty(p1, nameof(p1));

                return WithApiVersion(p1, cancellationToken.ToRequestOptions());
            }
            catch (Exception ex)
            {
                System.Console.WriteLine($"An exception was thrown in method WithApiVersion: {ex}");
                throw;
            }
            finally
            {
                System.Console.WriteLine("Exiting method WithApiVersion.");
            }
        }

        /// <summary> Return hi again. </summary>
        /// <param name="p1"></param>
        /// <param name="cancellationToken"> The cancellation token that can be used to cancel the operation. </param>
        /// <exception cref="ArgumentNullException"> <paramref name="p1"/> is null. </exception>
        /// <exception cref="ArgumentException"> <paramref name="p1"/> is an empty string, and was expected to be non-empty. </exception>
        /// <exception cref="ClientResultException"> Service returned a non-success status code. </exception>
        public virtual async Task<ClientResult> WithApiVersionAsync(string p1, CancellationToken cancellationToken = default)
        {
            try
            {
                System.Console.WriteLine("Entering method WithApiVersionAsync.");
                Argument.AssertNotNullOrEmpty(p1, nameof(p1));

                return await WithApiVersionAsync(p1, cancellationToken.ToRequestOptions()).ConfigureAwait(false);
            }
            catch (Exception ex)
            {
                System.Console.WriteLine($"An exception was thrown in method WithApiVersionAsync: {ex}");
                throw;
            }
            finally
            {
                System.Console.WriteLine("Exiting method WithApiVersionAsync.");
            }
        }

        /// <summary>
        /// [Protocol Method] List things with nextlink
        /// <list type="bullet">
        /// <item>
        /// <description> This <see href="https://aka.ms/azsdk/net/protocol-methods">protocol method</see> allows explicit creation of the request and processing of the response for advanced scenarios. </description>
        /// </item>
        /// </list>
        /// </summary>
        /// <param name="options"> The request options, which can override default behaviors of the client pipeline on a per-call basis. </param>
        /// <exception cref="ClientResultException"> Service returned a non-success status code. </exception>
        /// <returns> The response returned from the service. </returns>
        public virtual CollectionResult GetWithNextLink(RequestOptions options)
        {
            try
            {
                System.Console.WriteLine("Entering method GetWithNextLink.");
                return new SampleTypeSpecClientGetWithNextLinkCollectionResult(this, options);
            }
            catch (Exception ex)
            {
                System.Console.WriteLine($"An exception was thrown in method GetWithNextLink: {ex}");
                throw;
            }
            finally
            {
                System.Console.WriteLine("Exiting method GetWithNextLink.");
            }
        }

        /// <summary>
        /// [Protocol Method] List things with nextlink
        /// <list type="bullet">
        /// <item>
        /// <description> This <see href="https://aka.ms/azsdk/net/protocol-methods">protocol method</see> allows explicit creation of the request and processing of the response for advanced scenarios. </description>
        /// </item>
        /// </list>
        /// </summary>
        /// <param name="options"> The request options, which can override default behaviors of the client pipeline on a per-call basis. </param>
        /// <exception cref="ClientResultException"> Service returned a non-success status code. </exception>
        /// <returns> The response returned from the service. </returns>
        public virtual AsyncCollectionResult GetWithNextLinkAsync(RequestOptions options)
        {
            try
            {
                System.Console.WriteLine("Entering method GetWithNextLinkAsync.");
                return new SampleTypeSpecClientGetWithNextLinkAsyncCollectionResult(this, options);
            }
            catch (Exception ex)
            {
                System.Console.WriteLine($"An exception was thrown in method GetWithNextLinkAsync: {ex}");
                throw;
            }
            finally
            {
                System.Console.WriteLine("Exiting method GetWithNextLinkAsync.");
            }
        }

        /// <summary> List things with nextlink. </summary>
        /// <param name="cancellationToken"> The cancellation token that can be used to cancel the operation. </param>
        /// <exception cref="ClientResultException"> Service returned a non-success status code. </exception>
        public virtual CollectionResult<Thing> GetWithNextLink(CancellationToken cancellationToken = default)
        {
            try
            {
                System.Console.WriteLine("Entering method GetWithNextLink.");
                return new SampleTypeSpecClientGetWithNextLinkCollectionResultOfT(this, cancellationToken.ToRequestOptions());
            }
            catch (Exception ex)
            {
                System.Console.WriteLine($"An exception was thrown in method GetWithNextLink: {ex}");
                throw;
            }
            finally
            {
                System.Console.WriteLine("Exiting method GetWithNextLink.");
            }
        }

        /// <summary> List things with nextlink. </summary>
        /// <param name="cancellationToken"> The cancellation token that can be used to cancel the operation. </param>
        /// <exception cref="ClientResultException"> Service returned a non-success status code. </exception>
        public virtual AsyncCollectionResult<Thing> GetWithNextLinkAsync(CancellationToken cancellationToken = default)
        {
            try
            {
                System.Console.WriteLine("Entering method GetWithNextLinkAsync.");
                return new SampleTypeSpecClientGetWithNextLinkAsyncCollectionResultOfT(this, cancellationToken.ToRequestOptions());
            }
            catch (Exception ex)
            {
                System.Console.WriteLine($"An exception was thrown in method GetWithNextLinkAsync: {ex}");
                throw;
            }
            finally
            {
                System.Console.WriteLine("Exiting method GetWithNextLinkAsync.");
            }
        }

        /// <summary>
        /// [Protocol Method] List things with nextlink
        /// <list type="bullet">
        /// <item>
        /// <description> This <see href="https://aka.ms/azsdk/net/protocol-methods">protocol method</see> allows explicit creation of the request and processing of the response for advanced scenarios. </description>
        /// </item>
        /// </list>
        /// </summary>
        /// <param name="options"> The request options, which can override default behaviors of the client pipeline on a per-call basis. </param>
        /// <exception cref="ClientResultException"> Service returned a non-success status code. </exception>
        /// <returns> The response returned from the service. </returns>
        public virtual CollectionResult GetWithStringNextLink(RequestOptions options)
        {
            try
            {
                System.Console.WriteLine("Entering method GetWithStringNextLink.");
                return new SampleTypeSpecClientGetWithStringNextLinkCollectionResult(this, options);
            }
            catch (Exception ex)
            {
                System.Console.WriteLine($"An exception was thrown in method GetWithStringNextLink: {ex}");
                throw;
            }
            finally
            {
                System.Console.WriteLine("Exiting method GetWithStringNextLink.");
            }
        }

        /// <summary>
        /// [Protocol Method] List things with nextlink
        /// <list type="bullet">
        /// <item>
        /// <description> This <see href="https://aka.ms/azsdk/net/protocol-methods">protocol method</see> allows explicit creation of the request and processing of the response for advanced scenarios. </description>
        /// </item>
        /// </list>
        /// </summary>
        /// <param name="options"> The request options, which can override default behaviors of the client pipeline on a per-call basis. </param>
        /// <exception cref="ClientResultException"> Service returned a non-success status code. </exception>
        /// <returns> The response returned from the service. </returns>
        public virtual AsyncCollectionResult GetWithStringNextLinkAsync(RequestOptions options)
        {
            try
            {
                System.Console.WriteLine("Entering method GetWithStringNextLinkAsync.");
                return new SampleTypeSpecClientGetWithStringNextLinkAsyncCollectionResult(this, options);
            }
            catch (Exception ex)
            {
                System.Console.WriteLine($"An exception was thrown in method GetWithStringNextLinkAsync: {ex}");
                throw;
            }
            finally
            {
                System.Console.WriteLine("Exiting method GetWithStringNextLinkAsync.");
            }
        }

        /// <summary> List things with nextlink. </summary>
        /// <param name="cancellationToken"> The cancellation token that can be used to cancel the operation. </param>
        /// <exception cref="ClientResultException"> Service returned a non-success status code. </exception>
        public virtual CollectionResult<Thing> GetWithStringNextLink(CancellationToken cancellationToken = default)
        {
            try
            {
                System.Console.WriteLine("Entering method GetWithStringNextLink.");
                return new SampleTypeSpecClientGetWithStringNextLinkCollectionResultOfT(this, cancellationToken.ToRequestOptions());
            }
            catch (Exception ex)
            {
                System.Console.WriteLine($"An exception was thrown in method GetWithStringNextLink: {ex}");
                throw;
            }
            finally
            {
                System.Console.WriteLine("Exiting method GetWithStringNextLink.");
            }
        }

        /// <summary> List things with nextlink. </summary>
        /// <param name="cancellationToken"> The cancellation token that can be used to cancel the operation. </param>
        /// <exception cref="ClientResultException"> Service returned a non-success status code. </exception>
        public virtual AsyncCollectionResult<Thing> GetWithStringNextLinkAsync(CancellationToken cancellationToken = default)
        {
            try
            {
                System.Console.WriteLine("Entering method GetWithStringNextLinkAsync.");
                return new SampleTypeSpecClientGetWithStringNextLinkAsyncCollectionResultOfT(this, cancellationToken.ToRequestOptions());
            }
            catch (Exception ex)
            {
                System.Console.WriteLine($"An exception was thrown in method GetWithStringNextLinkAsync: {ex}");
                throw;
            }
            finally
            {
                System.Console.WriteLine("Exiting method GetWithStringNextLinkAsync.");
            }
        }

        /// <summary>
        /// [Protocol Method] List things with continuation token
        /// <list type="bullet">
        /// <item>
        /// <description> This <see href="https://aka.ms/azsdk/net/protocol-methods">protocol method</see> allows explicit creation of the request and processing of the response for advanced scenarios. </description>
        /// </item>
        /// </list>
        /// </summary>
        /// <param name="token"></param>
        /// <param name="options"> The request options, which can override default behaviors of the client pipeline on a per-call basis. </param>
        /// <exception cref="ClientResultException"> Service returned a non-success status code. </exception>
        /// <returns> The response returned from the service. </returns>
        public virtual CollectionResult GetWithContinuationToken(string token, RequestOptions options)
        {
            try
            {
                System.Console.WriteLine("Entering method GetWithContinuationToken.");
                return new SampleTypeSpecClientGetWithContinuationTokenCollectionResult(this, token, options);
            }
            catch (Exception ex)
            {
                System.Console.WriteLine($"An exception was thrown in method GetWithContinuationToken: {ex}");
                throw;
            }
            finally
            {
                System.Console.WriteLine("Exiting method GetWithContinuationToken.");
            }
        }

        /// <summary>
        /// [Protocol Method] List things with continuation token
        /// <list type="bullet">
        /// <item>
        /// <description> This <see href="https://aka.ms/azsdk/net/protocol-methods">protocol method</see> allows explicit creation of the request and processing of the response for advanced scenarios. </description>
        /// </item>
        /// </list>
        /// </summary>
        /// <param name="token"></param>
        /// <param name="options"> The request options, which can override default behaviors of the client pipeline on a per-call basis. </param>
        /// <exception cref="ClientResultException"> Service returned a non-success status code. </exception>
        /// <returns> The response returned from the service. </returns>
        public virtual AsyncCollectionResult GetWithContinuationTokenAsync(string token, RequestOptions options)
        {
            try
            {
                System.Console.WriteLine("Entering method GetWithContinuationTokenAsync.");
                return new SampleTypeSpecClientGetWithContinuationTokenAsyncCollectionResult(this, token, options);
            }
            catch (Exception ex)
            {
                System.Console.WriteLine($"An exception was thrown in method GetWithContinuationTokenAsync: {ex}");
                throw;
            }
            finally
            {
                System.Console.WriteLine("Exiting method GetWithContinuationTokenAsync.");
            }
        }

        /// <summary> List things with continuation token. </summary>
        /// <param name="token"></param>
        /// <param name="cancellationToken"> The cancellation token that can be used to cancel the operation. </param>
        /// <exception cref="ClientResultException"> Service returned a non-success status code. </exception>
        public virtual CollectionResult<Thing> GetWithContinuationToken(string token = default, CancellationToken cancellationToken = default)
        {
            try
            {
                System.Console.WriteLine("Entering method GetWithContinuationToken.");
                return new SampleTypeSpecClientGetWithContinuationTokenCollectionResultOfT(this, token, cancellationToken.ToRequestOptions());
            }
            catch (Exception ex)
            {
                System.Console.WriteLine($"An exception was thrown in method GetWithContinuationToken: {ex}");
                throw;
            }
            finally
            {
                System.Console.WriteLine("Exiting method GetWithContinuationToken.");
            }
        }

        /// <summary> List things with continuation token. </summary>
        /// <param name="token"></param>
        /// <param name="cancellationToken"> The cancellation token that can be used to cancel the operation. </param>
        /// <exception cref="ClientResultException"> Service returned a non-success status code. </exception>
        public virtual AsyncCollectionResult<Thing> GetWithContinuationTokenAsync(string token = default, CancellationToken cancellationToken = default)
        {
            try
            {
                System.Console.WriteLine("Entering method GetWithContinuationTokenAsync.");
                return new SampleTypeSpecClientGetWithContinuationTokenAsyncCollectionResultOfT(this, token, cancellationToken.ToRequestOptions());
            }
            catch (Exception ex)
            {
                System.Console.WriteLine($"An exception was thrown in method GetWithContinuationTokenAsync: {ex}");
                throw;
            }
            finally
            {
                System.Console.WriteLine("Exiting method GetWithContinuationTokenAsync.");
            }
        }

        /// <summary>
        /// [Protocol Method] List things with continuation token header response
        /// <list type="bullet">
        /// <item>
        /// <description> This <see href="https://aka.ms/azsdk/net/protocol-methods">protocol method</see> allows explicit creation of the request and processing of the response for advanced scenarios. </description>
        /// </item>
        /// </list>
        /// </summary>
        /// <param name="token"></param>
        /// <param name="options"> The request options, which can override default behaviors of the client pipeline on a per-call basis. </param>
        /// <exception cref="ClientResultException"> Service returned a non-success status code. </exception>
        /// <returns> The response returned from the service. </returns>
        public virtual CollectionResult GetWithContinuationTokenHeaderResponse(string token, RequestOptions options)
        {
            try
            {
                System.Console.WriteLine("Entering method GetWithContinuationTokenHeaderResponse.");
                return new SampleTypeSpecClientGetWithContinuationTokenHeaderResponseCollectionResult(this, token, options);
            }
            catch (Exception ex)
            {
                System.Console.WriteLine($"An exception was thrown in method GetWithContinuationTokenHeaderResponse: {ex}");
                throw;
            }
            finally
            {
                System.Console.WriteLine("Exiting method GetWithContinuationTokenHeaderResponse.");
            }
        }

        /// <summary>
        /// [Protocol Method] List things with continuation token header response
        /// <list type="bullet">
        /// <item>
        /// <description> This <see href="https://aka.ms/azsdk/net/protocol-methods">protocol method</see> allows explicit creation of the request and processing of the response for advanced scenarios. </description>
        /// </item>
        /// </list>
        /// </summary>
        /// <param name="token"></param>
        /// <param name="options"> The request options, which can override default behaviors of the client pipeline on a per-call basis. </param>
        /// <exception cref="ClientResultException"> Service returned a non-success status code. </exception>
        /// <returns> The response returned from the service. </returns>
        public virtual AsyncCollectionResult GetWithContinuationTokenHeaderResponseAsync(string token, RequestOptions options)
        {
            try
            {
                System.Console.WriteLine("Entering method GetWithContinuationTokenHeaderResponseAsync.");
                return new SampleTypeSpecClientGetWithContinuationTokenHeaderResponseAsyncCollectionResult(this, token, options);
            }
            catch (Exception ex)
            {
                System.Console.WriteLine($"An exception was thrown in method GetWithContinuationTokenHeaderResponseAsync: {ex}");
                throw;
            }
            finally
            {
                System.Console.WriteLine("Exiting method GetWithContinuationTokenHeaderResponseAsync.");
            }
        }

        /// <summary> List things with continuation token header response. </summary>
        /// <param name="token"></param>
        /// <param name="cancellationToken"> The cancellation token that can be used to cancel the operation. </param>
        /// <exception cref="ClientResultException"> Service returned a non-success status code. </exception>
        public virtual CollectionResult<Thing> GetWithContinuationTokenHeaderResponse(string token = default, CancellationToken cancellationToken = default)
        {
            try
            {
                System.Console.WriteLine("Entering method GetWithContinuationTokenHeaderResponse.");
                return new SampleTypeSpecClientGetWithContinuationTokenHeaderResponseCollectionResultOfT(this, token, cancellationToken.ToRequestOptions());
            }
            catch (Exception ex)
            {
                System.Console.WriteLine($"An exception was thrown in method GetWithContinuationTokenHeaderResponse: {ex}");
                throw;
            }
            finally
            {
                System.Console.WriteLine("Exiting method GetWithContinuationTokenHeaderResponse.");
            }
        }

        /// <summary> List things with continuation token header response. </summary>
        /// <param name="token"></param>
        /// <param name="cancellationToken"> The cancellation token that can be used to cancel the operation. </param>
        /// <exception cref="ClientResultException"> Service returned a non-success status code. </exception>
        public virtual AsyncCollectionResult<Thing> GetWithContinuationTokenHeaderResponseAsync(string token = default, CancellationToken cancellationToken = default)
        {
            try
            {
                System.Console.WriteLine("Entering method GetWithContinuationTokenHeaderResponseAsync.");
                return new SampleTypeSpecClientGetWithContinuationTokenHeaderResponseAsyncCollectionResultOfT(this, token, cancellationToken.ToRequestOptions());
            }
            catch (Exception ex)
            {
                System.Console.WriteLine($"An exception was thrown in method GetWithContinuationTokenHeaderResponseAsync: {ex}");
                throw;
            }
            finally
            {
                System.Console.WriteLine("Exiting method GetWithContinuationTokenHeaderResponseAsync.");
            }
        }

        /// <summary>
        /// [Protocol Method] List things with paging
        /// <list type="bullet">
        /// <item>
        /// <description> This <see href="https://aka.ms/azsdk/net/protocol-methods">protocol method</see> allows explicit creation of the request and processing of the response for advanced scenarios. </description>
        /// </item>
        /// </list>
        /// </summary>
        /// <param name="options"> The request options, which can override default behaviors of the client pipeline on a per-call basis. </param>
        /// <exception cref="ClientResultException"> Service returned a non-success status code. </exception>
        /// <returns> The response returned from the service. </returns>
        public virtual CollectionResult GetWithPaging(RequestOptions options)
        {
            try
            {
                System.Console.WriteLine("Entering method GetWithPaging.");
                return new SampleTypeSpecClientGetWithPagingCollectionResult(this, options);
            }
            catch (Exception ex)
            {
                System.Console.WriteLine($"An exception was thrown in method GetWithPaging: {ex}");
                throw;
            }
            finally
            {
                System.Console.WriteLine("Exiting method GetWithPaging.");
            }
        }

        /// <summary>
        /// [Protocol Method] List things with paging
        /// <list type="bullet">
        /// <item>
        /// <description> This <see href="https://aka.ms/azsdk/net/protocol-methods">protocol method</see> allows explicit creation of the request and processing of the response for advanced scenarios. </description>
        /// </item>
        /// </list>
        /// </summary>
        /// <param name="options"> The request options, which can override default behaviors of the client pipeline on a per-call basis. </param>
        /// <exception cref="ClientResultException"> Service returned a non-success status code. </exception>
        /// <returns> The response returned from the service. </returns>
        public virtual AsyncCollectionResult GetWithPagingAsync(RequestOptions options)
        {
            try
            {
                System.Console.WriteLine("Entering method GetWithPagingAsync.");
                return new SampleTypeSpecClientGetWithPagingAsyncCollectionResult(this, options);
            }
            catch (Exception ex)
            {
                System.Console.WriteLine($"An exception was thrown in method GetWithPagingAsync: {ex}");
                throw;
            }
            finally
            {
                System.Console.WriteLine("Exiting method GetWithPagingAsync.");
            }
        }

        /// <summary> List things with paging. </summary>
        /// <param name="cancellationToken"> The cancellation token that can be used to cancel the operation. </param>
        /// <exception cref="ClientResultException"> Service returned a non-success status code. </exception>
        public virtual CollectionResult<Thing> GetWithPaging(CancellationToken cancellationToken = default)
        {
            try
            {
                System.Console.WriteLine("Entering method GetWithPaging.");
                return new SampleTypeSpecClientGetWithPagingCollectionResultOfT(this, cancellationToken.ToRequestOptions());
            }
            catch (Exception ex)
            {
                System.Console.WriteLine($"An exception was thrown in method GetWithPaging: {ex}");
                throw;
            }
            finally
            {
                System.Console.WriteLine("Exiting method GetWithPaging.");
            }
        }

        /// <summary> List things with paging. </summary>
        /// <param name="cancellationToken"> The cancellation token that can be used to cancel the operation. </param>
        /// <exception cref="ClientResultException"> Service returned a non-success status code. </exception>
        public virtual AsyncCollectionResult<Thing> GetWithPagingAsync(CancellationToken cancellationToken = default)
        {
            try
            {
                System.Console.WriteLine("Entering method GetWithPagingAsync.");
                return new SampleTypeSpecClientGetWithPagingAsyncCollectionResultOfT(this, cancellationToken.ToRequestOptions());
            }
            catch (Exception ex)
            {
                System.Console.WriteLine($"An exception was thrown in method GetWithPagingAsync: {ex}");
                throw;
            }
            finally
            {
                System.Console.WriteLine("Exiting method GetWithPagingAsync.");
            }
        }

        /// <summary>
        /// [Protocol Method] An operation with embedded parameters within the body
        /// <list type="bullet">
        /// <item>
        /// <description> This <see href="https://aka.ms/azsdk/net/protocol-methods">protocol method</see> allows explicit creation of the request and processing of the response for advanced scenarios. </description>
        /// </item>
        /// </list>
        /// </summary>
        /// <param name="requiredHeader"> required header parameter. </param>
        /// <param name="requiredQuery"> required query parameter. </param>
        /// <param name="content"> The content to send as the body of the request. </param>
        /// <param name="optionalHeader"> optional header parameter. </param>
        /// <param name="optionalQuery"> optional query parameter. </param>
        /// <param name="options"> The request options, which can override default behaviors of the client pipeline on a per-call basis. </param>
        /// <exception cref="ArgumentNullException"> <paramref name="requiredHeader"/>, <paramref name="requiredQuery"/> or <paramref name="content"/> is null. </exception>
        /// <exception cref="ArgumentException"> <paramref name="requiredHeader"/> or <paramref name="requiredQuery"/> is an empty string, and was expected to be non-empty. </exception>
        /// <exception cref="ClientResultException"> Service returned a non-success status code. </exception>
        /// <returns> The response returned from the service. </returns>
        public virtual ClientResult EmbeddedParameters(string requiredHeader, string requiredQuery, BinaryContent content, string optionalHeader = default, string optionalQuery = default, RequestOptions options = null)
        {
            try
            {
                System.Console.WriteLine("Entering method EmbeddedParameters.");
                Argument.AssertNotNullOrEmpty(requiredHeader, nameof(requiredHeader));
                Argument.AssertNotNullOrEmpty(requiredQuery, nameof(requiredQuery));
                Argument.AssertNotNull(content, nameof(content));

                using PipelineMessage message = CreateEmbeddedParametersRequest(requiredHeader, requiredQuery, content, optionalHeader, optionalQuery, options);
                return ClientResult.FromResponse(Pipeline.ProcessMessage(message, options));
            }
            catch (Exception ex)
            {
                System.Console.WriteLine($"An exception was thrown in method EmbeddedParameters: {ex}");
                throw;
            }
            finally
            {
                System.Console.WriteLine("Exiting method EmbeddedParameters.");
            }
        }

        /// <summary>
        /// [Protocol Method] An operation with embedded parameters within the body
        /// <list type="bullet">
        /// <item>
        /// <description> This <see href="https://aka.ms/azsdk/net/protocol-methods">protocol method</see> allows explicit creation of the request and processing of the response for advanced scenarios. </description>
        /// </item>
        /// </list>
        /// </summary>
        /// <param name="requiredHeader"> required header parameter. </param>
        /// <param name="requiredQuery"> required query parameter. </param>
        /// <param name="content"> The content to send as the body of the request. </param>
        /// <param name="optionalHeader"> optional header parameter. </param>
        /// <param name="optionalQuery"> optional query parameter. </param>
        /// <param name="options"> The request options, which can override default behaviors of the client pipeline on a per-call basis. </param>
        /// <exception cref="ArgumentNullException"> <paramref name="requiredHeader"/>, <paramref name="requiredQuery"/> or <paramref name="content"/> is null. </exception>
        /// <exception cref="ArgumentException"> <paramref name="requiredHeader"/> or <paramref name="requiredQuery"/> is an empty string, and was expected to be non-empty. </exception>
        /// <exception cref="ClientResultException"> Service returned a non-success status code. </exception>
        /// <returns> The response returned from the service. </returns>
        public virtual async Task<ClientResult> EmbeddedParametersAsync(string requiredHeader, string requiredQuery, BinaryContent content, string optionalHeader = default, string optionalQuery = default, RequestOptions options = null)
        {
            try
            {
                System.Console.WriteLine("Entering method EmbeddedParametersAsync.");
                Argument.AssertNotNullOrEmpty(requiredHeader, nameof(requiredHeader));
                Argument.AssertNotNullOrEmpty(requiredQuery, nameof(requiredQuery));
                Argument.AssertNotNull(content, nameof(content));

                using PipelineMessage message = CreateEmbeddedParametersRequest(requiredHeader, requiredQuery, content, optionalHeader, optionalQuery, options);
                return ClientResult.FromResponse(await Pipeline.ProcessMessageAsync(message, options).ConfigureAwait(false));
            }
            catch (Exception ex)
            {
                System.Console.WriteLine($"An exception was thrown in method EmbeddedParametersAsync: {ex}");
                throw;
            }
            finally
            {
                System.Console.WriteLine("Exiting method EmbeddedParametersAsync.");
            }
        }

        /// <summary> An operation with embedded parameters within the body. </summary>
        /// <param name="body"></param>
        /// <param name="cancellationToken"> The cancellation token that can be used to cancel the operation. </param>
        /// <exception cref="ArgumentNullException"> <paramref name="body"/> is null. </exception>
        /// <exception cref="ClientResultException"> Service returned a non-success status code. </exception>
        public virtual ClientResult EmbeddedParameters(ModelWithEmbeddedNonBodyParameters body, CancellationToken cancellationToken = default)
        {
            try
            {
                System.Console.WriteLine("Entering method EmbeddedParameters.");
                Argument.AssertNotNull(body, nameof(body));

                return EmbeddedParameters(body.RequiredHeader, body.RequiredQuery, body, body.OptionalHeader, body.OptionalQuery, cancellationToken.ToRequestOptions());
            }
            catch (Exception ex)
            {
                System.Console.WriteLine($"An exception was thrown in method EmbeddedParameters: {ex}");
                throw;
            }
            finally
            {
                System.Console.WriteLine("Exiting method EmbeddedParameters.");
            }
        }

        /// <summary> An operation with embedded parameters within the body. </summary>
        /// <param name="body"></param>
        /// <param name="cancellationToken"> The cancellation token that can be used to cancel the operation. </param>
        /// <exception cref="ArgumentNullException"> <paramref name="body"/> is null. </exception>
        /// <exception cref="ClientResultException"> Service returned a non-success status code. </exception>
        public virtual async Task<ClientResult> EmbeddedParametersAsync(ModelWithEmbeddedNonBodyParameters body, CancellationToken cancellationToken = default)
        {
            try
            {
                System.Console.WriteLine("Entering method EmbeddedParametersAsync.");
                Argument.AssertNotNull(body, nameof(body));

                return await EmbeddedParametersAsync(body.RequiredHeader, body.RequiredQuery, body, body.OptionalHeader, body.OptionalQuery, cancellationToken.ToRequestOptions()).ConfigureAwait(false);
            }
            catch (Exception ex)
            {
                System.Console.WriteLine($"An exception was thrown in method EmbeddedParametersAsync: {ex}");
                throw;
            }
            finally
            {
                System.Console.WriteLine("Exiting method EmbeddedParametersAsync.");
            }
        }

        /// <summary>
        /// [Protocol Method] An operation with a dynamic model
        /// <list type="bullet">
        /// <item>
        /// <description> This <see href="https://aka.ms/azsdk/net/protocol-methods">protocol method</see> allows explicit creation of the request and processing of the response for advanced scenarios. </description>
        /// </item>
        /// </list>
        /// </summary>
        /// <param name="content"> The content to send as the body of the request. </param>
        /// <param name="options"> The request options, which can override default behaviors of the client pipeline on a per-call basis. </param>
        /// <exception cref="ArgumentNullException"> <paramref name="content"/> is null. </exception>
        /// <exception cref="ClientResultException"> Service returned a non-success status code. </exception>
        /// <returns> The response returned from the service. </returns>
        public virtual ClientResult DynamicModelOperation(BinaryContent content, RequestOptions options = null)
        {
            try
            {
                System.Console.WriteLine("Entering method DynamicModelOperation.");
                Argument.AssertNotNull(content, nameof(content));

                using PipelineMessage message = CreateDynamicModelOperationRequest(content, options);
                return ClientResult.FromResponse(Pipeline.ProcessMessage(message, options));
            }
            catch (Exception ex)
            {
                System.Console.WriteLine($"An exception was thrown in method DynamicModelOperation: {ex}");
                throw;
            }
            finally
            {
                System.Console.WriteLine("Exiting method DynamicModelOperation.");
            }
        }

        /// <summary>
        /// [Protocol Method] An operation with a dynamic model
        /// <list type="bullet">
        /// <item>
        /// <description> This <see href="https://aka.ms/azsdk/net/protocol-methods">protocol method</see> allows explicit creation of the request and processing of the response for advanced scenarios. </description>
        /// </item>
        /// </list>
        /// </summary>
        /// <param name="content"> The content to send as the body of the request. </param>
        /// <param name="options"> The request options, which can override default behaviors of the client pipeline on a per-call basis. </param>
        /// <exception cref="ArgumentNullException"> <paramref name="content"/> is null. </exception>
        /// <exception cref="ClientResultException"> Service returned a non-success status code. </exception>
        /// <returns> The response returned from the service. </returns>
        public virtual async Task<ClientResult> DynamicModelOperationAsync(BinaryContent content, RequestOptions options = null)
        {
            try
            {
                System.Console.WriteLine("Entering method DynamicModelOperationAsync.");
                Argument.AssertNotNull(content, nameof(content));

                using PipelineMessage message = CreateDynamicModelOperationRequest(content, options);
                return ClientResult.FromResponse(await Pipeline.ProcessMessageAsync(message, options).ConfigureAwait(false));
            }
            catch (Exception ex)
            {
                System.Console.WriteLine($"An exception was thrown in method DynamicModelOperationAsync: {ex}");
                throw;
            }
            finally
            {
                System.Console.WriteLine("Exiting method DynamicModelOperationAsync.");
            }
        }

        /// <summary> An operation with a dynamic model. </summary>
        /// <param name="body"></param>
        /// <param name="cancellationToken"> The cancellation token that can be used to cancel the operation. </param>
        /// <exception cref="ArgumentNullException"> <paramref name="body"/> is null. </exception>
        /// <exception cref="ClientResultException"> Service returned a non-success status code. </exception>
        public virtual ClientResult DynamicModelOperation(DynamicModel body, CancellationToken cancellationToken = default)
        {
            try
            {
                System.Console.WriteLine("Entering method DynamicModelOperation.");
                Argument.AssertNotNull(body, nameof(body));

                return DynamicModelOperation(body, cancellationToken.ToRequestOptions());
            }
            catch (Exception ex)
            {
                System.Console.WriteLine($"An exception was thrown in method DynamicModelOperation: {ex}");
                throw;
            }
            finally
            {
                System.Console.WriteLine("Exiting method DynamicModelOperation.");
            }
        }

        /// <summary> An operation with a dynamic model. </summary>
        /// <param name="body"></param>
        /// <param name="cancellationToken"> The cancellation token that can be used to cancel the operation. </param>
        /// <exception cref="ArgumentNullException"> <paramref name="body"/> is null. </exception>
        /// <exception cref="ClientResultException"> Service returned a non-success status code. </exception>
        public virtual async Task<ClientResult> DynamicModelOperationAsync(DynamicModel body, CancellationToken cancellationToken = default)
        {
            try
            {
                System.Console.WriteLine("Entering method DynamicModelOperationAsync.");
                Argument.AssertNotNull(body, nameof(body));

                return await DynamicModelOperationAsync(body, cancellationToken.ToRequestOptions()).ConfigureAwait(false);
            }
            catch (Exception ex)
            {
                System.Console.WriteLine($"An exception was thrown in method DynamicModelOperationAsync: {ex}");
                throw;
            }
            finally
            {
                System.Console.WriteLine("Exiting method DynamicModelOperationAsync.");
            }
        }

        /// <summary>
        /// [Protocol Method] Get an advanced XML model with various property types
        /// <list type="bullet">
        /// <item>
        /// <description> This <see href="https://aka.ms/azsdk/net/protocol-methods">protocol method</see> allows explicit creation of the request and processing of the response for advanced scenarios. </description>
        /// </item>
        /// </list>
        /// </summary>
        /// <param name="options"> The request options, which can override default behaviors of the client pipeline on a per-call basis. </param>
        /// <exception cref="ClientResultException"> Service returned a non-success status code. </exception>
        /// <returns> The response returned from the service. </returns>
        public virtual ClientResult GetXmlAdvancedModel(RequestOptions options)
        {
            try
            {
                System.Console.WriteLine("Entering method GetXmlAdvancedModel.");
                using PipelineMessage message = CreateGetXmlAdvancedModelRequest(options);
                return ClientResult.FromResponse(Pipeline.ProcessMessage(message, options));
            }
            catch (Exception ex)
            {
                System.Console.WriteLine($"An exception was thrown in method GetXmlAdvancedModel: {ex}");
                throw;
            }
            finally
            {
                System.Console.WriteLine("Exiting method GetXmlAdvancedModel.");
            }
        }

        /// <summary>
        /// [Protocol Method] Get an advanced XML model with various property types
        /// <list type="bullet">
        /// <item>
        /// <description> This <see href="https://aka.ms/azsdk/net/protocol-methods">protocol method</see> allows explicit creation of the request and processing of the response for advanced scenarios. </description>
        /// </item>
        /// </list>
        /// </summary>
        /// <param name="options"> The request options, which can override default behaviors of the client pipeline on a per-call basis. </param>
        /// <exception cref="ClientResultException"> Service returned a non-success status code. </exception>
        /// <returns> The response returned from the service. </returns>
        public virtual async Task<ClientResult> GetXmlAdvancedModelAsync(RequestOptions options)
        {
            try
            {
                System.Console.WriteLine("Entering method GetXmlAdvancedModelAsync.");
                using PipelineMessage message = CreateGetXmlAdvancedModelRequest(options);
                return ClientResult.FromResponse(await Pipeline.ProcessMessageAsync(message, options).ConfigureAwait(false));
            }
            catch (Exception ex)
            {
                System.Console.WriteLine($"An exception was thrown in method GetXmlAdvancedModelAsync: {ex}");
                throw;
            }
            finally
            {
                System.Console.WriteLine("Exiting method GetXmlAdvancedModelAsync.");
            }
        }

        /// <summary> Get an advanced XML model with various property types. </summary>
        /// <param name="cancellationToken"> The cancellation token that can be used to cancel the operation. </param>
        /// <exception cref="ClientResultException"> Service returned a non-success status code. </exception>
        public virtual ClientResult<XmlAdvancedModel> GetXmlAdvancedModel(CancellationToken cancellationToken = default)
        {
            try
            {
                System.Console.WriteLine("Entering method GetXmlAdvancedModel.");
                ClientResult result = GetXmlAdvancedModel(cancellationToken.ToRequestOptions());
                return ClientResult.FromValue((XmlAdvancedModel)result, result.GetRawResponse());
            }
            catch (Exception ex)
            {
                System.Console.WriteLine($"An exception was thrown in method GetXmlAdvancedModel: {ex}");
                throw;
            }
            finally
            {
                System.Console.WriteLine("Exiting method GetXmlAdvancedModel.");
            }
        }

        /// <summary> Get an advanced XML model with various property types. </summary>
        /// <param name="cancellationToken"> The cancellation token that can be used to cancel the operation. </param>
        /// <exception cref="ClientResultException"> Service returned a non-success status code. </exception>
        public virtual async Task<ClientResult<XmlAdvancedModel>> GetXmlAdvancedModelAsync(CancellationToken cancellationToken = default)
        {
            try
            {
                System.Console.WriteLine("Entering method GetXmlAdvancedModelAsync.");
                ClientResult result = await GetXmlAdvancedModelAsync(cancellationToken.ToRequestOptions()).ConfigureAwait(false);
                return ClientResult.FromValue((XmlAdvancedModel)result, result.GetRawResponse());
            }
            catch (Exception ex)
            {
                System.Console.WriteLine($"An exception was thrown in method GetXmlAdvancedModelAsync: {ex}");
                throw;
            }
            finally
            {
                System.Console.WriteLine("Exiting method GetXmlAdvancedModelAsync.");
            }
        }

        /// <summary>
        /// [Protocol Method] Update an advanced XML model with various property types
        /// <list type="bullet">
        /// <item>
        /// <description> This <see href="https://aka.ms/azsdk/net/protocol-methods">protocol method</see> allows explicit creation of the request and processing of the response for advanced scenarios. </description>
        /// </item>
        /// </list>
        /// </summary>
        /// <param name="content"> The content to send as the body of the request. </param>
        /// <param name="options"> The request options, which can override default behaviors of the client pipeline on a per-call basis. </param>
        /// <exception cref="ArgumentNullException"> <paramref name="content"/> is null. </exception>
        /// <exception cref="ClientResultException"> Service returned a non-success status code. </exception>
        /// <returns> The response returned from the service. </returns>
        public virtual ClientResult UpdateXmlAdvancedModel(BinaryContent content, RequestOptions options = null)
        {
            try
            {
                System.Console.WriteLine("Entering method UpdateXmlAdvancedModel.");
                Argument.AssertNotNull(content, nameof(content));

                using PipelineMessage message = CreateUpdateXmlAdvancedModelRequest(content, options);
                return ClientResult.FromResponse(Pipeline.ProcessMessage(message, options));
            }
            catch (Exception ex)
            {
                System.Console.WriteLine($"An exception was thrown in method UpdateXmlAdvancedModel: {ex}");
                throw;
            }
            finally
            {
                System.Console.WriteLine("Exiting method UpdateXmlAdvancedModel.");
            }
        }

        /// <summary>
        /// [Protocol Method] Update an advanced XML model with various property types
        /// <list type="bullet">
        /// <item>
        /// <description> This <see href="https://aka.ms/azsdk/net/protocol-methods">protocol method</see> allows explicit creation of the request and processing of the response for advanced scenarios. </description>
        /// </item>
        /// </list>
        /// </summary>
        /// <param name="content"> The content to send as the body of the request. </param>
        /// <param name="options"> The request options, which can override default behaviors of the client pipeline on a per-call basis. </param>
        /// <exception cref="ArgumentNullException"> <paramref name="content"/> is null. </exception>
        /// <exception cref="ClientResultException"> Service returned a non-success status code. </exception>
        /// <returns> The response returned from the service. </returns>
        public virtual async Task<ClientResult> UpdateXmlAdvancedModelAsync(BinaryContent content, RequestOptions options = null)
        {
            try
            {
                System.Console.WriteLine("Entering method UpdateXmlAdvancedModelAsync.");
                Argument.AssertNotNull(content, nameof(content));

                using PipelineMessage message = CreateUpdateXmlAdvancedModelRequest(content, options);
                return ClientResult.FromResponse(await Pipeline.ProcessMessageAsync(message, options).ConfigureAwait(false));
            }
            catch (Exception ex)
            {
                System.Console.WriteLine($"An exception was thrown in method UpdateXmlAdvancedModelAsync: {ex}");
                throw;
            }
            finally
            {
                System.Console.WriteLine("Exiting method UpdateXmlAdvancedModelAsync.");
            }
        }

        /// <summary> Update an advanced XML model with various property types. </summary>
        /// <param name="body"></param>
        /// <param name="cancellationToken"> The cancellation token that can be used to cancel the operation. </param>
        /// <exception cref="ArgumentNullException"> <paramref name="body"/> is null. </exception>
        /// <exception cref="ClientResultException"> Service returned a non-success status code. </exception>
        public virtual ClientResult<XmlAdvancedModel> UpdateXmlAdvancedModel(XmlAdvancedModel body, CancellationToken cancellationToken = default)
        {
            try
            {
                System.Console.WriteLine("Entering method UpdateXmlAdvancedModel.");
                Argument.AssertNotNull(body, nameof(body));

                ClientResult result = UpdateXmlAdvancedModel(body, cancellationToken.ToRequestOptions());
                return ClientResult.FromValue((XmlAdvancedModel)result, result.GetRawResponse());
            }
            catch (Exception ex)
            {
                System.Console.WriteLine($"An exception was thrown in method UpdateXmlAdvancedModel: {ex}");
                throw;
            }
            finally
            {
                System.Console.WriteLine("Exiting method UpdateXmlAdvancedModel.");
            }
        }

        /// <summary> Update an advanced XML model with various property types. </summary>
        /// <param name="body"></param>
        /// <param name="cancellationToken"> The cancellation token that can be used to cancel the operation. </param>
        /// <exception cref="ArgumentNullException"> <paramref name="body"/> is null. </exception>
        /// <exception cref="ClientResultException"> Service returned a non-success status code. </exception>
        public virtual async Task<ClientResult<XmlAdvancedModel>> UpdateXmlAdvancedModelAsync(XmlAdvancedModel body, CancellationToken cancellationToken = default)
        {
            try
            {
                System.Console.WriteLine("Entering method UpdateXmlAdvancedModelAsync.");
                Argument.AssertNotNull(body, nameof(body));

                ClientResult result = await UpdateXmlAdvancedModelAsync(body, cancellationToken.ToRequestOptions()).ConfigureAwait(false);
                return ClientResult.FromValue((XmlAdvancedModel)result, result.GetRawResponse());
            }
            catch (Exception ex)
            {
                System.Console.WriteLine($"An exception was thrown in method UpdateXmlAdvancedModelAsync: {ex}");
                throw;
            }
            finally
            {
                System.Console.WriteLine("Exiting method UpdateXmlAdvancedModelAsync.");
            }
        }

        /// <summary> Initializes a new instance of AnimalOperations. </summary>
        public virtual AnimalOperations GetAnimalOperationsClient()
        {
            return Volatile.Read(ref _cachedAnimalOperations) ?? Interlocked.CompareExchange(ref _cachedAnimalOperations, new AnimalOperations(Pipeline, _endpoint), null) ?? _cachedAnimalOperations;
        }

        /// <summary> Initializes a new instance of PetOperations. </summary>
        public virtual PetOperations GetPetOperationsClient()
        {
            return Volatile.Read(ref _cachedPetOperations) ?? Interlocked.CompareExchange(ref _cachedPetOperations, new PetOperations(Pipeline, _endpoint), null) ?? _cachedPetOperations;
        }

        /// <summary> Initializes a new instance of DogOperations. </summary>
        public virtual DogOperations GetDogOperationsClient()
        {
            return Volatile.Read(ref _cachedDogOperations) ?? Interlocked.CompareExchange(ref _cachedDogOperations, new DogOperations(Pipeline, _endpoint), null) ?? _cachedDogOperations;
        }

        /// <summary> Initializes a new instance of PlantOperations. </summary>
        public virtual PlantOperations GetPlantOperationsClient()
        {
            return Volatile.Read(ref _cachedPlantOperations) ?? Interlocked.CompareExchange(ref _cachedPlantOperations, new PlantOperations(Pipeline, _endpoint), null) ?? _cachedPlantOperations;
        }

        /// <summary> Initializes a new instance of Metrics. </summary>
        public virtual Metrics GetMetricsClient()
        {
            return Volatile.Read(ref _cachedMetrics) ?? Interlocked.CompareExchange(ref _cachedMetrics, new Metrics(Pipeline, _endpoint, _metricsNamespace), null) ?? _cachedMetrics;
        }
    }
}
