internal static HealthcareTaskResult DeserializeHealthcareTaskResult(JsonElement element)
        {
            Optional <HealthcareResult> results = default;
            Optional <IReadOnlyList <TextAnalyticsError> > errors = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("results"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    results = HealthcareResult.DeserializeHealthcareResult(property.Value);
                    continue;
                }
                if (property.NameEquals("errors"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    List <TextAnalyticsError> array = new List <TextAnalyticsError>();
                    foreach (var item in property.Value.EnumerateArray())
                    {
                        array.Add(TextAnalyticsError.DeserializeTextAnalyticsError(item));
                    }
                    errors = array;
                    continue;
                }
            }
            return(new HealthcareTaskResult(results.Value, Optional.ToList(errors)));
        }
Пример #2
0
 internal HealthcareJobState(DateTimeOffset createdDateTime, DateTimeOffset?expirationDateTime, Guid jobId, DateTimeOffset lastUpdateDateTime, State status, HealthcareResult results, IReadOnlyList <TextAnalyticsError> errors, string nextLink) : base(createdDateTime, expirationDateTime, jobId, lastUpdateDateTime, status)
 {
     Results  = results;
     Errors   = errors;
     NextLink = nextLink;
 }
Пример #3
0
 internal HealthcareTaskResult(HealthcareResult results, IReadOnlyList <TextAnalyticsError> errors)
 {
     Results = results;
     Errors  = errors;
 }
Пример #4
0
        internal static HealthcareJobState DeserializeHealthcareJobState(JsonElement element)
        {
            Optional <HealthcareResult> results = default;
            Optional <IReadOnlyList <TextAnalyticsError> > errors = default;
            Optional <string>         nextLink           = default;
            DateTimeOffset            createdDateTime    = default;
            Optional <DateTimeOffset> expirationDateTime = default;
            Guid           jobId = default;
            DateTimeOffset lastUpdateDateTime = default;
            State          status             = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("results"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    results = HealthcareResult.DeserializeHealthcareResult(property.Value);
                    continue;
                }
                if (property.NameEquals("errors"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    List <TextAnalyticsError> array = new List <TextAnalyticsError>();
                    foreach (var item in property.Value.EnumerateArray())
                    {
                        array.Add(TextAnalyticsError.DeserializeTextAnalyticsError(item));
                    }
                    errors = array;
                    continue;
                }
                if (property.NameEquals("@nextLink"))
                {
                    nextLink = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("createdDateTime"))
                {
                    createdDateTime = property.Value.GetDateTimeOffset("O");
                    continue;
                }
                if (property.NameEquals("expirationDateTime"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    expirationDateTime = property.Value.GetDateTimeOffset("O");
                    continue;
                }
                if (property.NameEquals("jobId"))
                {
                    jobId = property.Value.GetGuid();
                    continue;
                }
                if (property.NameEquals("lastUpdateDateTime"))
                {
                    lastUpdateDateTime = property.Value.GetDateTimeOffset("O");
                    continue;
                }
                if (property.NameEquals("status"))
                {
                    status = property.Value.GetString().ToState();
                    continue;
                }
            }
            return(new HealthcareJobState(createdDateTime, Optional.ToNullable(expirationDateTime), jobId, lastUpdateDateTime, status, results.Value, Optional.ToList(errors), nextLink.Value));
        }