internal static SummaryResultConversationsItem DeserializeSummaryResultConversationsItem(JsonElement element)
        {
            string id = default;
            IList <InputWarning> warnings = default;
            Optional <ConversationStatistics> statistics = default;
            IList <ConversationsSummaryResultSummariesItem> summaries = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("id"))
                {
                    id = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("warnings"))
                {
                    List <InputWarning> array = new List <InputWarning>();
                    foreach (var item in property.Value.EnumerateArray())
                    {
                        array.Add(InputWarning.DeserializeInputWarning(item));
                    }
                    warnings = array;
                    continue;
                }
                if (property.NameEquals("statistics"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    statistics = ConversationStatistics.DeserializeConversationStatistics(property.Value);
                    continue;
                }
                if (property.NameEquals("summaries"))
                {
                    List <ConversationsSummaryResultSummariesItem> array = new List <ConversationsSummaryResultSummariesItem>();
                    foreach (var item in property.Value.EnumerateArray())
                    {
                        array.Add(ConversationsSummaryResultSummariesItem.DeserializeConversationsSummaryResultSummariesItem(item));
                    }
                    summaries = array;
                    continue;
                }
            }
            return(new SummaryResultConversationsItem(summaries, id, warnings, statistics.Value));
        }
Example #2
0
        internal static ConversationsSummaryResult DeserializeConversationsSummaryResult(JsonElement element)
        {
            IList <ConversationsSummaryResultSummariesItem> summaries = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("summaries"))
                {
                    List <ConversationsSummaryResultSummariesItem> array = new List <ConversationsSummaryResultSummariesItem>();
                    foreach (var item in property.Value.EnumerateArray())
                    {
                        array.Add(ConversationsSummaryResultSummariesItem.DeserializeConversationsSummaryResultSummariesItem(item));
                    }
                    summaries = array;
                    continue;
                }
            }
            return(new ConversationsSummaryResult(summaries));
        }