-
Notifications
You must be signed in to change notification settings - Fork 367
/
InteractiveDocumentElement.cs
44 lines (33 loc) · 1.25 KB
/
InteractiveDocumentElement.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
// Copyright (c) .NET Foundation and contributors. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
using System.Collections.Generic;
using System.Text.Json.Serialization;
namespace Microsoft.DotNet.Interactive.Documents;
public class InteractiveDocumentElement
{
[JsonConstructor]
public InteractiveDocumentElement()
{
Contents = "";
}
public InteractiveDocumentElement(
string? contents = null,
string? kernelName = null,
IEnumerable<InteractiveDocumentOutputElement>? outputs = null)
{
Contents = contents ?? "";
KernelName = kernelName;
Outputs = outputs is { }
? new(outputs)
: new();
}
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public string? Id { get; set; }
public string? KernelName { get; set; }
public string Contents { get; set; }
public List<InteractiveDocumentOutputElement> Outputs { get; } = new();
public int ExecutionOrder { get; set; }
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public IDictionary<string, object>? Metadata { get; set; }
internal string? InferredTargetKernelName { get; set; }
}