Example #1
0
        internal static AnalyzeConversationJobResult DeserializeAnalyzeConversationJobResult(JsonElement element)
        {
            if (element.TryGetProperty("kind", out JsonElement discriminator))
            {
                switch (discriminator.GetString())
                {
                case "conversationalPIIResults": return(AnalyzeConversationPIIResult.DeserializeAnalyzeConversationPIIResult(element));

                case "conversationalSummarizationResults": return(AnalyzeConversationSummarizationResult.DeserializeAnalyzeConversationSummarizationResult(element));
                }
            }
            AnalyzeConversationResultsKind kind  = default;
            Optional <string> taskName           = default;
            DateTimeOffset    lastUpdateDateTime = default;
            TaskState         status             = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("kind"))
                {
                    kind = new AnalyzeConversationResultsKind(property.Value.GetString());
                    continue;
                }
                if (property.NameEquals("taskName"))
                {
                    taskName = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("lastUpdateDateTime"))
                {
                    lastUpdateDateTime = property.Value.GetDateTimeOffset("O");
                    continue;
                }
                if (property.NameEquals("status"))
                {
                    status = property.Value.GetString().ToTaskState();
                    continue;
                }
            }
            return(new AnalyzeConversationJobResult(lastUpdateDateTime, status, kind, taskName.Value));
        }
Example #2
0
        internal static AnalyzeConversationPIIResult DeserializeAnalyzeConversationPIIResult(JsonElement element)
        {
            ConversationPIIResults         results = default;
            AnalyzeConversationResultsKind kind    = default;
            Optional <string> taskName             = default;
            DateTimeOffset    lastUpdateDateTime   = default;
            TaskState         status = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("results"))
                {
                    results = ConversationPIIResults.DeserializeConversationPIIResults(property.Value);
                    continue;
                }
                if (property.NameEquals("kind"))
                {
                    kind = new AnalyzeConversationResultsKind(property.Value.GetString());
                    continue;
                }
                if (property.NameEquals("taskName"))
                {
                    taskName = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("lastUpdateDateTime"))
                {
                    lastUpdateDateTime = property.Value.GetDateTimeOffset("O");
                    continue;
                }
                if (property.NameEquals("status"))
                {
                    status = property.Value.GetString().ToTaskState();
                    continue;
                }
            }
            return(new AnalyzeConversationPIIResult(lastUpdateDateTime, status, kind, taskName.Value, results));
        }
 internal AnalyzeConversationPIIResult(DateTimeOffset lastUpdateDateTime, TaskState status, AnalyzeConversationResultsKind kind, string taskName, ConversationPIIResults results) : base(lastUpdateDateTime, status, kind, taskName)
 {
     Results = results;
     Kind    = kind;
 }
 internal AnalyzeConversationJobResult(DateTimeOffset lastUpdateDateTime, TaskState status, AnalyzeConversationResultsKind kind, string taskName) : base(lastUpdateDateTime, status)
 {
     Kind     = kind;
     TaskName = taskName;
 }