| | 1 | | // Copyright (c) Microsoft Corporation. All rights reserved. |
| | 2 | | // Licensed under the MIT License. |
| | 3 | |
|
| | 4 | | // <auto-generated/> |
| | 5 | |
|
| | 6 | | #nullable disable |
| | 7 | |
|
| | 8 | | using System; |
| | 9 | |
|
| | 10 | | namespace Azure.AI.TextAnalytics.Models |
| | 11 | | { |
| | 12 | | internal static class ErrorCodeValueExtensions |
| | 13 | | { |
| 0 | 14 | | public static string ToSerialString(this ErrorCodeValue value) => value switch |
| 0 | 15 | | { |
| 0 | 16 | | ErrorCodeValue.InvalidRequest => "invalidRequest", |
| 0 | 17 | | ErrorCodeValue.InvalidArgument => "invalidArgument", |
| 0 | 18 | | ErrorCodeValue.InternalServerError => "internalServerError", |
| 0 | 19 | | ErrorCodeValue.ServiceUnavailable => "serviceUnavailable", |
| 0 | 20 | | _ => throw new ArgumentOutOfRangeException(nameof(value), value, "Unknown ErrorCodeValue value.") |
| 0 | 21 | | }; |
| | 22 | |
|
| | 23 | | public static ErrorCodeValue ToErrorCodeValue(this string value) |
| | 24 | | { |
| 0 | 25 | | if (string.Equals(value, "invalidRequest", StringComparison.InvariantCultureIgnoreCase)) return ErrorCodeVal |
| 0 | 26 | | if (string.Equals(value, "invalidArgument", StringComparison.InvariantCultureIgnoreCase)) return ErrorCodeVa |
| 0 | 27 | | if (string.Equals(value, "internalServerError", StringComparison.InvariantCultureIgnoreCase)) return ErrorCo |
| 0 | 28 | | if (string.Equals(value, "serviceUnavailable", StringComparison.InvariantCultureIgnoreCase)) return ErrorCod |
| 0 | 29 | | throw new ArgumentOutOfRangeException(nameof(value), value, "Unknown ErrorCodeValue value."); |
| | 30 | | } |
| | 31 | | } |
| | 32 | | } |