larkrobot

package
v1.3.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 12, 2024 License: AGPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ATag

type ATag struct {
	// Text 	文本内容
	Text string
	// Href 默认的链接地址
	Href string
}

ATag a链接标签

func NewATag

func NewATag(text, href string) *ATag

NewATag create ATag

func (*ATag) ToPostTagMessage

func (tag *ATag) ToPostTagMessage() map[string]interface{}

type ActionElement

type ActionElement interface {
	CardInternal
	// GetActionTag ActionElement tag
	GetActionTag() string
}

ActionElement 交互元素

type AtTag

type AtTag struct {
	// UserId open_id,union_id或user_id
	UserId string
	// UserName 用户姓名
	UserName string
}

AtTag at标签

func NewAtAllAtTag

func NewAtAllAtTag() *AtTag

NewAtAllAtTag create at_all AtTag

func NewAtTag

func NewAtTag(userId string) *AtTag

NewAtTag create AtTag

func (*AtTag) SetUserName

func (tag *AtTag) SetUserName(username string) *AtTag

SetUserName set UserName

func (*AtTag) ToPostTagMessage

func (tag *AtTag) ToPostTagMessage() map[string]interface{}

type ButtonActionElement

type ButtonActionElement struct {
	// Text 按钮中的文本
	Text *CardText
	// Url 跳转链接,和 ButtonActionElement.MultiUrl 互斥
	Url string
	//  MultiUrl 	多端跳转链接
	MultiUrl *UrlElement
	// ButtonType 配置按钮样式,默认为"default"
	ButtonType ButtonType
	// Value 点击后返回业务方,	仅支持key-value形式的json结构,且key为String类型。
	Value map[string]interface{}
	// Confirm 	二次确认的弹框
	Confirm *ConfirmElement
}

ButtonActionElement 交互组件, 可用于内容块的extra字段和交互块的actions字段

func NewButtonActionElement

func NewButtonActionElement(text *CardText) *ButtonActionElement

NewButtonActionElement create ButtonActionElement

func (*ButtonActionElement) GetActionTag

func (button *ButtonActionElement) GetActionTag() string

func (*ButtonActionElement) SetConfirm

func (button *ButtonActionElement) SetConfirm(confirm *ConfirmElement) *ButtonActionElement

SetConfirm set ButtonActionElement.Confirm

func (*ButtonActionElement) SetMultiUrl

func (button *ButtonActionElement) SetMultiUrl(multiUrl *UrlElement) *ButtonActionElement

SetMultiUrl set ButtonActionElement.MultiUrl

func (*ButtonActionElement) SetType

func (button *ButtonActionElement) SetType(buttonType ButtonType) *ButtonActionElement

SetType set ButtonActionElement.ButtonType

func (*ButtonActionElement) SetUrl

func (button *ButtonActionElement) SetUrl(url string) *ButtonActionElement

SetUrl set ButtonActionElement.Url

func (*ButtonActionElement) SetValue

func (button *ButtonActionElement) SetValue(value map[string]interface{}) *ButtonActionElement

SetValue set ButtonActionElement.Value

func (*ButtonActionElement) ToMessage

func (button *ButtonActionElement) ToMessage() map[string]interface{}

type ButtonType

type ButtonType string

ButtonType ButtonActionElement.ButtonType

const (
	// DefaultType  default 次要按钮
	DefaultType ButtonType = "default"
	// PrimaryType  primary 主要按钮
	PrimaryType ButtonType = "primary"
	// DangerType  danger 警示按钮
	DangerType ButtonType = "danger"
)

type CardAction

type CardAction struct {
	// Actions 交互元素
	Actions []ActionElement
	//  Layout 交互元素布局
	Layout LayoutAction
}

CardAction 交互模块

func NewCardAction

func NewCardAction(actions ...ActionElement) *CardAction

NewCardAction create CardAction

func (*CardAction) AddAction

func (action *CardAction) AddAction(actions ...ActionElement) *CardAction

AddAction add CardAction.Actions

func (*CardAction) GetContentTag

func (action *CardAction) GetContentTag() string

func (*CardAction) SetLayout

func (action *CardAction) SetLayout(layout LayoutAction) *CardAction

SetLayout set CardAction.Layout

func (*CardAction) ToMessage

func (action *CardAction) ToMessage() map[string]interface{}

type CardConfig

type CardConfig struct {
	// EnableForward 是否允许卡片被转发,默认 true
	EnableForward bool
	// UpdateMulti 是否为共享卡片,默认为false
	UpdateMulti bool
	// WideScreenMode 是否根据屏幕宽度动态调整消息卡片宽度,默认值为true
	//
	// 2021/03/22之后,此字段废弃,所有卡片均升级为自适应屏幕宽度的宽版卡片
	WideScreenMode bool
}

CardConfig 卡片属性

func NewCardConfig

func NewCardConfig() *CardConfig

NewCardConfig create CardConfig

func (*CardConfig) SetEnableForward

func (config *CardConfig) SetEnableForward(enableForward bool) *CardConfig

SetEnableForward set EnableForward

func (*CardConfig) SetUpdateMulti

func (config *CardConfig) SetUpdateMulti(updateMulti bool) *CardConfig

SetUpdateMulti set UpdateMulti

func (*CardConfig) SetWideScreenMode

func (config *CardConfig) SetWideScreenMode(wideScreenMode bool) *CardConfig

SetWideScreenMode set WideScreenMode

func (*CardConfig) ToMessage

func (config *CardConfig) ToMessage() map[string]interface{}

type CardContent

type CardContent interface {
	CardInternal
	// GetContentTag 卡片内容 tag标签
	GetContentTag() string
}

CardContent 卡片内容

type CardElement

type CardElement struct {
	// Text 单个文本展示,和fields至少要有一个
	Text *CardText
	// Fields 多个文本展示,和text至少要有一个
	Fields []*CardField
	// Extra 附加的元素展示在文本内容右侧
	//
	// 可附加的元素包括image、button、selectMenu、overflow、datePicker
	Extra CardInternal
}

CardElement 内容模块

func NewCardElement

func NewCardElement(text *CardText, fields ...*CardField) *CardElement

NewCardElement create CardElement

func (*CardElement) AddFields

func (card *CardElement) AddFields(field ...*CardField) *CardElement

AddFields add CardElement.Fields

func (*CardElement) GetContentTag

func (card *CardElement) GetContentTag() string

func (*CardElement) SetExtra

func (card *CardElement) SetExtra(extra CardInternal) *CardElement

SetExtra set CardElement.Extra

func (*CardElement) ToMessage

func (card *CardElement) ToMessage() map[string]interface{}

type CardField

type CardField struct {
	// Short 是否并排布局
	Short bool
	// Text 	国际化文本内容
	Text *CardText
}

CardField 用于内容模块的field字段

func NewCardField

func NewCardField(short bool, text *CardText) *CardField

NewCardField create CardField

func (*CardField) ToMessage

func (field *CardField) ToMessage() map[string]interface{}

type CardHeader

type CardHeader struct {
	Title    *CardTitle
	Template CardHeaderTemplate
}

CardHeader 卡片标题

func NewCardHeader

func NewCardHeader(title *CardTitle) *CardHeader

NewCardHeader create CardHeader

func (*CardHeader) SetTemplate

func (header *CardHeader) SetTemplate(template CardHeaderTemplate) *CardHeader

SetTemplate set Template

func (*CardHeader) ToMessage

func (header *CardHeader) ToMessage() map[string]interface{}

type CardHeaderTemplate

type CardHeaderTemplate string

CardHeaderTemplate CardHeader.Template

const (
	// Blue  CardHeader.Template blue
	Blue CardHeaderTemplate = "blue"
	// Wathet  CardHeader.Template wathet
	Wathet CardHeaderTemplate = "wathet"
	// Turquoise  CardHeader.Template turquoise
	Turquoise CardHeaderTemplate = "turquoise"
	// Green  CardHeader.Template green
	Green CardHeaderTemplate = "green"
	// Yellow  CardHeader.Template yellow
	Yellow CardHeaderTemplate = "yellow"
	// Orange  CardHeader.Template orange
	Orange CardHeaderTemplate = "orange"
	// Red  CardHeader.Template red
	Red CardHeaderTemplate = "red"
	// Carmine  CardHeader.Template carmine
	Carmine CardHeaderTemplate = "carmine"
	// Violet  CardHeader.Template violet
	Violet CardHeaderTemplate = "violet"
	// Purple  CardHeader.Template purple
	Purple CardHeaderTemplate = "purple"
	// Indigo  CardHeader.Template indigo
	Indigo CardHeaderTemplate = "indigo"
	// Grey  CardHeader.Template grey
	Grey CardHeaderTemplate = "grey"
)

type CardHr

type CardHr struct {
}

CardHr 分割线模块

func NewCardHr

func NewCardHr() *CardHr

NewCardHr create CardHr

func (*CardHr) GetContentTag

func (hr *CardHr) GetContentTag() string

func (*CardHr) ToMessage

func (hr *CardHr) ToMessage() map[string]interface{}

type CardImage

type CardImage struct {
	// ImageKey 图片资源
	ImageKey string
	// Alt 图片hover说明
	Alt *CardText
	// Preview 点击后是否放大图片,缺省为true
	Preview bool
}

CardImage 作为图片元素被使用 可用于内容块的extra字段和备注块的elements字段。

func NewCardImage

func NewCardImage(imageKye string, alt *CardText) *CardImage

NewCardImage create CardImage

func (*CardImage) GetContentTag

func (image *CardImage) GetContentTag() string

func (*CardImage) SetPreview

func (image *CardImage) SetPreview(preview bool) *CardImage

SetPreview set Preview

func (*CardImage) ToMessage

func (image *CardImage) ToMessage() map[string]interface{}

type CardImg

type CardImg struct {
	// ImgKey 图片资源
	ImgKey string
	// Alt 	hover图片时弹出的Tips文案,content取值为空时则不展示
	Alt *CardText
	// Title 图片标题
	Title *CardText
	// CustomWidth 自定义图片的最大展示宽度
	CustomWidth int
	// CompactWidth 	是否展示为紧凑型的图片 默认为false
	CompactWidth bool
	// Mode 图片显示模式 默认 crop_center
	Mode CardImgMode
	// Preview 点击后是否放大图片,缺省为true
	Preview bool
}

CardImg 图片模块

func NewCardImg

func NewCardImg(ImgKey string, Alt *CardText) *CardImg

NewCardImg create CardImg

func (*CardImg) GetContentTag

func (img *CardImg) GetContentTag() string

func (*CardImg) SetCompactWidth

func (img *CardImg) SetCompactWidth(compactWidth bool) *CardImg

SetCompactWidth set CardImg.CompactWidth

func (*CardImg) SetCustomWidth

func (img *CardImg) SetCustomWidth(customWidth int) *CardImg

SetCustomWidth set CardImg.CustomWidth

func (*CardImg) SetMode

func (img *CardImg) SetMode(mode CardImgMode) *CardImg

SetMode set CardImg.Mode

func (*CardImg) SetPreview

func (img *CardImg) SetPreview(preview bool) *CardImg

SetPreview set CardImg.Preview

func (*CardImg) SetTitle

func (img *CardImg) SetTitle(title *CardText) *CardImg

SetTitle set CardImg.Title

func (*CardImg) ToMessage

func (img *CardImg) ToMessage() map[string]interface{}

type CardImgMode

type CardImgMode string

CardImgMode CardImg.Mode

const (
	// FitHorizontal 平铺模式,宽度撑满卡片完整展示上传的图片。 该属性会覆盖
	FitHorizontal CardImgMode = "fit_horizontal"
	// CropCenter  居中裁剪模式,对长图会限高,并居中裁剪后展示
	CropCenter CardImgMode = "crop_center"
)

type CardInternal

type CardInternal interface {
	// ToMessage to message map
	ToMessage() map[string]interface{}
}

CardInternal card message internal

type CardLinkElement

type CardLinkElement struct {
	*UrlElement
}

CardLinkElement 指定卡片整体的点击跳转链接

func NewCardLinkElement

func NewCardLinkElement(url string) *CardLinkElement

NewCardLinkElement create CardLinkElement

func (*CardLinkElement) SetAndroidUrl

func (element *CardLinkElement) SetAndroidUrl(androidUrl string) *CardLinkElement

SetAndroidUrl set UrlElement.AndroidUrl

func (*CardLinkElement) SetIosUrl

func (element *CardLinkElement) SetIosUrl(iosUrl string) *CardLinkElement

SetIosUrl set UrlElement.IosUrl

func (*CardLinkElement) SetPcUrl

func (element *CardLinkElement) SetPcUrl(pcUrl string) *CardLinkElement

SetPcUrl set UrlElement.PcUrl

func (*CardLinkElement) ToMessage

func (element *CardLinkElement) ToMessage() map[string]interface{}

type CardMarkdown

type CardMarkdown struct {
	// Content 	使用已支持的markdown语法构造markdown内容
	Content string
	// Href 差异化跳转
	Href *UrlElement
	// UrlVal 绑定变量
	UrlVal string
}

CardMarkdown Markdown模块

func NewCardMarkdown

func NewCardMarkdown(content string) *CardMarkdown

NewCardMarkdown create CardMarkdown

func (*CardMarkdown) GetContentTag

func (card *CardMarkdown) GetContentTag() string

func (*CardMarkdown) SetHref

func (card *CardMarkdown) SetHref(url *UrlElement) *CardMarkdown

SetHref set CardMarkdown.Href

func (*CardMarkdown) ToMessageMap

func (card *CardMarkdown) ToMessageMap() map[string]interface{}

type CardNote

type CardNote struct {
	// Elements 备注信息 text对象或image元素
	Elements []CardInternal
}

CardNote 备注模块,用于展示次要信息

使用备注模块来展示用于辅助说明或备注的次要信息,支持小尺寸的图片和文本

func NewCardNote

func NewCardNote(elements ...CardInternal) *CardNote

NewCardNote create CardNote

func (*CardNote) AddElements

func (note *CardNote) AddElements(elements ...CardInternal) *CardNote

AddElements add CardNote.Elements

func (*CardNote) GetContentTag

func (note *CardNote) GetContentTag() string

func (*CardNote) ToMessage

func (note *CardNote) ToMessage() map[string]interface{}

type CardText

type CardText struct {
	// Tag 元素标签
	Tag CardTextTag
	// Content 	文本内容
	Content string
	// Lines 内容显示行数
	Lines int
}

CardText 卡片内容-可内嵌的非交互元素-text

func NewCardText

func NewCardText(tag CardTextTag, content string) *CardText

NewCardText create CardText

func (*CardText) SetLines

func (text *CardText) SetLines(lines int) *CardText

SetLines set CardText Lines

func (*CardText) ToMessage

func (text *CardText) ToMessage() map[string]interface{}

type CardTextTag

type CardTextTag string

CardTextTag 卡片内容-可内嵌的非交互元素-text-tag属性

const (
	// Text 文本
	Text CardTextTag = "plain_text"
	// Md markdown
	Md CardTextTag = "lark_md"
)

type CardTitle

type CardTitle struct {
	// Content 内容
	Content string
	// I18n i18n替换content
	//
	//  "i18n": {
	//      "zh_cn": "中文文本",
	//      "en_us": "English text",
	//      "ja_jp": "日本語文案"
	//     }
	I18n map[string]string
}

CardTitle 标题

func NewCardTitle

func NewCardTitle(content string, i18n map[string]string) *CardTitle

NewCardTitle create CardTitle

func (*CardTitle) SetI18n

func (title *CardTitle) SetI18n(i18n map[string]string) *CardTitle

SetI18n set I18n

func (*CardTitle) ToMessage

func (title *CardTitle) ToMessage() map[string]interface{}

type Client

type Client struct {
	// Webhook robot webhook address
	Webhook string
	// Secret robot secret
	Secret string
	// session id
	SessionID string
}

Client feishu robot client

func NewClient

func NewClient(webhook string) *Client

NewClient create Client

func (*Client) GenSign

func (c *Client) GenSign(secret string, timestamp int64) (string, error)

func (*Client) SendMessage

func (c *Client) SendMessage(message Message) (*Response, error)

func (*Client) SendMessageByUrl

func (c *Client) SendMessageByUrl(url string, message Message) (*Response, error)

func (*Client) SendMessageStr

func (c *Client) SendMessageStr(message string) (*Response, error)

func (*Client) SendMessageStrByUrl

func (c *Client) SendMessageStrByUrl(url, message string) (*Response, error)

type ConfirmElement

type ConfirmElement struct {
	// Title 弹框标题 仅支持"plain_text"
	Title *CardText
	// Text 弹框内容  仅支持"plain_text"
	Text *CardText
}

ConfirmElement 用于交互元素的二次确认

弹框默认提供确定和取消的按钮,无需开发者手动配置

func NewConfirmElement

func NewConfirmElement(title, text *CardText) *ConfirmElement

NewConfirmElement create ConfirmElement

func (*ConfirmElement) ToMessage

func (element *ConfirmElement) ToMessage() map[string]interface{}

type DatePickerActionElement

type DatePickerActionElement struct {
	// Tag tag
	Tag DatePickerTag
	// InitialDate 日期模式的初始值 格式"yyyy-MM-dd"
	InitialDate string
	// InitialTime 时间模式的初始值 格式"HH:mm"
	InitialTime string
	// InitialDatetime 日期时间模式的初始值 	格式"yyyy-MM-dd HH:mm"
	InitialDatetime string
	// Placeholder 占位符,无初始值时必填
	Placeholder *CardText
	// Value 用户选定后返回业务方的数据 JSON
	Value map[string]interface{}
	// Confirm 二次确认的弹框
	Confirm *ConfirmElement
}

DatePickerActionElement 提供时间选择的功能

可用于内容块的extra字段和交互块的actions字段。

func NewDatePickerActionElement

func NewDatePickerActionElement(tag DatePickerTag) *DatePickerActionElement

NewDatePickerActionElement create DatePickerActionElement

func (*DatePickerActionElement) GetActionTag

func (datePicker *DatePickerActionElement) GetActionTag() string

func (*DatePickerActionElement) SetConfirm

func (datePicker *DatePickerActionElement) SetConfirm(confirm *ConfirmElement) *DatePickerActionElement

SetConfirm set DatePickerActionElement.Confirm

func (*DatePickerActionElement) SetInitialDate

func (datePicker *DatePickerActionElement) SetInitialDate(initialDate string) *DatePickerActionElement

SetInitialDate set DatePickerActionElement.InitialDate

func (*DatePickerActionElement) SetInitialDatetime

func (datePicker *DatePickerActionElement) SetInitialDatetime(initialDatetime string) *DatePickerActionElement

SetInitialDatetime set DatePickerActionElement.InitialDatetime

func (*DatePickerActionElement) SetInitialTime

func (datePicker *DatePickerActionElement) SetInitialTime(initialTime string) *DatePickerActionElement

SetInitialTime set DatePickerActionElement.InitialTime

func (*DatePickerActionElement) SetPlaceholder

func (datePicker *DatePickerActionElement) SetPlaceholder(placeholder *CardText) *DatePickerActionElement

SetPlaceholder set DatePickerActionElement.Placeholder

func (*DatePickerActionElement) SetValue

func (datePicker *DatePickerActionElement) SetValue(value map[string]interface{}) *DatePickerActionElement

SetValue set DatePickerActionElement.Value

func (*DatePickerActionElement) ToMessage

func (datePicker *DatePickerActionElement) ToMessage() map[string]interface{}

type DatePickerTag

type DatePickerTag string

DatePickerTag DatePickerActionElement.Tag

const (
	// DatePicker 日期
	DatePicker DatePickerTag = "date_picker"
	// PickerTime 时间
	PickerTime DatePickerTag = "picker_time"
	// PickerDatetime 日期+时间
	PickerDatetime DatePickerTag = "picker_datetime"
)

type I18nInteractiveElement

type I18nInteractiveElement struct {
	// Elements 多语言内容
	//
	//"en_us": [
	//			//English - card content
	//                  {module-1},
	//                  {module-2},
	//                  {module-3},
	//                  ......
	//			],
	//			"zh_cn": [
	//			//Chinese - card content
	//                  {module-1},
	//                  {module-2},
	//                  {module-3},
	//                  ......
	//			],
	Elements map[string][]CardContent
}

I18nInteractiveElement 为卡片的正文部分定义多语言内容

func NewI18nInteractiveElement

func NewI18nInteractiveElement(elements map[string][]CardContent) *I18nInteractiveElement

NewI18nInteractiveElement create I18nInteractiveElement

func (*I18nInteractiveElement) Put

func (element *I18nInteractiveElement) Put(lang string, contents ...CardContent) *I18nInteractiveElement

Put add i18n contents

func (*I18nInteractiveElement) ToMap

func (element *I18nInteractiveElement) ToMap() map[string]interface{}

ToMap to map

type ImageMessage

type ImageMessage struct {
	// ImageKey image_key
	ImageKey string
}

ImageMessage 图片

func NewImageMessage

func NewImageMessage(imageKey string) *ImageMessage

NewImageMessage create ImageMessage

func (*ImageMessage) ToMessageMap

func (image *ImageMessage) ToMessageMap() map[string]interface{}

type ImgTag

type ImgTag struct {
	ImageKey string
}

ImgTag img tag

func NewImgTag

func NewImgTag(imgKey string) *ImgTag

NewImgTag create ImgTag

func (*ImgTag) ToPostTagMessage

func (tag *ImgTag) ToPostTagMessage() map[string]interface{}

type InteractiveMessage

type InteractiveMessage struct {
	// Config 用于描述卡片的功能属性
	Config *CardConfig
	// Header 用于配置卡片标题内容
	Header *CardHeader
	// CarLink 指定卡片整体的点击跳转链接
	CarLink *CardLinkElement
	// Elements 用于定义卡片正文内容
	Elements []CardContent
	// contains filtered or unexported fields
}

InteractiveMessage 消息卡片

func NewInteractiveMessage

func NewInteractiveMessage() *InteractiveMessage

NewInteractiveMessage create InteractiveMessage

func (*InteractiveMessage) AddElements

func (message *InteractiveMessage) AddElements(elements ...CardContent) *InteractiveMessage

AddElements add InteractiveMessage.Elements

func (message *InteractiveMessage) SetCardLink(link *CardLinkElement) *InteractiveMessage

SetCardLink set InteractiveMessage.CarLink

func (*InteractiveMessage) SetConfig

func (message *InteractiveMessage) SetConfig(config *CardConfig) *InteractiveMessage

SetConfig set InteractiveMessage.Config

func (*InteractiveMessage) SetElements

func (message *InteractiveMessage) SetElements(elements ...CardContent) *InteractiveMessage

SetElements set InteractiveMessage.Elements

func (*InteractiveMessage) SetHeader

func (message *InteractiveMessage) SetHeader(header *CardHeader) *InteractiveMessage

SetHeader set InteractiveMessage.Header

func (*InteractiveMessage) SetI18nElements

func (message *InteractiveMessage) SetI18nElements(i18nElements *I18nInteractiveElement) *InteractiveMessage

SetI18nElements set InteractiveMessage.i18nElements

func (*InteractiveMessage) ToMessageMap

func (message *InteractiveMessage) ToMessageMap() map[string]interface{}

type LangPostItem

type LangPostItem struct {
	// Lang language
	Lang string
	// Item PostItems
	Item *PostItems
}

LangPostItem language post item

func NewLangPostItem

func NewLangPostItem(lang string, item *PostItems) *LangPostItem

NewLangPostItem create LangPostItem

func NewZhCnLangPostItem

func NewZhCnLangPostItem(item *PostItems) *LangPostItem

NewZhCnLangPostItem create zh_cn language post item

func (*LangPostItem) ToMessageMap

func (post *LangPostItem) ToMessageMap() map[string]interface{}

type LayoutAction

type LayoutAction string

LayoutAction 交互元素布局

const (
	// Bisected 二等分布局,每行两列交互元素
	Bisected LayoutAction = "bisected"
	// Trisection 三等分布局,每行三列交互元素
	Trisection LayoutAction = "trisection"
	// Flow 流式布局元素会按自身大小横向排列并在空间不够的时候折行
	Flow LayoutAction = "flow"
)

type Message

type Message interface {
	// ToMessageMap for JSON serialization
	ToMessageMap() map[string]interface{}
}

Message feishu robot send message struct

type MsgType

type MsgType string
const (
	// TextMsg 文本类型
	TextMsg MsgType = "text"
	// PostMsg 富文本
	PostMsg MsgType = "post"
	// ImageMsg 图片
	ImageMsg MsgType = "image"
	// InteractiveMsg 卡片
	InteractiveMsg MsgType = "interactive"
)

type OptionElement

type OptionElement struct {
	// Text 选项显示内容,非待选人员时必填
	Text *CardText
	// Value 选项选中后返回业务方的数据,与url或multi_url必填其中一个
	Value string
	// Url *仅支持overflow,跳转指定链接,和multi_url字段互斥
	Url string
	// MultiUrl 	*仅支持overflow,跳转对应链接,和url字段互斥
	MultiUrl *UrlElement
}

OptionElement

作为selectMenu的选项对象

作为overflow的选项对象

func NewOptionElement

func NewOptionElement() *OptionElement

NewOptionElement create OptionElement

func (*OptionElement) SetMultiUrl

func (element *OptionElement) SetMultiUrl(multiUrl *UrlElement) *OptionElement

SetMultiUrl set OptionElement.MultiUrl

func (*OptionElement) SetText

func (element *OptionElement) SetText(text *CardText) *OptionElement

SetText set OptionElement.Text

func (*OptionElement) SetUrl

func (element *OptionElement) SetUrl(url string) *OptionElement

SetUrl set OptionElement.Url

func (*OptionElement) SetValue

func (element *OptionElement) SetValue(value string) *OptionElement

SetValue set OptionElement.Value

func (*OptionElement) ToMessage

func (element *OptionElement) ToMessage() map[string]interface{}

type OverflowActionElement

type OverflowActionElement struct {
	// Options 待选选项
	Options []*OptionElement
	// Value 用户选定后返回业务方的数据
	Value map[string]interface{}
	// Confirm 二次确认的弹框
	Confirm *ConfirmElement
}

OverflowActionElement 提供折叠的按钮型菜单

overflow属于交互元素的一种,可用于内容块的extra字段和交互块的actions字段。

func NewOverflowActionElement

func NewOverflowActionElement(options ...*OptionElement) *OverflowActionElement

NewOverflowActionElement create OverflowActionElement

func (*OverflowActionElement) AddOptions

func (overflow *OverflowActionElement) AddOptions(options ...*OptionElement) *OverflowActionElement

AddOptions add OverflowActionElement.Options

func (*OverflowActionElement) GetActionTag

func (overflow *OverflowActionElement) GetActionTag() string

func (*OverflowActionElement) SetConfirm

func (overflow *OverflowActionElement) SetConfirm(confirm *ConfirmElement) *OverflowActionElement

SetConfirm set OverflowActionElement.Confirm

func (*OverflowActionElement) SetValue

func (overflow *OverflowActionElement) SetValue(value map[string]interface{}) *OverflowActionElement

SetValue set OverflowActionElement.Value

func (*OverflowActionElement) ToMessage

func (overflow *OverflowActionElement) ToMessage() map[string]interface{}

type PostItems

type PostItems struct {
	// Title 标题
	Title string
	// Content  段落
	Content []*PostTags
}

PostItems 富文本 段落

func NewPostItems

func NewPostItems(title string, content ...*PostTags) *PostItems

NewPostItems create PostItems

func (*PostItems) AddContent

func (items *PostItems) AddContent(content ...*PostTags) *PostItems

AddContent add PostItems Content

func (*PostItems) ToMessageMap

func (items *PostItems) ToMessageMap() map[string]interface{}

type PostMessage

type PostMessage struct {
	LangItem []*LangPostItem
}

PostMessage post message

func NewPostMessage

func NewPostMessage(langItem ...*LangPostItem) *PostMessage

NewPostMessage create PostMessage

func (*PostMessage) AddLangItem

func (post *PostMessage) AddLangItem(langItem ...*LangPostItem) *PostMessage

AddLangItem add LangPostItem

func (*PostMessage) ToMessageMap

func (post *PostMessage) ToMessageMap() map[string]interface{}

type PostTag

type PostTag interface {
	// ToPostTagMessage  for JSON serialization
	ToPostTagMessage() map[string]interface{}
}

PostTag 标签

type PostTagType

type PostTagType string

PostTagType 标签

const (
	// TextPostTagType text
	TextPostTagType PostTagType = "text"
	// APostTagType a
	APostTagType PostTagType = "a"
	// AtPostTagType at
	AtPostTagType PostTagType = "at"
	// ImgPostTagType img
	ImgPostTagType PostTagType = "img"
)

type PostTags

type PostTags struct {
	// PostTags post tag
	PostTags []PostTag
}

PostTags post tag list

func NewPostTags

func NewPostTags(tags ...PostTag) *PostTags

NewPostTags create PostTags

func (*PostTags) AddTags

func (tag *PostTags) AddTags(tags ...PostTag) *PostTags

AddTags add post PostTag

func (*PostTags) ToMessageMap

func (tag *PostTags) ToMessageMap() []map[string]interface{}

ToMessageMap to array message map

type Response

type Response struct {
	Code int64  `json:"code"`
	Msg  string `json:"msg"`
}

Response response struct

func (*Response) IsSuccess

func (r *Response) IsSuccess() bool

IsSuccess is success

type SelectMenuActionElement

type SelectMenuActionElement struct {
	// Tag tag
	Tag SelectMenuTag
	// Placeholder 占位符,无默认选项时必须有
	Placeholder *CardText
	// InitialOption 默认选项的value字段值。select_person模式下不支持此配置。
	InitialOption string
	// Options 	待选选项
	Options []*OptionElement
	// Value 用户选定后返回业务方的数据 	key-value形式的json结构,且key为String类型
	Value map[string]interface{}
	// Confirm 	二次确认的弹框
	Confirm *ConfirmElement
}

SelectMenuActionElement 作为selectMenu元素被使用,提供选项菜单的功能

func NewSelectMenuActionElement

func NewSelectMenuActionElement(tag SelectMenuTag) *SelectMenuActionElement

NewSelectMenuActionElement create SelectMenuActionElement

func (*SelectMenuActionElement) AddOptions

func (selectMenu *SelectMenuActionElement) AddOptions(options ...*OptionElement) *SelectMenuActionElement

AddOptions add SelectMenuActionElement.Options

func (*SelectMenuActionElement) GetActionTag

func (selectMenu *SelectMenuActionElement) GetActionTag() string

func (*SelectMenuActionElement) SetConfirm

func (selectMenu *SelectMenuActionElement) SetConfirm(confirm *ConfirmElement) *SelectMenuActionElement

SetConfirm set SelectMenuActionElement.Confirm

func (*SelectMenuActionElement) SetInitialOption

func (selectMenu *SelectMenuActionElement) SetInitialOption(initialOption string) *SelectMenuActionElement

SetInitialOption set SelectMenuActionElement.InitialOption

func (*SelectMenuActionElement) SetOptions

func (selectMenu *SelectMenuActionElement) SetOptions(options ...*OptionElement) *SelectMenuActionElement

SetOptions set SelectMenuActionElement.Options

func (*SelectMenuActionElement) SetPlaceholder

func (selectMenu *SelectMenuActionElement) SetPlaceholder(placeholder *CardText) *SelectMenuActionElement

SetPlaceholder set SelectMenuActionElement.Placeholder

func (*SelectMenuActionElement) SetValue

func (selectMenu *SelectMenuActionElement) SetValue(value map[string]interface{}) *SelectMenuActionElement

SetValue set SelectMenuActionElement.Value

func (*SelectMenuActionElement) ToMessage

func (selectMenu *SelectMenuActionElement) ToMessage() map[string]interface{}

type SelectMenuTag

type SelectMenuTag string

SelectMenuTag SelectMenuActionElement tag

const (
	// SelectStatic  SelectMenuActionElement select_static tag 选项模式
	SelectStatic SelectMenuTag = "select_static"
	// SelectPerson  SelectMenuActionElement select_person tag 选人模式
	SelectPerson SelectMenuTag = "select_person"
)

type TextMessage

type TextMessage struct {
	// Text 文本消息内容
	Text string
	// AtAll 是否@所有人
	AtAll bool
}

TextMessage 文本消息

func NewTextMessage

func NewTextMessage(text string, atAll bool) *TextMessage

NewTextMessage create TextMessage

func (*TextMessage) ToMessageMap

func (text *TextMessage) ToMessageMap() map[string]interface{}

type TextTag

type TextTag struct {
	// Text 文本内容
	Text string
	// UnEscape 表示是不是 unescape 解码,默认为 false ,不用可以不填
	UnEscape bool
}

TextTag 文本标签

func NewTextTag

func NewTextTag(text string) *TextTag

NewTextTag create TextTag

func (*TextTag) SetUnEscape

func (tag *TextTag) SetUnEscape(unEscape bool) *TextTag

SetUnEscape set TextTag UnEscape

func (*TextTag) ToPostTagMessage

func (tag *TextTag) ToPostTagMessage() map[string]interface{}

type UrlElement

type UrlElement struct {
	// Url 	默认跳转链接
	Url string
	// AndroidUrl 	安卓端跳转链接
	AndroidUrl string
	// IosUrl 	ios端跳转链接
	IosUrl string
	// PcUrl 	pc端跳转链接
	PcUrl string
}

UrlElement url对象用作多端差异跳转链接

可用于button的multi_url字段,支持按键点击的多端跳转。

可用于lark_md类型text对象的href字段,支持超链接点击的多端跳转。

func NewUrlElement

func NewUrlElement(url, androidUrl, iosUrl, pcUrl string) *UrlElement

NewUrlElement create UrlElement

func (*UrlElement) ToMessage

func (element *UrlElement) ToMessage() map[string]interface{}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL