// <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;

        /// <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="credential"> A credential used to authenticate to the service. </param>
        /// <exception cref="ArgumentNullException"> <paramref name="endpoint"/> or <paramref name="credential"/> is null. </exception>
        public SampleTypeSpecClient(Uri endpoint, ApiKeyCredential credential) : this(endpoint, credential, new SampleTypeSpecClientOptions())
        {
        }

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

        /// <summary> Initializes a new instance of SampleTypeSpecClient. </summary>
        /// <param name="endpoint"> Service endpoint. </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"/> or <paramref name="credential"/> is null. </exception>
        public SampleTypeSpecClient(Uri endpoint, ApiKeyCredential credential, SampleTypeSpecClientOptions options)
        {
            Argument.AssertNotNull(endpoint, nameof(endpoint));
            Argument.AssertNotNull(credential, nameof(credential));

            options ??= new SampleTypeSpecClientOptions();

            _endpoint = endpoint;
            _keyCredential = credential;
            Pipeline = ClientPipeline.Create(options, Array.Empty<PipelinePolicy>(), new PipelinePolicy[] { 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="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"/> or <paramref name="tokenProvider"/> is null. </exception>
        public SampleTypeSpecClient(Uri endpoint, AuthenticationTokenProvider tokenProvider, SampleTypeSpecClientOptions options)
        {
            Argument.AssertNotNull(endpoint, nameof(endpoint));
            Argument.AssertNotNull(tokenProvider, nameof(tokenProvider));

            options ??= new SampleTypeSpecClientOptions();

            _endpoint = endpoint;
            _tokenProvider = tokenProvider;
            Pipeline = ClientPipeline.Create(options, Array.Empty<PipelinePolicy>(), new PipelinePolicy[] { 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.CanBeCanceled ? new RequestOptions { CancellationToken = cancellationToken } : null);
                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.CanBeCanceled ? new RequestOptions { CancellationToken = cancellationToken } : null).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.CanBeCanceled ? new RequestOptions { CancellationToken = cancellationToken } : null);
                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.CanBeCanceled ? new RequestOptions { CancellationToken = cancellationToken } : null).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>
        /// [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.CanBeCanceled ? new RequestOptions { CancellationToken = cancellationToken } : null);
                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.CanBeCanceled ? new RequestOptions { CancellationToken = cancellationToken } : null).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.CanBeCanceled ? new RequestOptions { CancellationToken = cancellationToken } : null);
                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.CanBeCanceled ? new RequestOptions { CancellationToken = cancellationToken } : null).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.CanBeCanceled ? new RequestOptions { CancellationToken = cancellationToken } : null);
                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.CanBeCanceled ? new RequestOptions { CancellationToken = cancellationToken } : null).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.CanBeCanceled ? new RequestOptions { CancellationToken = cancellationToken } : null);
                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.CanBeCanceled ? new RequestOptions { CancellationToken = cancellationToken } : null).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="requiredLiteralString"> required literal string. </param>
        /// <param name="requiredNullableString"> required nullable string. </param>
        /// <param name="requiredLiteralInt"> required literal int. </param>
        /// <param name="requiredLiteralFloat"> required literal float. </param>
        /// <param name="requiredLiteralBool"> required literal bool. </param>
        /// <param name="requiredBadDescription"> description with xml &lt;|endoftext|&gt;. </param>
        /// <param name="requiredNullableList"> required nullable collection. </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="requiredLiteralString"/> or <paramref name="requiredBadDescription"/> is null. </exception>
        /// <exception cref="ArgumentException"> <paramref name="name"/> or <paramref name="requiredBadDescription"/> 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 requiredLiteralString, string requiredNullableString, int requiredLiteralInt, float requiredLiteralFloat, bool requiredLiteralBool, string requiredBadDescription, IEnumerable<int> requiredNullableList, string optionalNullableString = default, string optionalLiteralString = default, int? optionalLiteralInt = default, float? 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.AssertNotNull(requiredLiteralString, nameof(requiredLiteralString));
                Argument.AssertNotNullOrEmpty(requiredBadDescription, nameof(requiredBadDescription));

                Thing spreadModel = new Thing(
                    name,
                    requiredUnion,
                    requiredLiteralString,
                    requiredNullableString,
                    optionalNullableString,
                    requiredLiteralInt,
                    requiredLiteralFloat,
                    requiredLiteralBool,
                    optionalLiteralString,
                    optionalLiteralInt,
                    optionalLiteralFloat,
                    optionalLiteralBool,
                    requiredBadDescription,
                    optionalNullableList?.ToList() as IList<int> ?? new ChangeTrackingList<int>(),
                    requiredNullableList?.ToList() as IList<int> ?? new ChangeTrackingList<int>(),
                    null);
                ClientResult result = AnonymousBody(spreadModel, cancellationToken.CanBeCanceled ? new RequestOptions { CancellationToken = cancellationToken } : null);
                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="requiredLiteralString"> required literal string. </param>
        /// <param name="requiredNullableString"> required nullable string. </param>
        /// <param name="requiredLiteralInt"> required literal int. </param>
        /// <param name="requiredLiteralFloat"> required literal float. </param>
        /// <param name="requiredLiteralBool"> required literal bool. </param>
        /// <param name="requiredBadDescription"> description with xml &lt;|endoftext|&gt;. </param>
        /// <param name="requiredNullableList"> required nullable collection. </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="requiredLiteralString"/> or <paramref name="requiredBadDescription"/> is null. </exception>
        /// <exception cref="ArgumentException"> <paramref name="name"/> or <paramref name="requiredBadDescription"/> 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 requiredLiteralString, string requiredNullableString, int requiredLiteralInt, float requiredLiteralFloat, bool requiredLiteralBool, string requiredBadDescription, IEnumerable<int> requiredNullableList, string optionalNullableString = default, string optionalLiteralString = default, int? optionalLiteralInt = default, float? 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.AssertNotNull(requiredLiteralString, nameof(requiredLiteralString));
                Argument.AssertNotNullOrEmpty(requiredBadDescription, nameof(requiredBadDescription));

                Thing spreadModel = new Thing(
                    name,
                    requiredUnion,
                    requiredLiteralString,
                    requiredNullableString,
                    optionalNullableString,
                    requiredLiteralInt,
                    requiredLiteralFloat,
                    requiredLiteralBool,
                    optionalLiteralString,
                    optionalLiteralInt,
                    optionalLiteralFloat,
                    optionalLiteralBool,
                    requiredBadDescription,
                    optionalNullableList?.ToList() as IList<int> ?? new ChangeTrackingList<int>(),
                    requiredNullableList?.ToList() as IList<int> ?? new ChangeTrackingList<int>(),
                    null);
                ClientResult result = await AnonymousBodyAsync(spreadModel, cancellationToken.CanBeCanceled ? new RequestOptions { CancellationToken = cancellationToken } : null).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, null);
                ClientResult result = FriendlyModel(spreadModel, cancellationToken.CanBeCanceled ? new RequestOptions { CancellationToken = cancellationToken } : null);
                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, null);
                ClientResult result = await FriendlyModelAsync(spreadModel, cancellationToken.CanBeCanceled ? new RequestOptions { CancellationToken = cancellationToken } : null).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.CanBeCanceled ? new RequestOptions { CancellationToken = cancellationToken } : null);
            }
            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.CanBeCanceled ? new RequestOptions { CancellationToken = cancellationToken } : null).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="name"> 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="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<RenamedModel> ProjectedNameModel(string name, CancellationToken cancellationToken = default)
        {
            try
            {
                System.Console.WriteLine("Entering method ProjectedNameModel.");
                Argument.AssertNotNullOrEmpty(name, nameof(name));

                RenamedModel spreadModel = new RenamedModel(name, null);
                ClientResult result = ProjectedNameModel(spreadModel, cancellationToken.CanBeCanceled ? new RequestOptions { CancellationToken = cancellationToken } : null);
                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="name"> 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="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<RenamedModel>> ProjectedNameModelAsync(string name, CancellationToken cancellationToken = default)
        {
            try
            {
                System.Console.WriteLine("Entering method ProjectedNameModelAsync.");
                Argument.AssertNotNullOrEmpty(name, nameof(name));

                RenamedModel spreadModel = new RenamedModel(name, null);
                ClientResult result = await ProjectedNameModelAsync(spreadModel, cancellationToken.CanBeCanceled ? new RequestOptions { CancellationToken = cancellationToken } : null).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.CanBeCanceled ? new RequestOptions { CancellationToken = cancellationToken } : null);
                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.CanBeCanceled ? new RequestOptions { CancellationToken = cancellationToken } : null).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.CanBeCanceled ? new RequestOptions { CancellationToken = cancellationToken } : null);
                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.CanBeCanceled ? new RequestOptions { CancellationToken = cancellationToken } : null).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.CanBeCanceled ? new RequestOptions { CancellationToken = cancellationToken } : null);
                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.CanBeCanceled ? new RequestOptions { CancellationToken = cancellationToken } : null).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.CanBeCanceled ? new RequestOptions { CancellationToken = cancellationToken } : null);
            }
            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.CanBeCanceled ? new RequestOptions { CancellationToken = cancellationToken } : null).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.CanBeCanceled ? new RequestOptions { CancellationToken = cancellationToken } : null);
            }
            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.CanBeCanceled ? new RequestOptions { CancellationToken = cancellationToken } : null).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.CanBeCanceled ? new RequestOptions { CancellationToken = cancellationToken } : null);
            }
            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.CanBeCanceled ? new RequestOptions { CancellationToken = cancellationToken } : null).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.CanBeCanceled ? new RequestOptions { CancellationToken = cancellationToken } : null);
            }
            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.CanBeCanceled ? new RequestOptions { CancellationToken = cancellationToken } : null);
            }
            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.CanBeCanceled ? new RequestOptions { CancellationToken = cancellationToken } : null);
            }
            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.CanBeCanceled ? new RequestOptions { CancellationToken = cancellationToken } : null);
            }
            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.CanBeCanceled ? new RequestOptions { CancellationToken = cancellationToken } : null);
            }
            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.CanBeCanceled ? new RequestOptions { CancellationToken = cancellationToken } : null);
            }
            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.CanBeCanceled ? new RequestOptions { CancellationToken = cancellationToken } : null);
            }
            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.CanBeCanceled ? new RequestOptions { CancellationToken = cancellationToken } : null);
            }
            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.CanBeCanceled ? new RequestOptions { CancellationToken = cancellationToken } : null);
            }
            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.CanBeCanceled ? new RequestOptions { CancellationToken = cancellationToken } : null);
            }
            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.CanBeCanceled ? new RequestOptions { CancellationToken = cancellationToken } : null);
            }
            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.CanBeCanceled ? new RequestOptions { CancellationToken = cancellationToken } : null).ConfigureAwait(false);
            }
            catch (Exception ex)
            {
                System.Console.WriteLine($"An exception was thrown in method EmbeddedParametersAsync: {ex}");
                throw;
            }
            finally
            {
                System.Console.WriteLine("Exiting method EmbeddedParametersAsync.");
            }
        }
    }
}
