internal DocumentLanguage(string id, DetectedLanguage_internal detectedLanguage, IReadOnlyList <TextAnalyticsWarning_internal> warnings, TextDocumentStatistics?statistics) { Id = id; DetectedLanguage = detectedLanguage; Warnings = warnings; Statistics = statistics; }
internal DocumentLanguage(string id, DetectedLanguage_internal detectedLanguage, IEnumerable <TextAnalyticsWarning_internal> warnings) { if (id == null) { throw new ArgumentNullException(nameof(id)); } if (warnings == null) { throw new ArgumentNullException(nameof(warnings)); } Id = id; DetectedLanguage = detectedLanguage; Warnings = warnings.ToList(); }
internal static DocumentLanguage DeserializeDocumentLanguage(JsonElement element) { string id = default; DetectedLanguage_internal detectedLanguage = default; IReadOnlyList <TextAnalyticsWarning_internal> warnings = default; Optional <TextDocumentStatistics> statistics = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id")) { id = property.Value.GetString(); continue; } if (property.NameEquals("detectedLanguage")) { detectedLanguage = DetectedLanguage_internal.DeserializeDetectedLanguage_internal(property.Value); continue; } if (property.NameEquals("warnings")) { List <TextAnalyticsWarning_internal> array = new List <TextAnalyticsWarning_internal>(); foreach (var item in property.Value.EnumerateArray()) { array.Add(TextAnalyticsWarning_internal.DeserializeTextAnalyticsWarning_internal(item)); } warnings = array; continue; } if (property.NameEquals("statistics")) { statistics = TextDocumentStatistics.DeserializeTextDocumentStatistics(property.Value); continue; } } return(new DocumentLanguage(id, detectedLanguage, warnings, Optional.ToNullable(statistics))); }