| | 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 DocumentSentimentValueExtensions |
| | 13 | | { |
| 0 | 14 | | public static string ToSerialString(this DocumentSentimentValue value) => value switch |
| 0 | 15 | | { |
| 0 | 16 | | DocumentSentimentValue.Positive => "positive", |
| 0 | 17 | | DocumentSentimentValue.Neutral => "neutral", |
| 0 | 18 | | DocumentSentimentValue.Negative => "negative", |
| 0 | 19 | | DocumentSentimentValue.Mixed => "mixed", |
| 0 | 20 | | _ => throw new ArgumentOutOfRangeException(nameof(value), value, "Unknown DocumentSentimentValue value.") |
| 0 | 21 | | }; |
| | 22 | |
|
| | 23 | | public static DocumentSentimentValue ToDocumentSentimentValue(this string value) |
| | 24 | | { |
| 0 | 25 | | if (string.Equals(value, "positive", StringComparison.InvariantCultureIgnoreCase)) return DocumentSentimentV |
| 0 | 26 | | if (string.Equals(value, "neutral", StringComparison.InvariantCultureIgnoreCase)) return DocumentSentimentVa |
| 0 | 27 | | if (string.Equals(value, "negative", StringComparison.InvariantCultureIgnoreCase)) return DocumentSentimentV |
| 0 | 28 | | if (string.Equals(value, "mixed", StringComparison.InvariantCultureIgnoreCase)) return DocumentSentimentValu |
| 0 | 29 | | throw new ArgumentOutOfRangeException(nameof(value), value, "Unknown DocumentSentimentValue value."); |
| | 30 | | } |
| | 31 | | } |
| | 32 | | } |