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