Beispiel #1
0
        internal static CustomEntitiesTaskResult DeserializeCustomEntitiesTaskResult(JsonElement element)
        {
            Optional <CustomEntitiesResult> results = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("results"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    results = CustomEntitiesResult.DeserializeCustomEntitiesResult(property.Value);
                    continue;
                }
            }
            return(new CustomEntitiesTaskResult(results.Value));
        }
        internal static CustomEntityRecognitionLROResult DeserializeCustomEntityRecognitionLROResult(JsonElement element)
        {
            CustomEntitiesResult         results            = default;
            AnalyzeTextLROResultsKind    kind               = default;
            Optional <string>            taskName           = default;
            DateTimeOffset               lastUpdateDateTime = default;
            TextAnalyticsOperationStatus status             = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("results"))
                {
                    results = CustomEntitiesResult.DeserializeCustomEntitiesResult(property.Value);
                    continue;
                }
                if (property.NameEquals("kind"))
                {
                    kind = new AnalyzeTextLROResultsKind(property.Value.GetString());
                    continue;
                }
                if (property.NameEquals("taskName"))
                {
                    taskName = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("lastUpdateDateTime"))
                {
                    lastUpdateDateTime = property.Value.GetDateTimeOffset("O");
                    continue;
                }
                if (property.NameEquals("status"))
                {
                    status = new TextAnalyticsOperationStatus(property.Value.GetString());
                    continue;
                }
            }
            return(new CustomEntityRecognitionLROResult(lastUpdateDateTime, status, kind, taskName.Value, results));
        }