Пример #1
0
 internal AnalyzeJobState(DateTimeOffset createdDateTime, DateTimeOffset?expirationDateTime, Guid jobId, DateTimeOffset lastUpdateDateTime, State status, string displayName, TasksStateTasks tasks, IReadOnlyList <TextAnalyticsError> errors, RequestStatistics statistics, string nextLink) : base(createdDateTime, expirationDateTime, jobId, lastUpdateDateTime, status, displayName)
 {
     Tasks      = tasks;
     Errors     = errors;
     Statistics = statistics;
     NextLink   = nextLink;
 }
Пример #2
0
 internal AnalyzeJobState(DateTimeOffset createdDateTime, string displayName, DateTimeOffset?expirationDateTime, Guid jobId, DateTimeOffset lastUpdateDateTime, JobStatus status, IReadOnlyList <TextAnalyticsErrorInternal> errors, TextDocumentBatchStatistics statistics, TasksStateTasks tasks, string nextLink) : base(createdDateTime, displayName, expirationDateTime, jobId, lastUpdateDateTime, status)
 {
     Errors     = errors;
     Statistics = statistics;
     Tasks      = tasks;
     NextLink   = nextLink;
 }
        internal TasksState(TasksStateTasks tasks)
        {
            if (tasks == null)
            {
                throw new ArgumentNullException(nameof(tasks));
            }

            Tasks = tasks;
        }
Пример #4
0
        internal AnalyzeJobState(DateTimeOffset createdDateTime, Guid jobId, DateTimeOffset lastUpdateDateTime, State status, TasksStateTasks tasks) : base(createdDateTime, jobId, lastUpdateDateTime, status)
        {
            if (tasks == null)
            {
                throw new ArgumentNullException(nameof(tasks));
            }

            Tasks  = tasks;
            Errors = new ChangeTrackingList <TextAnalyticsError>();
        }
Пример #5
0
        internal static TasksState DeserializeTasksState(JsonElement element)
        {
            TasksStateTasks tasks = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("tasks"))
                {
                    tasks = TasksStateTasks.DeserializeTasksStateTasks(property.Value);
                    continue;
                }
            }
            return(new TasksState(tasks));
        }
Пример #6
0
        internal static AnalyzeJobState DeserializeAnalyzeJobState(JsonElement element)
        {
            TasksStateTasks tasks = default;
            Optional <IReadOnlyList <TextAnalyticsError> > errors = default;
            Optional <RequestStatistics> statistics      = default;
            Optional <string>            nextLink        = default;
            Optional <string>            displayName     = 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("tasks"))
                {
                    tasks = TasksStateTasks.DeserializeTasksStateTasks(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("statistics"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    statistics = RequestStatistics.DeserializeRequestStatistics(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.GetGuid();
                    continue;
                }
                if (property.NameEquals("lastUpdateDateTime"))
                {
                    lastUpdateDateTime = property.Value.GetDateTimeOffset("O");
                    continue;
                }
                if (property.NameEquals("status"))
                {
                    status = property.Value.GetString().ToState();
                    continue;
                }
            }
            return(new AnalyzeJobState(createdDateTime, Optional.ToNullable(expirationDateTime), jobId, lastUpdateDateTime, status, displayName.Value, tasks, Optional.ToList(errors), statistics.Value, nextLink.Value));
        }