| | | 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; |
| | | 9 | | using System.Text.Json; |
| | | 10 | | using Azure.Core; |
| | | 11 | | |
| | | 12 | | namespace Azure.Search.Documents.Indexes.Models |
| | | 13 | | { |
| | | 14 | | public partial class FreshnessScoringParameters : IUtf8JsonSerializable |
| | | 15 | | { |
| | | 16 | | void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) |
| | | 17 | | { |
| | 0 | 18 | | writer.WriteStartObject(); |
| | 0 | 19 | | writer.WritePropertyName("boostingDuration"); |
| | 0 | 20 | | writer.WriteStringValue(BoostingDuration, "P"); |
| | 0 | 21 | | writer.WriteEndObject(); |
| | 0 | 22 | | } |
| | | 23 | | |
| | | 24 | | internal static FreshnessScoringParameters DeserializeFreshnessScoringParameters(JsonElement element) |
| | | 25 | | { |
| | 0 | 26 | | TimeSpan boostingDuration = default; |
| | 0 | 27 | | foreach (var property in element.EnumerateObject()) |
| | | 28 | | { |
| | 0 | 29 | | if (property.NameEquals("boostingDuration")) |
| | | 30 | | { |
| | 0 | 31 | | boostingDuration = property.Value.GetTimeSpan("P"); |
| | | 32 | | continue; |
| | | 33 | | } |
| | | 34 | | } |
| | 0 | 35 | | return new FreshnessScoringParameters(boostingDuration); |
| | | 36 | | } |
| | | 37 | | } |
| | | 38 | | } |