internal static CustomSingleClassificationTaskResult DeserializeCustomSingleClassificationTaskResult(JsonElement element)
        {
            Optional <CustomSingleClassificationResult> results = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("results"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    results = CustomSingleClassificationResult.DeserializeCustomSingleClassificationResult(property.Value);
                    continue;
                }
            }
            return(new CustomSingleClassificationTaskResult(results.Value));
        }
Esempio n. 2
0
        internal static CustomSingleClassificationTasksItem DeserializeCustomSingleClassificationTasksItem(JsonElement element)
        {
            Optional <CustomSingleClassificationResult> results = default;
            DateTimeOffset               lastUpdateDateTime     = default;
            Optional <string>            taskName = default;
            TextAnalyticsOperationStatus status   = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("results"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    results = CustomSingleClassificationResult.DeserializeCustomSingleClassificationResult(property.Value);
                    continue;
                }
                if (property.NameEquals("lastUpdateDateTime"))
                {
                    lastUpdateDateTime = property.Value.GetDateTimeOffset("O");
                    continue;
                }
                if (property.NameEquals("taskName"))
                {
                    taskName = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("status"))
                {
                    status = new TextAnalyticsOperationStatus(property.Value.GetString());
                    continue;
                }
            }
            return(new CustomSingleClassificationTasksItem(lastUpdateDateTime, taskName.Value, status, results.Value));
        }
 internal CustomSingleClassificationTasksItem(DateTimeOffset lastUpdateDateTime, string taskName, TextAnalyticsOperationStatus status, CustomSingleClassificationResult results) : base(lastUpdateDateTime, taskName, status)
 {
     Results = results;
 }