Class WeChatWorkTemplateCardBuilder
java.lang.Object
com.bytedesk.core.webhook.channel.WeChatWorkTemplateCardBuilder
企业微信模板卡片构建器
用于构建文本通知和图文展示模板卡片
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionaddHorizontalContent
(String keyname, String value, Integer type, String url, String mediaId, String userid) 添加一个水平内容项添加一个跳转项addVerticalContent
(String title, String desc) 添加一个垂直内容项build()
构建模板卡片cardAction
(Integer type, String url, String appid, String pagepath) 设置整体卡片点击跳转事件设置图片样式(仅图文展示卡片支持)设置卡片类型emphasisContent
(String title, String desc) 设置关键数据样式horizontalContentList
(List<Map<String, Object>> horizontalContents) 设置二级标题+文本列表imageTextArea
(Integer type, String url, String appid, String pagepath, String title, String desc, String imageUrl) 设置左图右文样式(仅图文展示卡片支持)设置跳转指引样式列表设置主标题创建图文展示模板卡片构建器设置引用文献样式设置来源信息subTitleText
(String subTitleText) 设置二级普通文本创建文本通知模板卡片构建器verticalContentList
(List<Map<String, String>> verticalContents) 设置卡片二级垂直内容(仅图文展示卡片支持)
-
Field Details
-
templateCard
-
-
Constructor Details
-
WeChatWorkTemplateCardBuilder
public WeChatWorkTemplateCardBuilder()
-
-
Method Details
-
cardType
设置卡片类型- Parameters:
cardType
- 卡片类型:text_notice(文本通知) 或 news_notice(图文展示)- Returns:
- 构建器实例
-
source
设置来源信息- Parameters:
iconUrl
- 来源图片URLdesc
- 来源描述descColor
- 来源文字颜色:0(默认灰色),1(黑色),2(红色),3(绿色)- Returns:
- 构建器实例
-
mainTitle
设置主标题- Parameters:
title
- 一级标题desc
- 标题辅助信息- Returns:
- 构建器实例
-
emphasisContent
设置关键数据样式- Parameters:
title
- 关键数据内容desc
- 关键数据描述- Returns:
- 构建器实例
-
quoteArea
public WeChatWorkTemplateCardBuilder quoteArea(Integer type, String url, String appid, String pagepath, String title, String quoteText) 设置引用文献样式- Parameters:
type
- 点击事件类型:0(无点击事件),1(跳转URL),2(跳转小程序)url
- 跳转URL(type=1时必填)appid
- 小程序appid(type=2时必填)pagepath
- 小程序pagepath(type=2时选填)title
- 引用文献标题quoteText
- 引用文献内容- Returns:
- 构建器实例
-
subTitleText
设置二级普通文本- Parameters:
subTitleText
- 二级普通文本- Returns:
- 构建器实例
-
cardImage
设置图片样式(仅图文展示卡片支持)- Parameters:
url
- 图片URLaspectRatio
- 图片宽高比- Returns:
- 构建器实例
-
imageTextArea
public WeChatWorkTemplateCardBuilder imageTextArea(Integer type, String url, String appid, String pagepath, String title, String desc, String imageUrl) 设置左图右文样式(仅图文展示卡片支持)- Parameters:
type
- 点击事件类型:0(无点击事件),1(跳转URL),2(跳转小程序)url
- 跳转URL(type=1时必填)appid
- 小程序appid(type=2时必填)pagepath
- 小程序pagepath(type=2时选填)title
- 标题desc
- 描述imageUrl
- 图片URL- Returns:
- 构建器实例
-
verticalContentList
设置卡片二级垂直内容(仅图文展示卡片支持)- Parameters:
verticalContents
- 垂直内容列表- Returns:
- 构建器实例
-
addVerticalContent
添加一个垂直内容项- Parameters:
title
- 标题desc
- 描述- Returns:
- 构建器实例
-
horizontalContentList
public WeChatWorkTemplateCardBuilder horizontalContentList(List<Map<String, Object>> horizontalContents) 设置二级标题+文本列表- Parameters:
horizontalContents
- 水平内容列表- Returns:
- 构建器实例
-
addHorizontalContent
public WeChatWorkTemplateCardBuilder addHorizontalContent(String keyname, String value, Integer type, String url, String mediaId, String userid) 添加一个水平内容项- Parameters:
keyname
- 二级标题value
- 二级文本type
- 内容类型:1(URL),2(文件附件),3(成员详情)url
- 链接URL(type=1时必填)mediaId
- 附件mediaId(type=2时必填)userid
- 成员userid(type=3时必填)- Returns:
- 构建器实例
-
jumpList
设置跳转指引样式列表- Parameters:
jumpList
- 跳转列表- Returns:
- 构建器实例
-
addJumpItem
public WeChatWorkTemplateCardBuilder addJumpItem(String title, Integer type, String url, String appid, String pagepath) 添加一个跳转项- Parameters:
title
- 跳转链接文案type
- 跳转链接类型:0(不是链接),1(跳转URL),2(跳转小程序)url
- 跳转URL(type=1时必填)appid
- 小程序appid(type=2时必填)pagepath
- 小程序pagepath(type=2时选填)- Returns:
- 构建器实例
-
cardAction
public WeChatWorkTemplateCardBuilder cardAction(Integer type, String url, String appid, String pagepath) 设置整体卡片点击跳转事件- Parameters:
type
- 卡片跳转类型:1(跳转URL),2(打开小程序)url
- 跳转URL(type=1时必填)appid
- 小程序appid(type=2时必填)pagepath
- 小程序pagepath(type=2时选填)- Returns:
- 构建器实例
-
build
构建模板卡片- Returns:
- 模板卡片Map
-
textNotice
创建文本通知模板卡片构建器- Returns:
- 构建器实例
-
newsNotice
创建图文展示模板卡片构建器- Returns:
- 构建器实例
-