void IUtf8JsonSerializable.Write(Utf8JsonWriter writer)
 {
     writer.WriteStartObject();
     if (Optional.IsDefined(Query))
     {
         writer.WritePropertyName("query");
         writer.WriteStringValue(Query);
     }
     if (Optional.IsDefined(CallingOptions))
     {
         writer.WritePropertyName("callingOptions");
         writer.WriteObjectValue(CallingOptions);
     }
     writer.WritePropertyName("targetProjectKind");
     writer.WriteStringValue(TargetProjectKind.ToString());
     if (Optional.IsDefined(ApiVersion))
     {
         writer.WritePropertyName("apiVersion");
         writer.WriteStringValue(ApiVersion);
     }
     foreach (var item in AdditionalProperties)
     {
         writer.WritePropertyName(item.Key);
         writer.WriteObjectValue(item.Value);
     }
     writer.WriteEndObject();
 }
示例#2
0
 void IUtf8JsonSerializable.Write(Utf8JsonWriter writer)
 {
     writer.WriteStartObject();
     writer.WritePropertyName("targetProjectKind");
     writer.WriteStringValue(TargetProjectKind.ToString());
     if (Optional.IsDefined(ApiVersion))
     {
         writer.WritePropertyName("apiVersion");
         writer.WriteStringValue(ApiVersion);
     }
     writer.WriteEndObject();
 }
        internal static TargetIntentResult DeserializeTargetIntentResult(JsonElement element)
        {
            if (element.TryGetProperty("targetProjectKind", out JsonElement discriminator))
            {
                switch (discriminator.GetString())
                {
                case "Conversation": return(ConversationTargetIntentResult.DeserializeConversationTargetIntentResult(element));

                case "Luis": return(LuisTargetIntentResult.DeserializeLuisTargetIntentResult(element));

                case "NonLinked": return(NoneLinkedTargetIntentResult.DeserializeNoneLinkedTargetIntentResult(element));

                case "QuestionAnswering": return(QuestionAnsweringTargetIntentResult.DeserializeQuestionAnsweringTargetIntentResult(element));
                }
            }
            TargetProjectKind targetProjectKind = default;
            Optional <string> apiVersion        = default;
            double            confidenceScore   = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("targetProjectKind"))
                {
                    targetProjectKind = new TargetProjectKind(property.Value.GetString());
                    continue;
                }
                if (property.NameEquals("apiVersion"))
                {
                    apiVersion = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("confidenceScore"))
                {
                    confidenceScore = property.Value.GetDouble();
                    continue;
                }
            }
            return(new TargetIntentResult(targetProjectKind, apiVersion.Value, confidenceScore));
        }
        internal static LuisTargetIntentResult DeserializeLuisTargetIntentResult(JsonElement element)
        {
            Optional <object> result            = default;
            TargetProjectKind targetProjectKind = default;
            Optional <string> apiVersion        = default;
            double            confidenceScore   = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("result"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    result = property.Value.GetObject();
                    continue;
                }
                if (property.NameEquals("targetProjectKind"))
                {
                    targetProjectKind = new TargetProjectKind(property.Value.GetString());
                    continue;
                }
                if (property.NameEquals("apiVersion"))
                {
                    apiVersion = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("confidenceScore"))
                {
                    confidenceScore = property.Value.GetDouble();
                    continue;
                }
            }
            return(new LuisTargetIntentResult(targetProjectKind, apiVersion.Value, confidenceScore, result.Value));
        }
 internal QuestionAnsweringTargetIntentResult(TargetProjectKind targetProjectKind, string apiVersion, double confidence, object result) : base(targetProjectKind, apiVersion, confidence)
 {
     Result            = BinaryData.FromObjectAsJson(result);
     TargetProjectKind = targetProjectKind;
 }
示例#6
0
 public static NoneLinkedTargetIntentResult NoneLinkedTargetIntentResult(TargetProjectKind targetProjectKind = default, string apiVersion = null, double confidence = default, ConversationResult result = null)
 {
     return(new NoneLinkedTargetIntentResult(targetProjectKind, apiVersion, confidence, result));
 }
示例#7
0
 public static QuestionAnsweringTargetIntentResult QuestionAnsweringTargetIntentResult(TargetProjectKind targetProjectKind = default, string apiVersion = null, double confidence = default, AnswersResult result = null)
 {
     return(new QuestionAnsweringTargetIntentResult(targetProjectKind, apiVersion, confidence, result));
 }
示例#8
0
 public static LuisTargetIntentResult LuisTargetIntentResult(TargetProjectKind targetProjectKind = default, string apiVersion = null, double confidence = default, object result = null)
 {
     return(new LuisTargetIntentResult(targetProjectKind, apiVersion, confidence, result));
 }
示例#9
0
 public static TargetIntentResult TargetIntentResult(TargetProjectKind targetProjectKind = default, string apiVersion = null, double confidence = default)
 {
     return(new TargetIntentResult(targetProjectKind, apiVersion, confidence));
 }