internal AnalyzeJobState(DateTimeOffset createdDateTime, DateTimeOffset?expirationDateTime, string jobId, DateTimeOffset lastUpdateDateTime, TextAnalyticsOperationStatus status, string displayName, AnalyzeTasks tasks, IReadOnlyList <TextAnalyticsErrorInternal> errors, TextDocumentBatchStatistics statistics, string nextLink) : base(createdDateTime, expirationDateTime, jobId, lastUpdateDateTime, status, displayName)
 {
     Tasks      = tasks;
     Errors     = errors;
     Statistics = statistics;
     NextLink   = nextLink;
 }
Ejemplo n.º 2
0
        internal TasksState(AnalyzeTasks tasks)
        {
            if (tasks == null)
            {
                throw new ArgumentNullException(nameof(tasks));
            }

            Tasks = tasks;
        }
Ejemplo n.º 3
0
        internal AnalyzeTextJobState(DateTimeOffset createdDateTime, Guid jobId, DateTimeOffset lastUpdateDateTime, TextAnalyticsOperationStatus status, AnalyzeTasks tasks) : base(createdDateTime, jobId, lastUpdateDateTime, status)
        {
            if (tasks == null)
            {
                throw new ArgumentNullException(nameof(tasks));
            }

            Tasks = tasks;
        }
        internal AnalyzeJobState(DateTimeOffset createdDateTime, string jobId, DateTimeOffset lastUpdateDateTime, TextAnalyticsOperationStatus status, AnalyzeTasks tasks) : base(createdDateTime, jobId, lastUpdateDateTime, status)
        {
            if (jobId == null)
            {
                throw new ArgumentNullException(nameof(jobId));
            }
            if (tasks == null)
            {
                throw new ArgumentNullException(nameof(tasks));
            }

            Tasks  = tasks;
            Errors = new ChangeTrackingList <TextAnalyticsErrorInternal>();
        }
        internal static TasksState DeserializeTasksState(JsonElement element)
        {
            AnalyzeTasks tasks = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("tasks"))
                {
                    tasks = AnalyzeTasks.DeserializeAnalyzeTasks(property.Value);
                    continue;
                }
            }
            return(new TasksState(tasks));
        }
Ejemplo n.º 6
0
        internal static AnalyzeJobState DeserializeAnalyzeJobState(JsonElement element)
        {
            AnalyzeTasks tasks = default;
            Optional <IReadOnlyList <TextAnalyticsErrorInternal> > errors = default;
            Optional <TextDocumentBatchStatistics> statistics             = default;
            Optional <string>         nextLink           = default;
            Optional <string>         displayName        = default;
            DateTimeOffset            createdDateTime    = default;
            Optional <DateTimeOffset> expirationDateTime = default;
            string         jobId = default;
            DateTimeOffset lastUpdateDateTime   = default;
            TextAnalyticsOperationStatus status = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("tasks"))
                {
                    tasks = AnalyzeTasks.DeserializeAnalyzeTasks(property.Value);
                    continue;
                }
                if (property.NameEquals("errors"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    List <TextAnalyticsErrorInternal> array = new List <TextAnalyticsErrorInternal>();
                    foreach (var item in property.Value.EnumerateArray())
                    {
                        array.Add(TextAnalyticsErrorInternal.DeserializeTextAnalyticsErrorInternal(item));
                    }
                    errors = array;
                    continue;
                }
                if (property.NameEquals("statistics"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    statistics = TextDocumentBatchStatistics.DeserializeTextDocumentBatchStatistics(property.Value);
                    continue;
                }
                if (property.NameEquals("@nextLink"))
                {
                    nextLink = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("displayName"))
                {
                    displayName = 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.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 AnalyzeJobState(createdDateTime, Optional.ToNullable(expirationDateTime), jobId, lastUpdateDateTime, status, displayName.Value, tasks, Optional.ToList(errors), statistics.Value, nextLink.Value));
        }
Ejemplo n.º 7
0
 internal AnalyzeTextJobState(string displayName, DateTimeOffset createdDateTime, DateTimeOffset?expirationDateTime, Guid jobId, DateTimeOffset lastUpdateDateTime, TextAnalyticsOperationStatus status, IReadOnlyList <Error> errors, string nextLink, AnalyzeTasks tasks, TextDocumentBatchStatistics statistics) : base(displayName, createdDateTime, expirationDateTime, jobId, lastUpdateDateTime, status, errors, nextLink)
 {
     Tasks      = tasks;
     Statistics = statistics;
 }