|
| 1 | +// <auto-generated/> |
| 2 | + |
| 3 | +#nullable disable |
| 4 | + |
| 5 | +using System; |
| 6 | +using System.ClientModel; |
| 7 | +using System.ClientModel.Primitives; |
| 8 | +using System.Threading; |
| 9 | +using System.Threading.Tasks; |
| 10 | + |
| 11 | +namespace SampleTypeSpec |
| 12 | +{ |
| 13 | + /// <summary> The Metrics sub-client. </summary> |
| 14 | + public partial class Metrics |
| 15 | + { |
| 16 | + private readonly Uri _endpoint; |
| 17 | + |
| 18 | + /// <summary> Initializes a new instance of Metrics for mocking. </summary> |
| 19 | + protected Metrics() |
| 20 | + { |
| 21 | + } |
| 22 | + |
| 23 | + /// <summary> Initializes a new instance of Metrics. </summary> |
| 24 | + /// <param name="pipeline"> The HTTP pipeline for sending and receiving REST requests and responses. </param> |
| 25 | + /// <param name="endpoint"> Service endpoint. </param> |
| 26 | + internal Metrics(ClientPipeline pipeline, Uri endpoint) |
| 27 | + { |
| 28 | + _endpoint = endpoint; |
| 29 | + Pipeline = pipeline; |
| 30 | + } |
| 31 | + |
| 32 | + /// <summary> The HTTP pipeline for sending and receiving REST requests and responses. </summary> |
| 33 | + public ClientPipeline Pipeline { get; } |
| 34 | + |
| 35 | + /// <summary> |
| 36 | + /// [Protocol Method] Get Widget metrics for given day of week |
| 37 | + /// <list type="bullet"> |
| 38 | + /// <item> |
| 39 | + /// <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> |
| 40 | + /// </item> |
| 41 | + /// </list> |
| 42 | + /// </summary> |
| 43 | + /// <param name="day"></param> |
| 44 | + /// <param name="options"> The request options, which can override default behaviors of the client pipeline on a per-call basis. </param> |
| 45 | + /// <exception cref="ClientResultException"> Service returned a non-success status code. </exception> |
| 46 | + /// <returns> The response returned from the service. </returns> |
| 47 | + public virtual ClientResult GetWidgetMetrics(string day, RequestOptions options = null) |
| 48 | + { |
| 49 | + try |
| 50 | + { |
| 51 | + System.Console.WriteLine("Entering method GetWidgetMetrics."); |
| 52 | + using PipelineMessage message = CreateGetWidgetMetricsRequest(day, options); |
| 53 | + return ClientResult.FromResponse(Pipeline.ProcessMessage(message, options)); |
| 54 | + } |
| 55 | + catch (Exception ex) |
| 56 | + { |
| 57 | + System.Console.WriteLine($"An exception was thrown in method GetWidgetMetrics: {ex}"); |
| 58 | + throw; |
| 59 | + } |
| 60 | + finally |
| 61 | + { |
| 62 | + System.Console.WriteLine("Exiting method GetWidgetMetrics."); |
| 63 | + } |
| 64 | + } |
| 65 | + |
| 66 | + /// <summary> |
| 67 | + /// [Protocol Method] Get Widget metrics for given day of week |
| 68 | + /// <list type="bullet"> |
| 69 | + /// <item> |
| 70 | + /// <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> |
| 71 | + /// </item> |
| 72 | + /// </list> |
| 73 | + /// </summary> |
| 74 | + /// <param name="day"></param> |
| 75 | + /// <param name="options"> The request options, which can override default behaviors of the client pipeline on a per-call basis. </param> |
| 76 | + /// <exception cref="ClientResultException"> Service returned a non-success status code. </exception> |
| 77 | + /// <returns> The response returned from the service. </returns> |
| 78 | + public virtual async Task<ClientResult> GetWidgetMetricsAsync(string day, RequestOptions options = null) |
| 79 | + { |
| 80 | + try |
| 81 | + { |
| 82 | + System.Console.WriteLine("Entering method GetWidgetMetricsAsync."); |
| 83 | + using PipelineMessage message = CreateGetWidgetMetricsRequest(day, options); |
| 84 | + return ClientResult.FromResponse(await Pipeline.ProcessMessageAsync(message, options).ConfigureAwait(false)); |
| 85 | + } |
| 86 | + catch (Exception ex) |
| 87 | + { |
| 88 | + System.Console.WriteLine($"An exception was thrown in method GetWidgetMetricsAsync: {ex}"); |
| 89 | + throw; |
| 90 | + } |
| 91 | + finally |
| 92 | + { |
| 93 | + System.Console.WriteLine("Exiting method GetWidgetMetricsAsync."); |
| 94 | + } |
| 95 | + } |
| 96 | + |
| 97 | + /// <summary> Get Widget metrics for given day of week. </summary> |
| 98 | + /// <param name="day"></param> |
| 99 | + /// <param name="cancellationToken"> The cancellation token that can be used to cancel the operation. </param> |
| 100 | + /// <exception cref="ClientResultException"> Service returned a non-success status code. </exception> |
| 101 | + public virtual ClientResult<GetWidgetMetricsResponse> GetWidgetMetrics(DaysOfWeekExtensibleEnum day, CancellationToken cancellationToken = default) |
| 102 | + { |
| 103 | + try |
| 104 | + { |
| 105 | + System.Console.WriteLine("Entering method GetWidgetMetrics."); |
| 106 | + ClientResult result = GetWidgetMetrics(day.ToString(), cancellationToken.CanBeCanceled ? new RequestOptions { CancellationToken = cancellationToken } : null); |
| 107 | + return ClientResult.FromValue((GetWidgetMetricsResponse)result, result.GetRawResponse()); |
| 108 | + } |
| 109 | + catch (Exception ex) |
| 110 | + { |
| 111 | + System.Console.WriteLine($"An exception was thrown in method GetWidgetMetrics: {ex}"); |
| 112 | + throw; |
| 113 | + } |
| 114 | + finally |
| 115 | + { |
| 116 | + System.Console.WriteLine("Exiting method GetWidgetMetrics."); |
| 117 | + } |
| 118 | + } |
| 119 | + |
| 120 | + /// <summary> Get Widget metrics for given day of week. </summary> |
| 121 | + /// <param name="day"></param> |
| 122 | + /// <param name="cancellationToken"> The cancellation token that can be used to cancel the operation. </param> |
| 123 | + /// <exception cref="ClientResultException"> Service returned a non-success status code. </exception> |
| 124 | + public virtual async Task<ClientResult<GetWidgetMetricsResponse>> GetWidgetMetricsAsync(DaysOfWeekExtensibleEnum day, CancellationToken cancellationToken = default) |
| 125 | + { |
| 126 | + try |
| 127 | + { |
| 128 | + System.Console.WriteLine("Entering method GetWidgetMetricsAsync."); |
| 129 | + ClientResult result = await GetWidgetMetricsAsync(day.ToString(), cancellationToken.CanBeCanceled ? new RequestOptions { CancellationToken = cancellationToken } : null).ConfigureAwait(false); |
| 130 | + return ClientResult.FromValue((GetWidgetMetricsResponse)result, result.GetRawResponse()); |
| 131 | + } |
| 132 | + catch (Exception ex) |
| 133 | + { |
| 134 | + System.Console.WriteLine($"An exception was thrown in method GetWidgetMetricsAsync: {ex}"); |
| 135 | + throw; |
| 136 | + } |
| 137 | + finally |
| 138 | + { |
| 139 | + System.Console.WriteLine("Exiting method GetWidgetMetricsAsync."); |
| 140 | + } |
| 141 | + } |
| 142 | + } |
| 143 | +} |
0 commit comments