79 lines
2.1 KiB
C#
79 lines
2.1 KiB
C#
using Newtonsoft.Json;
|
|
using Newtonsoft.Json.Converters;
|
|
using Newtonsoft.Json.Linq;
|
|
using System.Collections.Generic;
|
|
using System.Runtime.Serialization;
|
|
|
|
namespace LineMessaging
|
|
{
|
|
[JsonConverter(typeof(StringEnumConverter))]
|
|
public enum FlexContentType
|
|
{
|
|
[EnumMember(Value = "bubble")]
|
|
Bubble,
|
|
}
|
|
public class LineFlexMessage : ILineMessage
|
|
{
|
|
public LineFlexMessage()
|
|
{
|
|
Contents = new LineFlexContent();
|
|
//Contents.Body = new LineFlexBox();
|
|
}
|
|
[JsonProperty("type")]
|
|
public MessageType Type => MessageType.Flex;
|
|
|
|
[JsonProperty("altText")]
|
|
public string AltText { get; set; }
|
|
[JsonProperty("contents")]
|
|
public LineFlexContent Contents { get; set; }
|
|
|
|
|
|
}
|
|
public class LineFlexContent
|
|
{
|
|
[JsonProperty("type")]
|
|
public FlexContentType Type => FlexContentType.Bubble;
|
|
[JsonProperty("header")]
|
|
public ILineFlexObject Header { get; set; }
|
|
[JsonProperty("hero")]
|
|
public ILineFlexObject Hero { get; set; }
|
|
|
|
[JsonProperty("body")]
|
|
public ILineFlexObject Body { get; set; }
|
|
|
|
[JsonProperty("footer")]
|
|
public ILineFlexObject Footer { get; set; }
|
|
|
|
public ICollection<ILineFlexObject> InitHeader()
|
|
{
|
|
var FlexBox = new LineFlexBox();
|
|
this.Header = FlexBox;
|
|
FlexBox.PaddingAll = "sm";
|
|
return FlexBox.Contents;
|
|
}
|
|
|
|
public ICollection<ILineFlexObject> InitHero()
|
|
{
|
|
var FlexBox = new LineFlexBox();
|
|
this.Hero = FlexBox;
|
|
return FlexBox.Contents;
|
|
}
|
|
public ICollection<ILineFlexObject> InitBody()
|
|
{
|
|
var FlexBox = new LineFlexBox();
|
|
FlexBox.PaddingBottom = "none";
|
|
this.Body = FlexBox;
|
|
return FlexBox.Contents;
|
|
}
|
|
|
|
public ICollection<ILineFlexObject> InitFooter()
|
|
{
|
|
var FlexBox = new LineFlexBox();
|
|
this.Footer = FlexBox;
|
|
FlexBox.PaddingAll = "none";
|
|
return FlexBox.Contents;
|
|
}
|
|
|
|
}
|
|
}
|