|
| 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 AnimalOperations sub-client. </summary> |
| 14 | + public partial class AnimalOperations |
| 15 | + { |
| 16 | + private readonly Uri _endpoint; |
| 17 | + |
| 18 | + /// <summary> Initializes a new instance of AnimalOperations for mocking. </summary> |
| 19 | + protected AnimalOperations() |
| 20 | + { |
| 21 | + } |
| 22 | + |
| 23 | + /// <summary> Initializes a new instance of AnimalOperations. </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 AnimalOperations(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] Update a pet as an animal |
| 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="content"> The content to send as the body of the request. </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="ArgumentNullException"> <paramref name="content"/> is null. </exception> |
| 46 | + /// <exception cref="ClientResultException"> Service returned a non-success status code. </exception> |
| 47 | + /// <returns> The response returned from the service. </returns> |
| 48 | + public virtual ClientResult UpdatePetAsAnimal(BinaryContent content, RequestOptions options = null) |
| 49 | + { |
| 50 | + try |
| 51 | + { |
| 52 | + System.Console.WriteLine("Entering method UpdatePetAsAnimal."); |
| 53 | + Argument.AssertNotNull(content, nameof(content)); |
| 54 | + |
| 55 | + using PipelineMessage message = CreateUpdatePetAsAnimalRequest(content, options); |
| 56 | + return ClientResult.FromResponse(Pipeline.ProcessMessage(message, options)); |
| 57 | + } |
| 58 | + catch (Exception ex) |
| 59 | + { |
| 60 | + System.Console.WriteLine($"An exception was thrown in method UpdatePetAsAnimal: {ex}"); |
| 61 | + throw; |
| 62 | + } |
| 63 | + finally |
| 64 | + { |
| 65 | + System.Console.WriteLine("Exiting method UpdatePetAsAnimal."); |
| 66 | + } |
| 67 | + } |
| 68 | + |
| 69 | + /// <summary> |
| 70 | + /// [Protocol Method] Update a pet as an animal |
| 71 | + /// <list type="bullet"> |
| 72 | + /// <item> |
| 73 | + /// <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> |
| 74 | + /// </item> |
| 75 | + /// </list> |
| 76 | + /// </summary> |
| 77 | + /// <param name="content"> The content to send as the body of the request. </param> |
| 78 | + /// <param name="options"> The request options, which can override default behaviors of the client pipeline on a per-call basis. </param> |
| 79 | + /// <exception cref="ArgumentNullException"> <paramref name="content"/> is null. </exception> |
| 80 | + /// <exception cref="ClientResultException"> Service returned a non-success status code. </exception> |
| 81 | + /// <returns> The response returned from the service. </returns> |
| 82 | + public virtual async Task<ClientResult> UpdatePetAsAnimalAsync(BinaryContent content, RequestOptions options = null) |
| 83 | + { |
| 84 | + try |
| 85 | + { |
| 86 | + System.Console.WriteLine("Entering method UpdatePetAsAnimalAsync."); |
| 87 | + Argument.AssertNotNull(content, nameof(content)); |
| 88 | + |
| 89 | + using PipelineMessage message = CreateUpdatePetAsAnimalRequest(content, options); |
| 90 | + return ClientResult.FromResponse(await Pipeline.ProcessMessageAsync(message, options).ConfigureAwait(false)); |
| 91 | + } |
| 92 | + catch (Exception ex) |
| 93 | + { |
| 94 | + System.Console.WriteLine($"An exception was thrown in method UpdatePetAsAnimalAsync: {ex}"); |
| 95 | + throw; |
| 96 | + } |
| 97 | + finally |
| 98 | + { |
| 99 | + System.Console.WriteLine("Exiting method UpdatePetAsAnimalAsync."); |
| 100 | + } |
| 101 | + } |
| 102 | + |
| 103 | + /// <summary> Update a pet as an animal. </summary> |
| 104 | + /// <param name="animal"></param> |
| 105 | + /// <param name="cancellationToken"> The cancellation token that can be used to cancel the operation. </param> |
| 106 | + /// <exception cref="ArgumentNullException"> <paramref name="animal"/> is null. </exception> |
| 107 | + /// <exception cref="ClientResultException"> Service returned a non-success status code. </exception> |
| 108 | + public virtual ClientResult<Animal> UpdatePetAsAnimal(Animal animal, CancellationToken cancellationToken = default) |
| 109 | + { |
| 110 | + try |
| 111 | + { |
| 112 | + System.Console.WriteLine("Entering method UpdatePetAsAnimal."); |
| 113 | + Argument.AssertNotNull(animal, nameof(animal)); |
| 114 | + |
| 115 | + ClientResult result = UpdatePetAsAnimal(animal, cancellationToken.CanBeCanceled ? new RequestOptions { CancellationToken = cancellationToken } : null); |
| 116 | + return ClientResult.FromValue((Animal)result, result.GetRawResponse()); |
| 117 | + } |
| 118 | + catch (Exception ex) |
| 119 | + { |
| 120 | + System.Console.WriteLine($"An exception was thrown in method UpdatePetAsAnimal: {ex}"); |
| 121 | + throw; |
| 122 | + } |
| 123 | + finally |
| 124 | + { |
| 125 | + System.Console.WriteLine("Exiting method UpdatePetAsAnimal."); |
| 126 | + } |
| 127 | + } |
| 128 | + |
| 129 | + /// <summary> Update a pet as an animal. </summary> |
| 130 | + /// <param name="animal"></param> |
| 131 | + /// <param name="cancellationToken"> The cancellation token that can be used to cancel the operation. </param> |
| 132 | + /// <exception cref="ArgumentNullException"> <paramref name="animal"/> is null. </exception> |
| 133 | + /// <exception cref="ClientResultException"> Service returned a non-success status code. </exception> |
| 134 | + public virtual async Task<ClientResult<Animal>> UpdatePetAsAnimalAsync(Animal animal, CancellationToken cancellationToken = default) |
| 135 | + { |
| 136 | + try |
| 137 | + { |
| 138 | + System.Console.WriteLine("Entering method UpdatePetAsAnimalAsync."); |
| 139 | + Argument.AssertNotNull(animal, nameof(animal)); |
| 140 | + |
| 141 | + ClientResult result = await UpdatePetAsAnimalAsync(animal, cancellationToken.CanBeCanceled ? new RequestOptions { CancellationToken = cancellationToken } : null).ConfigureAwait(false); |
| 142 | + return ClientResult.FromValue((Animal)result, result.GetRawResponse()); |
| 143 | + } |
| 144 | + catch (Exception ex) |
| 145 | + { |
| 146 | + System.Console.WriteLine($"An exception was thrown in method UpdatePetAsAnimalAsync: {ex}"); |
| 147 | + throw; |
| 148 | + } |
| 149 | + finally |
| 150 | + { |
| 151 | + System.Console.WriteLine("Exiting method UpdatePetAsAnimalAsync."); |
| 152 | + } |
| 153 | + } |
| 154 | + |
| 155 | + /// <summary> |
| 156 | + /// [Protocol Method] Update a dog as an animal |
| 157 | + /// <list type="bullet"> |
| 158 | + /// <item> |
| 159 | + /// <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> |
| 160 | + /// </item> |
| 161 | + /// </list> |
| 162 | + /// </summary> |
| 163 | + /// <param name="content"> The content to send as the body of the request. </param> |
| 164 | + /// <param name="options"> The request options, which can override default behaviors of the client pipeline on a per-call basis. </param> |
| 165 | + /// <exception cref="ArgumentNullException"> <paramref name="content"/> is null. </exception> |
| 166 | + /// <exception cref="ClientResultException"> Service returned a non-success status code. </exception> |
| 167 | + /// <returns> The response returned from the service. </returns> |
| 168 | + public virtual ClientResult UpdateDogAsAnimal(BinaryContent content, RequestOptions options = null) |
| 169 | + { |
| 170 | + try |
| 171 | + { |
| 172 | + System.Console.WriteLine("Entering method UpdateDogAsAnimal."); |
| 173 | + Argument.AssertNotNull(content, nameof(content)); |
| 174 | + |
| 175 | + using PipelineMessage message = CreateUpdateDogAsAnimalRequest(content, options); |
| 176 | + return ClientResult.FromResponse(Pipeline.ProcessMessage(message, options)); |
| 177 | + } |
| 178 | + catch (Exception ex) |
| 179 | + { |
| 180 | + System.Console.WriteLine($"An exception was thrown in method UpdateDogAsAnimal: {ex}"); |
| 181 | + throw; |
| 182 | + } |
| 183 | + finally |
| 184 | + { |
| 185 | + System.Console.WriteLine("Exiting method UpdateDogAsAnimal."); |
| 186 | + } |
| 187 | + } |
| 188 | + |
| 189 | + /// <summary> |
| 190 | + /// [Protocol Method] Update a dog as an animal |
| 191 | + /// <list type="bullet"> |
| 192 | + /// <item> |
| 193 | + /// <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> |
| 194 | + /// </item> |
| 195 | + /// </list> |
| 196 | + /// </summary> |
| 197 | + /// <param name="content"> The content to send as the body of the request. </param> |
| 198 | + /// <param name="options"> The request options, which can override default behaviors of the client pipeline on a per-call basis. </param> |
| 199 | + /// <exception cref="ArgumentNullException"> <paramref name="content"/> is null. </exception> |
| 200 | + /// <exception cref="ClientResultException"> Service returned a non-success status code. </exception> |
| 201 | + /// <returns> The response returned from the service. </returns> |
| 202 | + public virtual async Task<ClientResult> UpdateDogAsAnimalAsync(BinaryContent content, RequestOptions options = null) |
| 203 | + { |
| 204 | + try |
| 205 | + { |
| 206 | + System.Console.WriteLine("Entering method UpdateDogAsAnimalAsync."); |
| 207 | + Argument.AssertNotNull(content, nameof(content)); |
| 208 | + |
| 209 | + using PipelineMessage message = CreateUpdateDogAsAnimalRequest(content, options); |
| 210 | + return ClientResult.FromResponse(await Pipeline.ProcessMessageAsync(message, options).ConfigureAwait(false)); |
| 211 | + } |
| 212 | + catch (Exception ex) |
| 213 | + { |
| 214 | + System.Console.WriteLine($"An exception was thrown in method UpdateDogAsAnimalAsync: {ex}"); |
| 215 | + throw; |
| 216 | + } |
| 217 | + finally |
| 218 | + { |
| 219 | + System.Console.WriteLine("Exiting method UpdateDogAsAnimalAsync."); |
| 220 | + } |
| 221 | + } |
| 222 | + |
| 223 | + /// <summary> Update a dog as an animal. </summary> |
| 224 | + /// <param name="animal"></param> |
| 225 | + /// <param name="cancellationToken"> The cancellation token that can be used to cancel the operation. </param> |
| 226 | + /// <exception cref="ArgumentNullException"> <paramref name="animal"/> is null. </exception> |
| 227 | + /// <exception cref="ClientResultException"> Service returned a non-success status code. </exception> |
| 228 | + public virtual ClientResult<Animal> UpdateDogAsAnimal(Animal animal, CancellationToken cancellationToken = default) |
| 229 | + { |
| 230 | + try |
| 231 | + { |
| 232 | + System.Console.WriteLine("Entering method UpdateDogAsAnimal."); |
| 233 | + Argument.AssertNotNull(animal, nameof(animal)); |
| 234 | + |
| 235 | + ClientResult result = UpdateDogAsAnimal(animal, cancellationToken.CanBeCanceled ? new RequestOptions { CancellationToken = cancellationToken } : null); |
| 236 | + return ClientResult.FromValue((Animal)result, result.GetRawResponse()); |
| 237 | + } |
| 238 | + catch (Exception ex) |
| 239 | + { |
| 240 | + System.Console.WriteLine($"An exception was thrown in method UpdateDogAsAnimal: {ex}"); |
| 241 | + throw; |
| 242 | + } |
| 243 | + finally |
| 244 | + { |
| 245 | + System.Console.WriteLine("Exiting method UpdateDogAsAnimal."); |
| 246 | + } |
| 247 | + } |
| 248 | + |
| 249 | + /// <summary> Update a dog as an animal. </summary> |
| 250 | + /// <param name="animal"></param> |
| 251 | + /// <param name="cancellationToken"> The cancellation token that can be used to cancel the operation. </param> |
| 252 | + /// <exception cref="ArgumentNullException"> <paramref name="animal"/> is null. </exception> |
| 253 | + /// <exception cref="ClientResultException"> Service returned a non-success status code. </exception> |
| 254 | + public virtual async Task<ClientResult<Animal>> UpdateDogAsAnimalAsync(Animal animal, CancellationToken cancellationToken = default) |
| 255 | + { |
| 256 | + try |
| 257 | + { |
| 258 | + System.Console.WriteLine("Entering method UpdateDogAsAnimalAsync."); |
| 259 | + Argument.AssertNotNull(animal, nameof(animal)); |
| 260 | + |
| 261 | + ClientResult result = await UpdateDogAsAnimalAsync(animal, cancellationToken.CanBeCanceled ? new RequestOptions { CancellationToken = cancellationToken } : null).ConfigureAwait(false); |
| 262 | + return ClientResult.FromValue((Animal)result, result.GetRawResponse()); |
| 263 | + } |
| 264 | + catch (Exception ex) |
| 265 | + { |
| 266 | + System.Console.WriteLine($"An exception was thrown in method UpdateDogAsAnimalAsync: {ex}"); |
| 267 | + throw; |
| 268 | + } |
| 269 | + finally |
| 270 | + { |
| 271 | + System.Console.WriteLine("Exiting method UpdateDogAsAnimalAsync."); |
| 272 | + } |
| 273 | + } |
| 274 | + } |
| 275 | +} |
0 commit comments