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("targetKind"); writer.WriteStringValue(TargetKind.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(); }
void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) { writer.WriteStartObject(); writer.WritePropertyName("targetKind"); writer.WriteStringValue(TargetKind.ToString()); if (Optional.IsDefined(ApiVersion)) { writer.WritePropertyName("apiVersion"); writer.WriteStringValue(ApiVersion); } writer.WriteEndObject(); }
internal static QuestionAnsweringTargetIntentResult DeserializeQuestionAnsweringTargetIntentResult(JsonElement element) { Optional <object> 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 = property.Value.GetObject(); 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 QuestionAnsweringTargetIntentResult(targetKind, apiVersion.Value, confidenceScore, result.Value)); }
internal static TargetIntentResult DeserializeTargetIntentResult(JsonElement element) { if (element.TryGetProperty("targetKind", out JsonElement discriminator)) { switch (discriminator.GetString()) { case "luis": return(LuisTargetIntentResult.DeserializeLuisTargetIntentResult(element)); case "luis_deepstack": return(DSTargetIntentResult.DeserializeDSTargetIntentResult(element)); case "question_answering": return(QuestionAnsweringTargetIntentResult.DeserializeQuestionAnsweringTargetIntentResult(element)); } } TargetKind targetKind = default; Optional <string> apiVersion = default; double confidenceScore = default; foreach (var property in element.EnumerateObject()) { 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 TargetIntentResult(targetKind, apiVersion.Value, confidenceScore)); }
public static DSTargetIntentResult DSTargetIntentResult(TargetKind targetKind = default, string apiVersion = null, double confidenceScore = default, DeepstackResult result = null) { return(new DSTargetIntentResult(targetKind, apiVersion, confidenceScore, result)); }
public static TargetIntentResult TargetIntentResult(TargetKind targetKind = default, string apiVersion = null, double confidenceScore = default) { return(new TargetIntentResult(targetKind, apiVersion, confidenceScore)); }
public static QuestionAnsweringTargetIntentResult QuestionAnsweringTargetIntentResult(TargetKind targetKind = default, string apiVersion = null, double confidenceScore = default, object result = null) { return(new QuestionAnsweringTargetIntentResult(targetKind, apiVersion, confidenceScore, result)); }