using Newtonsoft.Json; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace LineMessaging { // Root myDeserializedClass = JsonConvert.DeserializeObject(myJsonResponse); public interface ITemplateObject { [JsonProperty("type")] TemplateType Type { get; } } public class ButtonTemplateObject : ITemplateObject { public ButtonTemplateObject() { Actions = new List(); ImageSize = "cover"; ImageBackgroundColor = "#FFFFFF"; ImageAspectRatio = "rectangle"; } [JsonProperty("type")] public TemplateType Type => TemplateType.Buttons; [JsonProperty("thumbnailImageUrl")] public string ThumbnailImageUrl { get; set; } [JsonProperty("imageAspectRatio")] public string ImageAspectRatio { get; set; } [JsonProperty("imageSize")] public string ImageSize { get; set; } [JsonProperty("imageBackgroundColor")] public string ImageBackgroundColor { get; set; } [JsonProperty("title")] public string Title { get; set; } [JsonProperty("text")] public string Text { get; set; } [JsonProperty("defaultAction")] public ILineAction DefaultAction { get; set; } [JsonProperty("actions")] public List Actions { get; set; } } }