| | 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 CommonGramTokenFilter : IUtf8JsonSerializable |
| | 15 | | { |
| | 16 | | void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) |
| | 17 | | { |
| 0 | 18 | | writer.WriteStartObject(); |
| 0 | 19 | | writer.WritePropertyName("commonWords"); |
| 0 | 20 | | writer.WriteStartArray(); |
| 0 | 21 | | foreach (var item in CommonWords) |
| | 22 | | { |
| 0 | 23 | | writer.WriteStringValue(item); |
| | 24 | | } |
| 0 | 25 | | writer.WriteEndArray(); |
| 0 | 26 | | if (Optional.IsDefined(IgnoreCase)) |
| | 27 | | { |
| 0 | 28 | | writer.WritePropertyName("ignoreCase"); |
| 0 | 29 | | writer.WriteBooleanValue(IgnoreCase.Value); |
| | 30 | | } |
| 0 | 31 | | if (Optional.IsDefined(UseQueryMode)) |
| | 32 | | { |
| 0 | 33 | | writer.WritePropertyName("queryMode"); |
| 0 | 34 | | writer.WriteBooleanValue(UseQueryMode.Value); |
| | 35 | | } |
| 0 | 36 | | writer.WritePropertyName("@odata.type"); |
| 0 | 37 | | writer.WriteStringValue(ODataType); |
| 0 | 38 | | writer.WritePropertyName("name"); |
| 0 | 39 | | writer.WriteStringValue(Name); |
| 0 | 40 | | writer.WriteEndObject(); |
| 0 | 41 | | } |
| | 42 | |
|
| | 43 | | internal static CommonGramTokenFilter DeserializeCommonGramTokenFilter(JsonElement element) |
| | 44 | | { |
| 0 | 45 | | IList<string> commonWords = default; |
| 0 | 46 | | Optional<bool> ignoreCase = default; |
| 0 | 47 | | Optional<bool> queryMode = default; |
| 0 | 48 | | string odataType = default; |
| 0 | 49 | | string name = default; |
| 0 | 50 | | foreach (var property in element.EnumerateObject()) |
| | 51 | | { |
| 0 | 52 | | if (property.NameEquals("commonWords")) |
| | 53 | | { |
| 0 | 54 | | List<string> array = new List<string>(); |
| 0 | 55 | | foreach (var item in property.Value.EnumerateArray()) |
| | 56 | | { |
| 0 | 57 | | array.Add(item.GetString()); |
| | 58 | | } |
| 0 | 59 | | commonWords = array; |
| 0 | 60 | | continue; |
| | 61 | | } |
| 0 | 62 | | if (property.NameEquals("ignoreCase")) |
| | 63 | | { |
| 0 | 64 | | ignoreCase = property.Value.GetBoolean(); |
| 0 | 65 | | continue; |
| | 66 | | } |
| 0 | 67 | | if (property.NameEquals("queryMode")) |
| | 68 | | { |
| 0 | 69 | | queryMode = property.Value.GetBoolean(); |
| 0 | 70 | | continue; |
| | 71 | | } |
| 0 | 72 | | if (property.NameEquals("@odata.type")) |
| | 73 | | { |
| 0 | 74 | | odataType = property.Value.GetString(); |
| 0 | 75 | | continue; |
| | 76 | | } |
| 0 | 77 | | if (property.NameEquals("name")) |
| | 78 | | { |
| 0 | 79 | | name = property.Value.GetString(); |
| | 80 | | continue; |
| | 81 | | } |
| | 82 | | } |
| 0 | 83 | | return new CommonGramTokenFilter(odataType, name, commonWords, Optional.ToNullable(ignoreCase), Optional.ToN |
| | 84 | | } |
| | 85 | | } |
| | 86 | | } |