| | 1 | | // Copyright (c) Microsoft Corporation. All rights reserved. |
| | 2 | | // Licensed under the MIT License. |
| | 3 | |
|
| | 4 | | namespace Azure.AI.TextAnalytics |
| | 5 | | { |
| | 6 | | /// <summary> |
| | 7 | | /// Base type for results of Text Analytics operations corresponding to a |
| | 8 | | /// document. If the operation is unsuccessful, the Id and |
| | 9 | | /// Error properties will be populated, but not others. |
| | 10 | | /// </summary> |
| | 11 | | public class TextAnalyticsResult |
| | 12 | | { |
| 292 | 13 | | internal TextAnalyticsResult(string id, TextDocumentStatistics statistics) |
| | 14 | | { |
| 292 | 15 | | Id = id; |
| 292 | 16 | | Statistics = statistics; |
| 292 | 17 | | } |
| | 18 | |
|
| 64 | 19 | | internal TextAnalyticsResult(string id, TextAnalyticsError error) |
| | 20 | | { |
| 64 | 21 | | Id = id; |
| 64 | 22 | | Error = error; |
| 64 | 23 | | } |
| | 24 | |
|
| | 25 | | /// <summary> |
| | 26 | | /// Gets the unique identifier for the document that generated |
| | 27 | | /// the result. |
| | 28 | | /// </summary> |
| 396 | 29 | | public string Id { get; } |
| | 30 | |
|
| | 31 | | /// <summary> |
| | 32 | | /// Gets statistics about the document and how it was processed by |
| | 33 | | /// the service. This property will have a value when IncludeStatistics |
| | 34 | | /// is set to true in the client call. |
| | 35 | | /// </summary> |
| 32 | 36 | | public TextDocumentStatistics Statistics { get; } |
| | 37 | |
|
| | 38 | | /// <summary> |
| | 39 | | /// Gets the error explaining why the operation failed on this |
| | 40 | | /// document. This property will have a value only when the document |
| | 41 | | /// cannot be processed. |
| | 42 | | /// </summary> |
| 564 | 43 | | public TextAnalyticsError Error { get; } |
| | 44 | |
|
| | 45 | | /// <summary> |
| | 46 | | /// Indicates that the document was not successfully processed and an error was returned for this document. |
| | 47 | | /// </summary> |
| 472 | 48 | | public bool HasError => Error.ErrorCode != default; |
| | 49 | | } |
| | 50 | | } |