| | 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.Text.Json; |
| | 9 | | using Azure.Core; |
| | 10 | |
|
| | 11 | | namespace Azure.Search.Documents.Indexes.Models |
| | 12 | | { |
| | 13 | | public partial class DefaultCognitiveServicesAccount : IUtf8JsonSerializable |
| | 14 | | { |
| | 15 | | void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) |
| | 16 | | { |
| 4 | 17 | | writer.WriteStartObject(); |
| 4 | 18 | | writer.WritePropertyName("@odata.type"); |
| 4 | 19 | | writer.WriteStringValue(ODataType); |
| 4 | 20 | | if (Optional.IsDefined(Description)) |
| | 21 | | { |
| 0 | 22 | | writer.WritePropertyName("description"); |
| 0 | 23 | | writer.WriteStringValue(Description); |
| | 24 | | } |
| 4 | 25 | | writer.WriteEndObject(); |
| 4 | 26 | | } |
| | 27 | |
|
| | 28 | | internal static DefaultCognitiveServicesAccount DeserializeDefaultCognitiveServicesAccount(JsonElement element) |
| | 29 | | { |
| 6 | 30 | | string odataType = default; |
| 6 | 31 | | Optional<string> description = default; |
| 36 | 32 | | foreach (var property in element.EnumerateObject()) |
| | 33 | | { |
| 12 | 34 | | if (property.NameEquals("@odata.type")) |
| | 35 | | { |
| 6 | 36 | | odataType = property.Value.GetString(); |
| 6 | 37 | | continue; |
| | 38 | | } |
| 6 | 39 | | if (property.NameEquals("description")) |
| | 40 | | { |
| 6 | 41 | | description = property.Value.GetString(); |
| | 42 | | continue; |
| | 43 | | } |
| | 44 | | } |
| 6 | 45 | | return new DefaultCognitiveServicesAccount(odataType, description.Value); |
| | 46 | | } |
| | 47 | | } |
| | 48 | | } |