Documentation
¶
Index ¶
- type Articles
- type CardAction
- type CardMainTitle
- type CardSource
- type EmphasisContent
- type HorizontalContent
- type JumpItem
- type MessageConfig
- func FileMessage(mediaID string) MessageConfig
- func FilePush(fType string) MessageConfig
- func ImageMessage(base64, md5 string) MessageConfig
- func MarkdownMessage(content string) MessageConfig
- func MarkdownV2Message(content string) MessageConfig
- func NewsMessage(articles []Articles) MessageConfig
- func TemplateCardMessage(card TextNoticeCard) MessageConfig
- func TextMessage(content string) MessageConfig
- func VoiceMessage(mediaID string) MessageConfig
- type MessageOption
- type QuoteArea
- type TextNoticeCard
- type WeComConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CardAction ¶
type CardAction struct {
Type int `json:"type"` // 是 卡片跳转类型,1 代表跳转url,2 代表打开小程序
URL string `json:"url,omitempty"` // 否 跳转事件的url,card_action.type是1时必填
AppID string `json:"appid,omitempty"` // 否 跳转事件的小程序的appid,card_action.type是2时必填
PagePath string `json:"pagepath,omitempty"` // 否 跳转事件的小程序的pagepath,card_action.type是2时选填
}
CardAction 整体卡片的点击跳转事件
type CardMainTitle ¶
type CardMainTitle struct {
Title string `json:"title,omitempty"` // 否 一级标题,建议不超过26个字
Desc string `json:"desc,omitempty"` // 否 标题辅助信息,建议不超过30个字
}
CardMainTitle 模版卡片的主要内容
type CardSource ¶
type CardSource struct {
IconURL string `json:"icon_url,omitempty"` // 否 来源图片的url
Desc string `json:"desc,omitempty"` // 否 来源图片的描述,建议不超过13个字
DescColor int `json:"desc_color,omitempty"` // 否 来源文字的颜色,目前支持:0(默认) 灰色,1 黑色,2 红色,3 绿色
}
CardSource 卡片来源样式信息
type EmphasisContent ¶
type EmphasisContent struct {
Title string `json:"title,omitempty"` // 否 关键数据样式的数据内容,建议不超过10个字
Desc string `json:"desc,omitempty"` // 否 关键数据样式的数据描述内容,建议不超过15个字
}
EmphasisContent 关键数据样式
type HorizontalContent ¶
type HorizontalContent struct {
Type int `json:"type,omitempty"` // 否 模版卡片的二级标题信息内容支持的类型,1是url,2是文件附件,3 代表点击跳转成员详情
KeyName string `json:"keyname"` // 是 二级标题,建议不超过5个字
Value string `json:"value,omitempty"` // 否 二级文本,如果horizontal_content_list.type是2,该字段代表文件名称(要包含文件类型),建议不超过26个字
URL string `json:"url,omitempty"` // 否 链接跳转的url,horizontal_content_list.type是1时必填
MediaID string `json:"media_id,omitempty"` // 否 附件的media_id,horizontal_content_list.type是2时必填
UserID string `json:"userid,omitempty"` // 否 成员详情的userid,horizontal_content_list.type是3时必填
}
HorizontalContent 二级标题+文本列表项
type JumpItem ¶
type JumpItem struct {
Type int `json:"type,omitempty"` // 否 跳转链接类型,0或不填代表不是链接,1 代表跳转url,2 代表跳转小程序
Title string `json:"title"` // 是 跳转链接样式的文案内容,建议不超过13个字
URL string `json:"url,omitempty"` // 否 跳转链接的url,jump_list.type是1时必填
AppID string `json:"appid,omitempty"` // 否 跳转链接的小程序的appid,jump_list.type是2时必填
PagePath string `json:"pagepath,omitempty"` // 否 跳转链接的小程序的pagepath,jump_list.type是2时选填
}
JumpItem 跳转指引样式的列表项
type MessageConfig ¶
type MessageConfig struct {
inter.DefaultSendConf
MsgType string `json:"msgtype"` // 消息类型
Content map[string]interface{} `json:"-"`
MentionedList []string `json:"-"` // userid的列表,提醒群中的指定成员(@某个成员),@all表示提醒所有人,如果开发者获取不到userid,可以使用mentioned_mobile_list
MentionedMobileList []string `json:"-"` // 手机号列表,提醒手机号对应的群成员(@某个成员),@all表示提醒所有人
IsAtAll bool `json:"-"`
FileType string `json:"-"` // 文件类型,分别有语音(voice)和普通文件(file)
}
func FileMessage ¶
func FileMessage(mediaID string) MessageConfig
func FilePush ¶
func FilePush(fType string) MessageConfig
func ImageMessage ¶
func ImageMessage(base64, md5 string) MessageConfig
func MarkdownMessage ¶
func MarkdownMessage(content string) MessageConfig
func MarkdownV2Message ¶
func MarkdownV2Message(content string) MessageConfig
func NewsMessage ¶
func NewsMessage(articles []Articles) MessageConfig
func TemplateCardMessage ¶
func TemplateCardMessage(card TextNoticeCard) MessageConfig
func TextMessage ¶
func TextMessage(content string) MessageConfig
func VoiceMessage ¶
func VoiceMessage(mediaID string) MessageConfig
func (MessageConfig) MarshalJSON ¶
func (m MessageConfig) MarshalJSON() ([]byte, error)
type MessageOption ¶
type MessageOption func(*MessageConfig)
func WithAtAll ¶
func WithAtAll() MessageOption
func WithAtMentionedList ¶
func WithAtMentionedList(mentionedList []string) MessageOption
func WithAtMentionedMobileList ¶
func WithAtMentionedMobileList(mentionedMobileList []string) MessageOption
type QuoteArea ¶
type QuoteArea struct {
Type int `json:"type,omitempty"` // 否 引用文献样式区域点击事件,0或不填代表没有点击事件,1 代表跳转url,2 代表跳转小程序
URL string `json:"url,omitempty"` // 否 点击跳转的url,quote_area.type是1时必填
AppID string `json:"appid,omitempty"` // 否 点击跳转的小程序的appid,quote_area.type是2时必填
PagePath string `json:"pagepath,omitempty"` // 否 点击跳转的小程序的pagepath,quote_area.type是2时选填
Title string `json:"title,omitempty"` // 否 引用文献样式的标题
QuoteText string `json:"quote_text,omitempty"` // 否 引用文献样式的引用文案
}
QuoteArea 引用文献样式
type TextNoticeCard ¶
type TextNoticeCard struct {
CardType string `json:"card_type"` // 是 模版卡片的模版类型,文本通知模版卡片的类型为text_notice
Source *CardSource `json:"source,omitempty"` // 否 卡片来源样式信息,不需要来源样式可不填写
MainTitle CardMainTitle `json:"main_title"` // 是 模版卡片的主要内容,包括一级标题和标题辅助信息
EmphasisContent *EmphasisContent `json:"emphasis_content,omitempty"` // 否 关键数据样式
QuoteArea *QuoteArea `json:"quote_area,omitempty"` // 否 引用文献样式,建议不与关键数据共用
SubTitleText string `json:"sub_title_text,omitempty"` // 否 二级普通文本,建议不超过112个字
HorizontalContentList []HorizontalContent `json:"horizontal_content_list,omitempty"` // 否 二级标题+文本列表,列表长度不超过6
JumpList []JumpItem `json:"jump_list,omitempty"` // 否 跳转指引样式的列表,列表长度不超过3
CardAction CardAction `json:"card_action"` // 是 整体卡片的点击跳转事件
}
TextNoticeCard 文本通知模版卡片
type WeComConfig ¶
type WeComConfig struct {
// contains filtered or unexported fields
}
func NewWeComConfig ¶
func NewWeComConfig(key string) *WeComConfig
func (WeComConfig) SendMsg ¶
func (d WeComConfig) SendMsg(ctx context.Context, sendInter inter.SendInter, opts ...MessageOption) error
func (WeComConfig) UploadMedia ¶
func (d WeComConfig) UploadMedia(filePath, fileType string) (string, error)
Click to show internal directories.
Click to hide internal directories.