| | 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.Analytics.Synapse.Artifacts.Models |
| | 12 | | { |
| | 13 | | public partial class NotebookCellOutputItem : IUtf8JsonSerializable |
| | 14 | | { |
| | 15 | | void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) |
| | 16 | | { |
| 0 | 17 | | writer.WriteStartObject(); |
| 0 | 18 | | if (Optional.IsDefined(Name)) |
| | 19 | | { |
| 0 | 20 | | writer.WritePropertyName("name"); |
| 0 | 21 | | writer.WriteStringValue(Name); |
| | 22 | | } |
| 0 | 23 | | if (Optional.IsDefined(ExecutionCount)) |
| | 24 | | { |
| 0 | 25 | | writer.WritePropertyName("execution_count"); |
| 0 | 26 | | writer.WriteNumberValue(ExecutionCount.Value); |
| | 27 | | } |
| 0 | 28 | | writer.WritePropertyName("output_type"); |
| 0 | 29 | | writer.WriteStringValue(OutputType.ToString()); |
| 0 | 30 | | if (Optional.IsDefined(Text)) |
| | 31 | | { |
| 0 | 32 | | writer.WritePropertyName("text"); |
| 0 | 33 | | writer.WriteObjectValue(Text); |
| | 34 | | } |
| 0 | 35 | | if (Optional.IsDefined(Data)) |
| | 36 | | { |
| 0 | 37 | | writer.WritePropertyName("data"); |
| 0 | 38 | | writer.WriteObjectValue(Data); |
| | 39 | | } |
| 0 | 40 | | if (Optional.IsDefined(Metadata)) |
| | 41 | | { |
| 0 | 42 | | writer.WritePropertyName("metadata"); |
| 0 | 43 | | writer.WriteObjectValue(Metadata); |
| | 44 | | } |
| 0 | 45 | | writer.WriteEndObject(); |
| 0 | 46 | | } |
| | 47 | |
|
| | 48 | | internal static NotebookCellOutputItem DeserializeNotebookCellOutputItem(JsonElement element) |
| | 49 | | { |
| 0 | 50 | | Optional<string> name = default; |
| 0 | 51 | | Optional<int> executionCount = default; |
| 0 | 52 | | CellOutputType outputType = default; |
| 0 | 53 | | Optional<object> text = default; |
| 0 | 54 | | Optional<object> data = default; |
| 0 | 55 | | Optional<object> metadata = default; |
| 0 | 56 | | foreach (var property in element.EnumerateObject()) |
| | 57 | | { |
| 0 | 58 | | if (property.NameEquals("name")) |
| | 59 | | { |
| 0 | 60 | | name = property.Value.GetString(); |
| 0 | 61 | | continue; |
| | 62 | | } |
| 0 | 63 | | if (property.NameEquals("execution_count")) |
| | 64 | | { |
| 0 | 65 | | executionCount = property.Value.GetInt32(); |
| 0 | 66 | | continue; |
| | 67 | | } |
| 0 | 68 | | if (property.NameEquals("output_type")) |
| | 69 | | { |
| 0 | 70 | | outputType = new CellOutputType(property.Value.GetString()); |
| 0 | 71 | | continue; |
| | 72 | | } |
| 0 | 73 | | if (property.NameEquals("text")) |
| | 74 | | { |
| 0 | 75 | | text = property.Value.GetObject(); |
| 0 | 76 | | continue; |
| | 77 | | } |
| 0 | 78 | | if (property.NameEquals("data")) |
| | 79 | | { |
| 0 | 80 | | data = property.Value.GetObject(); |
| 0 | 81 | | continue; |
| | 82 | | } |
| 0 | 83 | | if (property.NameEquals("metadata")) |
| | 84 | | { |
| 0 | 85 | | metadata = property.Value.GetObject(); |
| | 86 | | continue; |
| | 87 | | } |
| | 88 | | } |
| 0 | 89 | | return new NotebookCellOutputItem(name.Value, Optional.ToNullable(executionCount), outputType, text.Value, d |
| | 90 | | } |
| | 91 | | } |
| | 92 | | } |