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

55 lines
1.5 KiB
C#
Raw Normal View History

2024-02-24 21:17:37 +00:00
using BotSharp.Abstraction.Messaging.Enums;
2024-04-18 18:54:43 +00:00
using Newtonsoft.Json;
2024-02-24 21:17:37 +00:00
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-04-18 18:54:43 +00:00
[JsonProperty("rich_type")]
2024-02-24 21:17:37 +00:00
public string RichType => RichTypeEnum.GenericTemplate;
2023-12-18 22:38:12 +00:00
2024-03-22 00:46:51 +00:00
[JsonPropertyName("text")]
2024-04-18 18:54:43 +00:00
[JsonProperty("text")]
2024-04-23 19:02:00 +00:00
[Translate]
2023-12-18 22:38:12 +00:00
public string Text { get; set; } = string.Empty;
2023-11-24 23:26:33 +00:00
[JsonPropertyName("template_type")]
2024-04-18 18:54:43 +00:00
[JsonProperty("template_type")]
public virtual string TemplateType { get; set; } = TemplateTypeEnum.Generic;
[JsonPropertyName("elements")]
2024-04-18 18:54:43 +00:00
[JsonProperty("elements")]
public List<T> Elements { get; set; } = new List<T>();
[JsonPropertyName("is_horizontal")]
2024-04-18 18:54:43 +00:00
[JsonProperty("is_horizontal")]
public bool IsHorizontal { get; set; }
2024-04-08 18:50:06 +00:00
[JsonPropertyName("is_popup")]
2024-04-18 18:54:43 +00:00
[JsonProperty("is_popup")]
2024-04-08 18:50:06 +00:00
public bool IsPopup { get; set; }
[JsonPropertyName("element_type")]
2024-04-18 18:54:43 +00:00
[JsonProperty("element_type")]
public string ElementType => typeof(T).Name;
2023-11-24 23:26:33 +00:00
}
public class GenericElement
{
2024-04-23 19:02:00 +00:00
[Translate]
2023-11-24 23:26:33 +00:00
public string Title { get; set; }
2024-05-08 02:14:01 +00:00
[Translate]
2023-11-24 23:26:33 +00:00
public string Subtitle { get; set; }
2024-04-18 18:54:43 +00:00
2023-11-24 23:26:33 +00:00
[JsonPropertyName("image_url")]
2024-04-18 18:54:43 +00:00
[JsonProperty("image_url")]
2023-11-24 23:26:33 +00:00
public string ImageUrl { get; set; }
2024-04-18 18:54:43 +00:00
2023-11-24 23:26:33 +00:00
[JsonPropertyName("default_action")]
2024-04-18 18:54:43 +00:00
[JsonProperty("default_action")]
2023-11-24 23:26:33 +00:00
public ElementAction DefaultAction { get; set; }
public ElementButton[] Buttons { get; set; }
}