| | 1 | | // Copyright (c) Microsoft Corporation. All rights reserved. |
| | 2 | | // Licensed under the MIT License. |
| | 3 | |
|
| | 4 | | // <auto-generated/> |
| | 5 | |
|
| | 6 | | #nullable disable |
| | 7 | |
|
| | 8 | | using System.Collections.Generic; |
| | 9 | | using System.Text.Json; |
| | 10 | | using Azure.Core; |
| | 11 | |
|
| | 12 | | namespace Azure.Search.Documents.Indexes.Models |
| | 13 | | { |
| | 14 | | public partial class SentimentSkill : IUtf8JsonSerializable |
| | 15 | | { |
| | 16 | | void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) |
| | 17 | | { |
| 4 | 18 | | writer.WriteStartObject(); |
| 4 | 19 | | if (Optional.IsDefined(DefaultLanguageCode)) |
| | 20 | | { |
| 4 | 21 | | writer.WritePropertyName("defaultLanguageCode"); |
| 4 | 22 | | writer.WriteStringValue(DefaultLanguageCode.Value.ToString()); |
| | 23 | | } |
| 4 | 24 | | writer.WritePropertyName("@odata.type"); |
| 4 | 25 | | writer.WriteStringValue(ODataType); |
| 4 | 26 | | if (Optional.IsDefined(Name)) |
| | 27 | | { |
| 0 | 28 | | writer.WritePropertyName("name"); |
| 0 | 29 | | writer.WriteStringValue(Name); |
| | 30 | | } |
| 4 | 31 | | if (Optional.IsDefined(Description)) |
| | 32 | | { |
| 0 | 33 | | writer.WritePropertyName("description"); |
| 0 | 34 | | writer.WriteStringValue(Description); |
| | 35 | | } |
| 4 | 36 | | if (Optional.IsDefined(Context)) |
| | 37 | | { |
| 4 | 38 | | writer.WritePropertyName("context"); |
| 4 | 39 | | writer.WriteStringValue(Context); |
| | 40 | | } |
| 4 | 41 | | writer.WritePropertyName("inputs"); |
| 4 | 42 | | writer.WriteStartArray(); |
| 24 | 43 | | foreach (var item in Inputs) |
| | 44 | | { |
| 8 | 45 | | writer.WriteObjectValue(item); |
| | 46 | | } |
| 4 | 47 | | writer.WriteEndArray(); |
| 4 | 48 | | writer.WritePropertyName("outputs"); |
| 4 | 49 | | writer.WriteStartArray(); |
| 16 | 50 | | foreach (var item in Outputs) |
| | 51 | | { |
| 4 | 52 | | writer.WriteObjectValue(item); |
| | 53 | | } |
| 4 | 54 | | writer.WriteEndArray(); |
| 4 | 55 | | writer.WriteEndObject(); |
| 4 | 56 | | } |
| | 57 | |
|
| | 58 | | internal static SentimentSkill DeserializeSentimentSkill(JsonElement element) |
| | 59 | | { |
| 6 | 60 | | Optional<SentimentSkillLanguage> defaultLanguageCode = default; |
| 6 | 61 | | string odataType = default; |
| 6 | 62 | | Optional<string> name = default; |
| 6 | 63 | | Optional<string> description = default; |
| 6 | 64 | | Optional<string> context = default; |
| 6 | 65 | | IList<InputFieldMappingEntry> inputs = default; |
| 6 | 66 | | IList<OutputFieldMappingEntry> outputs = default; |
| 96 | 67 | | foreach (var property in element.EnumerateObject()) |
| | 68 | | { |
| 42 | 69 | | if (property.NameEquals("defaultLanguageCode")) |
| | 70 | | { |
| 6 | 71 | | defaultLanguageCode = new SentimentSkillLanguage(property.Value.GetString()); |
| 6 | 72 | | continue; |
| | 73 | | } |
| 36 | 74 | | if (property.NameEquals("@odata.type")) |
| | 75 | | { |
| 6 | 76 | | odataType = property.Value.GetString(); |
| 6 | 77 | | continue; |
| | 78 | | } |
| 30 | 79 | | if (property.NameEquals("name")) |
| | 80 | | { |
| 6 | 81 | | name = property.Value.GetString(); |
| 6 | 82 | | continue; |
| | 83 | | } |
| 24 | 84 | | if (property.NameEquals("description")) |
| | 85 | | { |
| 6 | 86 | | description = property.Value.GetString(); |
| 6 | 87 | | continue; |
| | 88 | | } |
| 18 | 89 | | if (property.NameEquals("context")) |
| | 90 | | { |
| 6 | 91 | | context = property.Value.GetString(); |
| 6 | 92 | | continue; |
| | 93 | | } |
| 12 | 94 | | if (property.NameEquals("inputs")) |
| | 95 | | { |
| 6 | 96 | | List<InputFieldMappingEntry> array = new List<InputFieldMappingEntry>(); |
| 36 | 97 | | foreach (var item in property.Value.EnumerateArray()) |
| | 98 | | { |
| 12 | 99 | | array.Add(InputFieldMappingEntry.DeserializeInputFieldMappingEntry(item)); |
| | 100 | | } |
| 6 | 101 | | inputs = array; |
| 6 | 102 | | continue; |
| | 103 | | } |
| 6 | 104 | | if (property.NameEquals("outputs")) |
| | 105 | | { |
| 6 | 106 | | List<OutputFieldMappingEntry> array = new List<OutputFieldMappingEntry>(); |
| 24 | 107 | | foreach (var item in property.Value.EnumerateArray()) |
| | 108 | | { |
| 6 | 109 | | array.Add(OutputFieldMappingEntry.DeserializeOutputFieldMappingEntry(item)); |
| | 110 | | } |
| 6 | 111 | | outputs = array; |
| | 112 | | continue; |
| | 113 | | } |
| | 114 | | } |
| 6 | 115 | | return new SentimentSkill(odataType, name.Value, description.Value, context.Value, inputs, outputs, Optional |
| | 116 | | } |
| | 117 | | } |
| | 118 | | } |