예제 #1
0
        internal static AnalyzeConversationJobStatistics DeserializeAnalyzeConversationJobStatistics(JsonElement element)
        {
            Optional <ConversationRequestStatistics> statistics = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("statistics"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    statistics = ConversationRequestStatistics.DeserializeConversationRequestStatistics(property.Value);
                    continue;
                }
            }
            return(new AnalyzeConversationJobStatistics(statistics.Value));
        }
        internal static AnalyzeConversationJobState DeserializeAnalyzeConversationJobState(JsonElement element)
        {
            ConversationTasksStateTasks tasks = default;
            Optional <ConversationRequestStatistics> statistics = default;
            Optional <string>         displayName        = default;
            DateTimeOffset            createdDateTime    = default;
            Optional <DateTimeOffset> expirationDateTime = default;
            Guid           jobId = default;
            DateTimeOffset lastUpdateDateTime = default;
            JobState       status             = default;
            Optional <IReadOnlyList <GeneratedError> > errors = default;
            Optional <string> nextLink = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("tasks"))
                {
                    tasks = ConversationTasksStateTasks.DeserializeConversationTasksStateTasks(property.Value);
                    continue;
                }
                if (property.NameEquals("statistics"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    statistics = ConversationRequestStatistics.DeserializeConversationRequestStatistics(property.Value);
                    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().ToJobState();
                    continue;
                }
                if (property.NameEquals("errors"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    List <GeneratedError> array = new List <GeneratedError>();
                    foreach (var item in property.Value.EnumerateArray())
                    {
                        array.Add(GeneratedError.DeserializeGeneratedError(item));
                    }
                    errors = array;
                    continue;
                }
                if (property.NameEquals("nextLink"))
                {
                    nextLink = property.Value.GetString();
                    continue;
                }
            }
            return(new AnalyzeConversationJobState(displayName.Value, createdDateTime, Optional.ToNullable(expirationDateTime), jobId, lastUpdateDateTime, status, Optional.ToList(errors), nextLink.Value, tasks, statistics.Value));
        }
예제 #3
0
 internal AnalyzeConversationJobState(string displayName, DateTimeOffset createdDateTime, DateTimeOffset?expirationDateTime, Guid jobId, DateTimeOffset lastUpdateDateTime, JobState status, IReadOnlyList <GeneratedError> errors, string nextLink, ConversationTasksStateTasks tasks, ConversationRequestStatistics statistics) : base(displayName, createdDateTime, expirationDateTime, jobId, lastUpdateDateTime, status, errors, nextLink)
 {
     Tasks      = tasks;
     Statistics = statistics;
 }