diff --git a/source/dotnet/Library/AdaptiveCards/AdaptiveActionSet.cs b/source/dotnet/Library/AdaptiveCards/AdaptiveActionSet.cs index c848cbb3b5..b53b2dda9a 100644 --- a/source/dotnet/Library/AdaptiveCards/AdaptiveActionSet.cs +++ b/source/dotnet/Library/AdaptiveCards/AdaptiveActionSet.cs @@ -32,6 +32,15 @@ public class AdaptiveActionSet : AdaptiveElement [JsonProperty(Required = Required.Default)] public override string Type { get; set; } = TypeName; + /// + /// Horizontal alignment () to use. + /// + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] +#if !NETSTANDARD1_3 + [XmlAttribute] +#endif + public AdaptiveHorizontalAlignment HorizontalAlignment { get; set; } + /// /// The actions contained within this ActionSet. /// @@ -40,6 +49,7 @@ public class AdaptiveActionSet : AdaptiveElement [XmlElement(typeof(AdaptiveOpenUrlAction))] [XmlElement(typeof(AdaptiveShowCardAction))] [XmlElement(typeof(AdaptiveSubmitAction))] + [XmlElement(typeof(AdaptiveHttpAction))] [XmlElement(typeof(AdaptiveToggleVisibilityAction))] [XmlElement(typeof(AdaptiveExecuteAction))] [XmlElement(typeof(AdaptiveUnknownAction))] diff --git a/source/dotnet/Library/AdaptiveCards/AdaptiveCard.cs b/source/dotnet/Library/AdaptiveCards/AdaptiveCard.cs index c645bfd134..90d5a698ec 100644 --- a/source/dotnet/Library/AdaptiveCards/AdaptiveCard.cs +++ b/source/dotnet/Library/AdaptiveCards/AdaptiveCard.cs @@ -190,6 +190,7 @@ public AdaptiveCard() : this(new AdaptiveSchemaVersion(1, 0)) { } [XmlElement(typeof(AdaptiveToggleVisibilityAction))] [XmlElement(typeof(AdaptiveExecuteAction))] [XmlElement(typeof(AdaptiveUnknownAction))] + [XmlElement(typeof(AdaptiveHttpAction))] #endif public List Actions { get; set; } = new List(); @@ -257,6 +258,36 @@ public bool ShouldSerializeJsonSchema() [DefaultValue(null)] public AdaptiveAuthentication Authentication { get; set; } + /// + /// Defines originator id for card. + /// + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] +#if !NETSTANDARD1_3 + [XmlElement] +#endif + [DefaultValue(null)] + public string Originator { get; set; } + + /// + /// Sets the text flow direction + /// + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] +#if !NETSTANDARD1_3 + [XmlElement] +#endif + [DefaultValue(null)] + public bool? Rtl { get; set; } = null; + + /// + /// Tells the client whether or not it should constrain the width of the card. + /// + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] +#if !NETSTANDARD1_3 + [XmlElement] +#endif + [DefaultValue(null)] + public bool? ConstrainWidth { get; set; } = null; + /// /// Determines whether the height property of an AdaptiveCard should be serialized. /// diff --git a/source/dotnet/Library/AdaptiveCards/AdaptiveColumnSet.cs b/source/dotnet/Library/AdaptiveCards/AdaptiveColumnSet.cs index 5ecaeab692..6dfea433ec 100644 --- a/source/dotnet/Library/AdaptiveCards/AdaptiveColumnSet.cs +++ b/source/dotnet/Library/AdaptiveCards/AdaptiveColumnSet.cs @@ -24,6 +24,15 @@ public class AdaptiveColumnSet : AdaptiveCollectionElement #endif public override string Type { get; set; } = TypeName; + /// + /// Horizontal alignment () to use. + /// + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] +#if !NETSTANDARD1_3 + [XmlAttribute] +#endif + public AdaptiveHorizontalAlignment HorizontalAlignment { get; set; } + /// /// Collection of Columns that this ColumnSet contains. /// @@ -33,6 +42,15 @@ public class AdaptiveColumnSet : AdaptiveCollectionElement #endif public List Columns { get; set; } = new List(); + /// + /// Gets or sets the padding. + /// + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] +#if !NETSTANDARD1_3 + [XmlElement] +#endif + public AdaptivePadding Padding { get; set; } + public override IEnumerator GetEnumerator() { return Columns.GetEnumerator(); diff --git a/source/dotnet/Library/AdaptiveCards/AdaptiveContainer.cs b/source/dotnet/Library/AdaptiveCards/AdaptiveContainer.cs index 1e104e5ec9..949e0b0a57 100644 --- a/source/dotnet/Library/AdaptiveCards/AdaptiveContainer.cs +++ b/source/dotnet/Library/AdaptiveCards/AdaptiveContainer.cs @@ -68,6 +68,15 @@ public class AdaptiveContainer : AdaptiveCollectionElement [DefaultValue(null)] public bool? Rtl { get; set; } = null; + /// + /// Gets or sets the padding. + /// + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] +#if !NETSTANDARD1_3 + [XmlElement] +#endif + public AdaptivePadding Padding { get; set; } + public override IEnumerator GetEnumerator() { return Items.GetEnumerator(); diff --git a/source/dotnet/Library/AdaptiveCards/AdaptiveHttpAction.cs b/source/dotnet/Library/AdaptiveCards/AdaptiveHttpAction.cs new file mode 100644 index 0000000000..4cda458f19 --- /dev/null +++ b/source/dotnet/Library/AdaptiveCards/AdaptiveHttpAction.cs @@ -0,0 +1,71 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +using Newtonsoft.Json; +using System.Collections.Generic; +using System.Xml.Serialization; + +namespace AdaptiveCards +{ + /// + /// Represents the Action.Http element. + /// +#if !NETSTANDARD1_3 + [XmlType(TypeName = AdaptiveHttpAction.TypeName)] +#endif + public class AdaptiveHttpAction : AdaptiveAction + { + /// + public const string TypeName = "Action.Http"; + + /// +#if !NETSTANDARD1_3 + [XmlIgnore] +#endif + public override string Type { get; set; } = TypeName; + + /// + /// Http method. + /// + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] +#if !NETSTANDARD1_3 + [XmlAttribute] +#endif + public string Method { get; set; } + + /// + /// Target url for request. + /// + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] +#if !NETSTANDARD1_3 + [XmlAttribute] +#endif + public string Url { get; set; } + + /// + /// Body of request. + /// + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] +#if !NETSTANDARD1_3 + [XmlAttribute] +#endif + public string Body { get; set; } + + /// + /// List of headers. + /// + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] +#if !NETSTANDARD1_3 + [XmlAttribute] +#endif + public List Headers { get; set; } + + /// + /// Adds a to the AdaptiveHttpAction. + /// + public void AddHttpHeader(AdaptiveHttpHeader header) + { + this.Headers ??= new List(); + this.Headers.Add(httpHeader); + } + } +} diff --git a/source/dotnet/Library/AdaptiveCards/AdaptiveHttpHeader.cs b/source/dotnet/Library/AdaptiveCards/AdaptiveHttpHeader.cs new file mode 100644 index 0000000000..812a0be015 --- /dev/null +++ b/source/dotnet/Library/AdaptiveCards/AdaptiveHttpHeader.cs @@ -0,0 +1,42 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +using Newtonsoft.Json; +using System; +using System.ComponentModel; +using System.Xml.Serialization; + +namespace AdaptiveCards +{ + /// + /// Represents the AdaptiveHttpHeader. + /// + public class AdaptiveHttpHeader + { + /// + /// Initializes . + /// + public AdaptiveHttpHeader(string name, string value) + { + Name = name; + Value = value; + } + + /// + /// Gets or sets the header name. + /// + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] +#if !NETSTANDARD1_3 + [XmlAttribute] +#endif + public string Name { get; set; } + + /// + /// Gets or sets the header value. + /// + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] +#if !NETSTANDARD1_3 + [XmlAttribute] +#endif + public string Value { get; set; } + } +} diff --git a/source/dotnet/Library/AdaptiveCards/AdaptivePadding.cs b/source/dotnet/Library/AdaptiveCards/AdaptivePadding.cs new file mode 100644 index 0000000000..76b19701a2 --- /dev/null +++ b/source/dotnet/Library/AdaptiveCards/AdaptivePadding.cs @@ -0,0 +1,70 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +using Newtonsoft.Json; +using System; +using System.ComponentModel; +using System.Xml.Serialization; + +namespace AdaptiveCards +{ + /// + /// Represents padding object. + /// + public class AdaptivePadding + { + /// + /// Initializes . + /// + public AdaptivePadding(AdaptiveSpacing left, AdaptiveSpacing top, AdaptiveSpacing right, AdaptiveSpacing bottom) + { + Left = left; + Right = right; + Top = top; + Bottom = bottom; + } + + /// + /// Initializes . + /// + public AdaptivePadding(AdaptiveSpacing padding) + { + Left = Right = Top = Bottom = padding; + } + + /// + /// Gets or sets the left padding. + /// + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] +#if !NETSTANDARD1_3 + [XmlAttribute] +#endif + public AdaptiveSpacing Left { get; set; } + + /// + /// Gets or sets the right padding. + /// + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] +#if !NETSTANDARD1_3 + [XmlAttribute] +#endif + public AdaptiveSpacing Right { get; set; } + + /// + /// Gets or sets the top padding. + /// + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] +#if !NETSTANDARD1_3 + [XmlAttribute] +#endif + public AdaptiveSpacing Top { get; set; } + + /// + /// Gets or sets the bottom padding. + /// + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] +#if !NETSTANDARD1_3 + [XmlAttribute] +#endif + public AdaptiveSpacing Bottom { get; set; } + } +} diff --git a/source/dotnet/Library/AdaptiveCards/AdaptiveTextInput.cs b/source/dotnet/Library/AdaptiveCards/AdaptiveTextInput.cs index 20a30528b9..725bb76b3c 100644 --- a/source/dotnet/Library/AdaptiveCards/AdaptiveTextInput.cs +++ b/source/dotnet/Library/AdaptiveCards/AdaptiveTextInput.cs @@ -81,6 +81,7 @@ public class AdaptiveTextInput : AdaptiveInput [XmlElement(typeof(AdaptiveOpenUrlAction))] [XmlElement(typeof(AdaptiveShowCardAction))] [XmlElement(typeof(AdaptiveSubmitAction))] + [XmlElement(typeof(AdaptiveHttpAction))] [XmlElement(typeof(AdaptiveToggleVisibilityAction))] [XmlElement(typeof(AdaptiveUnknownAction))] #endif diff --git a/source/dotnet/Library/AdaptiveCards/AdaptiveTypedElementConverter.cs b/source/dotnet/Library/AdaptiveCards/AdaptiveTypedElementConverter.cs index 7f983d4cca..a19860b22e 100644 --- a/source/dotnet/Library/AdaptiveCards/AdaptiveTypedElementConverter.cs +++ b/source/dotnet/Library/AdaptiveCards/AdaptiveTypedElementConverter.cs @@ -49,6 +49,7 @@ public class AdaptiveTypedElementConverter : AdaptiveTypedBaseElementConverter, [AdaptiveTableRow.TypeName] = typeof(AdaptiveTableRow), [AdaptiveTableCell.TypeName] = typeof(AdaptiveTableCell), [AdaptiveSubmitAction.TypeName] = typeof(AdaptiveSubmitAction), + [AdaptiveHttpAction.TypeName] = typeof(AdaptiveHttpAction), [AdaptiveExecuteAction.TypeName] = typeof(AdaptiveExecuteAction), [AdaptiveOpenUrlAction.TypeName] = typeof(AdaptiveOpenUrlAction), [AdaptiveShowCardAction.TypeName] = typeof(AdaptiveShowCardAction), diff --git a/source/dotnet/Library/AdaptiveCards/Rendering/AdaptiveActionHandlers.cs b/source/dotnet/Library/AdaptiveCards/Rendering/AdaptiveActionHandlers.cs index 7c2c33461f..f257bd3f56 100644 --- a/source/dotnet/Library/AdaptiveCards/Rendering/AdaptiveActionHandlers.cs +++ b/source/dotnet/Library/AdaptiveCards/Rendering/AdaptiveActionHandlers.cs @@ -14,6 +14,7 @@ public class AdaptiveActionHandlers { typeof(AdaptiveOpenUrlAction), typeof(AdaptiveSubmitAction), + typeof(AdaptiveHttpAction), typeof(AdaptiveShowCardAction), typeof(AdaptiveToggleVisibilityAction), typeof(AdaptiveExecuteAction) diff --git a/source/dotnet/Library/AdaptiveCards/Rendering/AdaptiveVisitor.cs b/source/dotnet/Library/AdaptiveCards/Rendering/AdaptiveVisitor.cs index 4b4208995b..1353a672a5 100644 --- a/source/dotnet/Library/AdaptiveCards/Rendering/AdaptiveVisitor.cs +++ b/source/dotnet/Library/AdaptiveCards/Rendering/AdaptiveVisitor.cs @@ -139,6 +139,9 @@ public virtual void Visit(AdaptiveAction action) Visit(urlAction); if (action is AdaptiveSubmitAction submitAction) + Visit(submitAction); + + if (action is AdaptiveHttpAction httpAction) Visit(submitAction); if (action is AdaptiveShowCardAction cardAction) @@ -153,6 +156,10 @@ public virtual void Visit(AdaptiveAction action) public virtual void Visit(AdaptiveSubmitAction action) { + } + + public virtual void Visit(AdaptiveHttpAction action) + { } public virtual void Visit(AdaptiveOpenUrlAction action)