Ejemplo n.º 1
0
        internal static DSTargetIntentResult DeserializeDSTargetIntentResult(JsonElement element)
        {
            Optional <DeepstackResult> result = default;
            TargetKind        targetKind      = default;
            Optional <string> apiVersion      = default;
            double            confidenceScore = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("result"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        result = null;
                        continue;
                    }
                    result = DeepstackResult.DeserializeDeepstackResult(property.Value);
                    continue;
                }
                if (property.NameEquals("targetKind"))
                {
                    targetKind = new TargetKind(property.Value.GetString());
                    continue;
                }
                if (property.NameEquals("apiVersion"))
                {
                    apiVersion = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("confidenceScore"))
                {
                    confidenceScore = property.Value.GetDouble();
                    continue;
                }
            }
            return(new DSTargetIntentResult(targetKind, apiVersion.Value, confidenceScore, result.Value));
        }
Ejemplo n.º 2
0
 public static DSTargetIntentResult DSTargetIntentResult(TargetKind targetKind = default, string apiVersion = null, double confidenceScore = default, DeepstackResult result = null)
 {
     return(new DSTargetIntentResult(targetKind, apiVersion, confidenceScore, result));
 }