From f17e61735614cc8db10abb07ac0aebcd2b5dfcd3 Mon Sep 17 00:00:00 2001 From: chyroc Date: Mon, 18 Dec 2023 13:56:47 +0800 Subject: [PATCH] add: MessageContentCardTemplate --- card/template.go | 11 +++++++++++ type_message_card.go | 16 ++++++++++++++++ 2 files changed, 27 insertions(+) create mode 100644 card/template.go diff --git a/card/template.go b/card/template.go new file mode 100644 index 00000000..cca00194 --- /dev/null +++ b/card/template.go @@ -0,0 +1,11 @@ +package card + +import "github.com/chyroc/lark" + +// Template ... +func Template(id string, variable map[string]interface{}) *lark.MessageContentCardTemplate { + return &lark.MessageContentCardTemplate{ + TemplateID: id, + TemplateVariable: variable, + } +} diff --git a/type_message_card.go b/type_message_card.go index 0d2396c5..9262fe9e 100644 --- a/type_message_card.go +++ b/type_message_card.go @@ -1146,3 +1146,19 @@ type I18NText struct { EnUs string `json:"en_us"` JaJp string `json:"ja_jp"` } + +// MessageContentCardTemplate ... +// +// docs: https://open.feishu.cn/document/ukTMukTMukTM/uYzM3QjL2MzN04iNzcDN/send-message-card/send-message-using-card-id +type MessageContentCardTemplate struct { + TemplateID string `json:"template_id"` + TemplateVariable map[string]interface{} `json:"template_variable"` +} + +// String ... +func (r MessageContentCardTemplate) String() string { + return jsonString(map[string]interface{}{ + "type": "template", + "data": r, + }) +}