message

package
v2.3.0 Latest Latest
Warning

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

Go to latest
Published: Dec 30, 2022 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewCardMessage

func NewCardMessage(content string) *cardMessage

func NewFeedCardMessage

func NewFeedCardMessage(links []FeedCardLink) feedCardMessage

func NewFileMessage

func NewFileMessage(mediaId string) *fileMessage

func NewImageMessages

func NewImageMessages(mediaId string) *imageMessage

NewImageMessages 文本对象

func NewLinkMessage

func NewLinkMessage(title, desc, mediaId, url string) *linkMessage

func NewMarkDownMessage

func NewMarkDownMessage(title, content string) *markdownMessage

func NewOaMessage

func NewOaMessage(title, bgColor, url, pcUrl string) *oaMessage

NewOaMessage 构建oa消息

func NewTextMessage

func NewTextMessage(context string) *textMessage

NewTextMessage 文本对象

func NewVoiceMessage

func NewVoiceMessage(mediaId string, duration int) *voiceMessage

NewVoiceMessage 语音消息

Types

type Body

type Body struct {
	// 消息体的标题,建议50个字符以内。
	Title string `json:"title,omitempty" validate:"omitempty,max=50"`

	// 消息体的表单,最多显示6个,超过会被隐藏。
	Forms []Form `json:"form,omitempty" validate:"omitempty,lte=6"`

	// 消息体的内容,最多显示3行。
	Content string `json:"content,omitempty"`

	// 图片id,以@开头的
	MediaId string `json:"image,omitempty" validate:"omitempty,startswith=@"`

	// 单行富文本信息
	Rich *Rich `json:"rich,omitempty"`

	// 自定义的作者名字。
	Author string `json:"author,omitempty"`
}

Body 消息体

type CardButton

type CardButton struct {
	// 使用独立跳转ActionCard样式时的按钮的标题,最长20个字符。
	Title string `json:"title,omitempty" validate:"omitempty,max=20"`

	// 使用独立跳转ActionCard样式时的跳转链接。
	Url string `json:"action_url,omitempty" validate:"omitempty,url"`
}

CardButton 卡片按钮

type FeedCardLink struct {
	Title  string `json:"title" validate:"required"`      // 单条信息文本。
	Url    string `json:"messageURL" validate:"required"` // 点击单条信息到跳转链接。
	BkgUrl string `json:"picURL"  validate:"required"`    // 单条信息后面图片的URL。
}

"title": "时代的火车向前开1", "messageURL": "https://www.dingtalk.com/", "picURL": "https://img.alicdn.com/tfs/TB1NwmBEL9TBuNjy1zbXXXpepXa-2400-1218.png"

type Form

type Form struct {
	Key   string `json:"key"`
	Value string `json:"value"`
}

type Message

type Message interface {
	// MessageType 消息类型
	MessageType() string

	String() string
}

Message 消息结构

type Response

type Response struct {
	domain.Response
	MessageId string `json:"messageId"`
}

Response 发送消息返回

type Rich

type Rich struct {
	// 单行富文本信息的数目。
	Num string `json:"num"`

	// 单行富文本信息的单位。
	Unit string `json:"unit"`
}

Rich 单行富文本信息。

type StatusBar

type StatusBar struct {
	// 状态栏文案。
	Value string `json:"status_value,omitempty"`

	// 状态栏背景色,默认为黑色,推荐0xFF加六位颜色值。
	BackColor string `json:"status_bg,omitempty"`
}

StatusBar 消息状态栏。

Jump to

Keyboard shortcuts

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