BotSharp/src/Infrastructure/BotSharp.Abstraction/Messaging/Models/RichContent/Template/GenericTemplateMessage.cs

36 lines
1 KiB
C#
Raw Normal View History

2024-02-24 21:17:37 +00:00
using BotSharp.Abstraction.Messaging.Enums;
2023-11-24 23:26:33 +00:00
namespace BotSharp.Abstraction.Messaging.Models.RichContent.Template;
public class GenericTemplateMessage<T> : IRichMessage, ITemplateMessage
2023-11-24 23:26:33 +00:00
{
2023-12-18 22:38:12 +00:00
[JsonPropertyName("rich_type")]
2024-02-24 21:17:37 +00:00
public string RichType => RichTypeEnum.GenericTemplate;
2023-12-18 22:38:12 +00:00
[JsonIgnore]
public string Text { get; set; } = string.Empty;
2023-11-24 23:26:33 +00:00
[JsonPropertyName("template_type")]
2024-02-24 21:17:37 +00:00
public string TemplateType => TemplateTypeEnum.Generic;
[JsonPropertyName("elements")]
public List<T> Elements { get; set; } = new List<T>();
[JsonPropertyName("is_horizontal")]
public bool IsHorizontal { get; set; }
[JsonPropertyName("element_type")]
public string ElementType => typeof(T).Name;
2023-11-24 23:26:33 +00:00
}
public class GenericElement
{
public string Title { get; set; }
public string Subtitle { get; set; }
[JsonPropertyName("image_url")]
public string ImageUrl { get; set; }
[JsonPropertyName("default_action")]
public ElementAction DefaultAction { get; set; }
public ElementButton[] Buttons { get; set; }
}