| | 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.AI.FormRecognizer.Models |
| | 12 | | { |
| | 13 | | internal partial class CopyAuthorizationResult : IUtf8JsonSerializable |
| | 14 | | { |
| | 15 | | void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) |
| | 16 | | { |
| 12 | 17 | | writer.WriteStartObject(); |
| 12 | 18 | | writer.WritePropertyName("modelId"); |
| 12 | 19 | | writer.WriteStringValue(ModelId); |
| 12 | 20 | | writer.WritePropertyName("accessToken"); |
| 12 | 21 | | writer.WriteStringValue(AccessToken); |
| 12 | 22 | | writer.WritePropertyName("expirationDateTimeTicks"); |
| 12 | 23 | | writer.WriteNumberValue(ExpirationDateTimeTicks); |
| 12 | 24 | | writer.WriteEndObject(); |
| 12 | 25 | | } |
| | 26 | |
|
| | 27 | | internal static CopyAuthorizationResult DeserializeCopyAuthorizationResult(JsonElement element) |
| | 28 | | { |
| 20 | 29 | | string modelId = default; |
| 20 | 30 | | string accessToken = default; |
| 20 | 31 | | long expirationDateTimeTicks = default; |
| 160 | 32 | | foreach (var property in element.EnumerateObject()) |
| | 33 | | { |
| 60 | 34 | | if (property.NameEquals("modelId")) |
| | 35 | | { |
| 20 | 36 | | modelId = property.Value.GetString(); |
| 20 | 37 | | continue; |
| | 38 | | } |
| 40 | 39 | | if (property.NameEquals("accessToken")) |
| | 40 | | { |
| 20 | 41 | | accessToken = property.Value.GetString(); |
| 20 | 42 | | continue; |
| | 43 | | } |
| 20 | 44 | | if (property.NameEquals("expirationDateTimeTicks")) |
| | 45 | | { |
| 20 | 46 | | expirationDateTimeTicks = property.Value.GetInt64(); |
| | 47 | | continue; |
| | 48 | | } |
| | 49 | | } |
| 20 | 50 | | return new CopyAuthorizationResult(modelId, accessToken, expirationDateTimeTicks); |
| | 51 | | } |
| | 52 | | } |
| | 53 | | } |