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));
        }
示例#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));
        }