34 changed files with 790 additions and 762 deletions
@ -1,75 +1,31 @@ |
|||
using JetBrains.Annotations; |
|||
using Newtonsoft.Json; |
|||
using System.Text.Json.Serialization; |
|||
using Volo.Abp; |
|||
|
|||
namespace LINGYUN.Abp.WeChat.Work.Messages.Models; |
|||
/// <summary>
|
|||
/// 卡片的点击跳转事件
|
|||
/// 卡片操作按钮
|
|||
/// </summary>
|
|||
public class TemplateCardAction |
|||
{ |
|||
/// <summary>
|
|||
/// 卡片跳转类型,1 代表跳转url,2 代表打开小程序。text_notice模版卡片中该字段取值范围为[1,2]
|
|||
/// </summary>
|
|||
[NotNull] |
|||
[JsonProperty("type")] |
|||
[JsonPropertyName("type")] |
|||
public int Type { get; set; } |
|||
/// <summary>
|
|||
/// 跳转链接的url,type是1时必填
|
|||
/// </summary>
|
|||
[CanBeNull] |
|||
[JsonProperty("url")] |
|||
[JsonPropertyName("url")] |
|||
public string Url { get; set; } |
|||
/// <summary>
|
|||
/// 点击跳转的小程序的appid,type是2时必填
|
|||
/// </summary>
|
|||
[CanBeNull] |
|||
[JsonProperty("appid")] |
|||
[JsonPropertyName("appid")] |
|||
public string AppId { get; set; } |
|||
/// <summary>
|
|||
/// 点击跳转的小程序的pagepath,type是2时选填
|
|||
/// </summary>
|
|||
[CanBeNull] |
|||
[JsonProperty("pagepath")] |
|||
[JsonPropertyName("pagepath")] |
|||
public string PagePath { get; set; } |
|||
private TemplateCardAction( |
|||
int type, |
|||
string url = null, |
|||
string appId = null, |
|||
string pagePath = null) |
|||
public TemplateCardAction(string key, string text) |
|||
{ |
|||
Type = type; |
|||
Url = url; |
|||
AppId = appId; |
|||
PagePath = pagePath; |
|||
Key = key; |
|||
Text = text; |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// 创建一个跳转链接卡片事件
|
|||
/// 操作key值,用户点击后,会产生回调事件将本参数作为EventKey返回,回调事件会带上该key值,最长支持1024字节,不可重复
|
|||
/// </summary>
|
|||
/// <param name="url">跳转链接的url</param>
|
|||
/// <returns></returns>
|
|||
public static TemplateCardAction Link(string url) |
|||
{ |
|||
Check.NotNullOrWhiteSpace(url, nameof(url)); |
|||
|
|||
return new TemplateCardAction(1, url); |
|||
} |
|||
[NotNull] |
|||
[JsonProperty("key")] |
|||
[JsonPropertyName("key")] |
|||
public string Key { get; set; } |
|||
/// <summary>
|
|||
/// 创建一个跳转小程序卡片事件
|
|||
/// 操作的描述文案
|
|||
/// </summary>
|
|||
/// <param name="appId">小程序的appid</param>
|
|||
/// <param name="pagePath">小程序的pagePath</param>
|
|||
/// <returns></returns>
|
|||
public static TemplateCardAction MiniProgram(string appId, string pagePath) |
|||
{ |
|||
Check.NotNullOrWhiteSpace(appId, nameof(appId)); |
|||
Check.NotNullOrWhiteSpace(pagePath, nameof(pagePath)); |
|||
|
|||
return new TemplateCardAction(2, appId: appId, pagePath: pagePath); |
|||
} |
|||
} |
|||
[NotNull] |
|||
[JsonProperty("text")] |
|||
[JsonPropertyName("text")] |
|||
public string Text { get; set; } |
|||
} |
|||
@ -0,0 +1,75 @@ |
|||
using JetBrains.Annotations; |
|||
using Newtonsoft.Json; |
|||
using System.Text.Json.Serialization; |
|||
using Volo.Abp; |
|||
|
|||
namespace LINGYUN.Abp.WeChat.Work.Messages.Models; |
|||
/// <summary>
|
|||
/// 卡片的点击跳转事件
|
|||
/// </summary>
|
|||
public class WebhookTemplateCardAction |
|||
{ |
|||
/// <summary>
|
|||
/// 卡片跳转类型,1 代表跳转url,2 代表打开小程序。text_notice模版卡片中该字段取值范围为[1,2]
|
|||
/// </summary>
|
|||
[NotNull] |
|||
[JsonProperty("type")] |
|||
[JsonPropertyName("type")] |
|||
public int Type { get; set; } |
|||
/// <summary>
|
|||
/// 跳转链接的url,type是1时必填
|
|||
/// </summary>
|
|||
[CanBeNull] |
|||
[JsonProperty("url")] |
|||
[JsonPropertyName("url")] |
|||
public string Url { get; set; } |
|||
/// <summary>
|
|||
/// 点击跳转的小程序的appid,type是2时必填
|
|||
/// </summary>
|
|||
[CanBeNull] |
|||
[JsonProperty("appid")] |
|||
[JsonPropertyName("appid")] |
|||
public string AppId { get; set; } |
|||
/// <summary>
|
|||
/// 点击跳转的小程序的pagepath,type是2时选填
|
|||
/// </summary>
|
|||
[CanBeNull] |
|||
[JsonProperty("pagepath")] |
|||
[JsonPropertyName("pagepath")] |
|||
public string PagePath { get; set; } |
|||
private WebhookTemplateCardAction( |
|||
int type, |
|||
string url = null, |
|||
string appId = null, |
|||
string pagePath = null) |
|||
{ |
|||
Type = type; |
|||
Url = url; |
|||
AppId = appId; |
|||
PagePath = pagePath; |
|||
} |
|||
/// <summary>
|
|||
/// 创建一个跳转链接卡片事件
|
|||
/// </summary>
|
|||
/// <param name="url">跳转链接的url</param>
|
|||
/// <returns></returns>
|
|||
public static WebhookTemplateCardAction Link(string url) |
|||
{ |
|||
Check.NotNullOrWhiteSpace(url, nameof(url)); |
|||
|
|||
return new WebhookTemplateCardAction(1, url); |
|||
} |
|||
/// <summary>
|
|||
/// 创建一个跳转小程序卡片事件
|
|||
/// </summary>
|
|||
/// <param name="appId">小程序的appid</param>
|
|||
/// <param name="pagePath">小程序的pagePath</param>
|
|||
/// <returns></returns>
|
|||
public static WebhookTemplateCardAction MiniProgram(string appId, string pagePath) |
|||
{ |
|||
Check.NotNullOrWhiteSpace(appId, nameof(appId)); |
|||
Check.NotNullOrWhiteSpace(pagePath, nameof(pagePath)); |
|||
|
|||
return new WebhookTemplateCardAction(2, appId: appId, pagePath: pagePath); |
|||
} |
|||
} |
|||
@ -0,0 +1,123 @@ |
|||
using JetBrains.Annotations; |
|||
using Newtonsoft.Json; |
|||
using System.Text.Json.Serialization; |
|||
using Volo.Abp; |
|||
|
|||
namespace LINGYUN.Abp.WeChat.Work.Messages.Models; |
|||
/// <summary>
|
|||
/// 二级标题+文本
|
|||
/// </summary>
|
|||
public class WebhookTemplateCardHorizontalContent |
|||
{ |
|||
/// <summary>
|
|||
/// 模版卡片的二级标题信息内容支持的类型,1是url,2是文件附件,3 代表点击跳转成员详情
|
|||
/// </summary>
|
|||
[CanBeNull] |
|||
[JsonProperty("type")] |
|||
[JsonPropertyName("type")] |
|||
public int? Type { get; set; } |
|||
/// <summary>
|
|||
/// 二级标题,建议不超过5个字
|
|||
/// </summary>
|
|||
[NotNull] |
|||
[JsonProperty("keyname")] |
|||
[JsonPropertyName("keyname")] |
|||
public string KeyName { get; set; } |
|||
/// <summary>
|
|||
/// 二级文本,如果type是2,该字段代表文件名称(要包含文件类型),建议不超过26个字
|
|||
/// </summary>
|
|||
[CanBeNull] |
|||
[JsonProperty("value")] |
|||
[JsonPropertyName("value")] |
|||
public string Value { get; set; } |
|||
/// <summary>
|
|||
/// 链接跳转的url,type是1时必填
|
|||
/// </summary>
|
|||
[CanBeNull] |
|||
[JsonProperty("url")] |
|||
[JsonPropertyName("url")] |
|||
public string Url { get; set; } |
|||
/// <summary>
|
|||
/// 附件的media_id,type是2时必填
|
|||
/// </summary>
|
|||
[CanBeNull] |
|||
[JsonProperty("media_id")] |
|||
[JsonPropertyName("media_id")] |
|||
public string MediaId { get; set; } |
|||
/// <summary>
|
|||
/// 成员详情的userid,type是3时必填
|
|||
/// </summary>
|
|||
[CanBeNull] |
|||
[JsonProperty("userid")] |
|||
[JsonPropertyName("userid")] |
|||
public string UserId { get; set; } |
|||
private WebhookTemplateCardHorizontalContent( |
|||
string keyName, |
|||
int? type = null, |
|||
string value = null, |
|||
string url = null, |
|||
string mediaId = null, |
|||
string userId = null) |
|||
{ |
|||
Type = type; |
|||
KeyName = keyName; |
|||
Value = value; |
|||
Url = url; |
|||
MediaId = mediaId; |
|||
UserId = userId; |
|||
} |
|||
/// <summary>
|
|||
/// 创建一个默认二级标题+文本
|
|||
/// </summary>
|
|||
/// <param name="keyName">二级标题</param>
|
|||
/// <param name="value">二级文本</param>
|
|||
/// <returns></returns>
|
|||
public static WebhookTemplateCardHorizontalContent Default(string keyName, string value = null) |
|||
{ |
|||
Check.NotNullOrWhiteSpace(keyName, nameof(keyName)); |
|||
|
|||
return new WebhookTemplateCardHorizontalContent(keyName, value: value); |
|||
} |
|||
/// <summary>
|
|||
/// 创建一个跳转链接的二级标题+文本
|
|||
/// </summary>
|
|||
/// <param name="keyName">二级标题</param>
|
|||
/// <param name="url">链接跳转的url</param>
|
|||
/// <param name="value">二级文本</param>
|
|||
/// <returns></returns>
|
|||
public static WebhookTemplateCardHorizontalContent Link(string keyName, string url, string value = null) |
|||
{ |
|||
Check.NotNullOrWhiteSpace(keyName, nameof(keyName)); |
|||
Check.NotNullOrWhiteSpace(url, nameof(url)); |
|||
|
|||
return new WebhookTemplateCardHorizontalContent(keyName, 1, value: value, url: url); |
|||
} |
|||
/// <summary>
|
|||
/// 创建一个引用文件的二级标题+文本
|
|||
/// </summary>
|
|||
/// <param name="keyName">二级标题</param>
|
|||
/// <param name="fileName">文件名称</param>
|
|||
/// <param name="mediaId">附件的mediaId</param>
|
|||
/// <returns></returns>
|
|||
public static WebhookTemplateCardHorizontalContent File(string keyName, string fileName, string mediaId) |
|||
{ |
|||
Check.NotNullOrWhiteSpace(keyName, nameof(keyName)); |
|||
Check.NotNullOrWhiteSpace(fileName, nameof(fileName)); |
|||
Check.NotNullOrWhiteSpace(mediaId, nameof(mediaId)); |
|||
|
|||
return new WebhookTemplateCardHorizontalContent(keyName, 2, value: fileName, mediaId: mediaId); |
|||
} |
|||
/// <summary>
|
|||
/// 创建一个成员详情的二级标题+文本
|
|||
/// </summary>
|
|||
/// <param name="keyName">二级标题</param>
|
|||
/// <param name="userId">成员的userid</param>
|
|||
/// <returns></returns>
|
|||
public static WebhookTemplateCardHorizontalContent UserInfo(string keyName, string userId) |
|||
{ |
|||
Check.NotNullOrWhiteSpace(keyName, nameof(keyName)); |
|||
Check.NotNullOrWhiteSpace(userId, nameof(userId)); |
|||
|
|||
return new WebhookTemplateCardHorizontalContent(keyName, 3, userId: userId); |
|||
} |
|||
} |
|||
@ -0,0 +1,99 @@ |
|||
using JetBrains.Annotations; |
|||
using Newtonsoft.Json; |
|||
using System.Text.Json.Serialization; |
|||
using Volo.Abp; |
|||
|
|||
namespace LINGYUN.Abp.WeChat.Work.Messages.Models; |
|||
/// <summary>
|
|||
/// 跳转指引样式
|
|||
/// </summary>
|
|||
public class WebhookTemplateCardJump |
|||
{ |
|||
/// <summary>
|
|||
/// 跳转链接类型,0或不填代表不是链接,1 代表跳转url,2 代表跳转小程序
|
|||
/// </summary>
|
|||
[CanBeNull] |
|||
[JsonProperty("type")] |
|||
[JsonPropertyName("type")] |
|||
public int? Type { get; set; } |
|||
/// <summary>
|
|||
/// 跳转链接样式的文案内容,建议不超过13个字
|
|||
/// </summary>
|
|||
[NotNull] |
|||
[JsonProperty("title")] |
|||
[JsonPropertyName("title")] |
|||
public string Title { get; set; } |
|||
/// <summary>
|
|||
/// 跳转链接的url,type是1时必填
|
|||
/// </summary>
|
|||
[CanBeNull] |
|||
[JsonProperty("url")] |
|||
[JsonPropertyName("url")] |
|||
public string Url { get; set; } |
|||
/// <summary>
|
|||
/// 点击跳转的小程序的appid,type是2时必填
|
|||
/// </summary>
|
|||
[CanBeNull] |
|||
[JsonProperty("appid")] |
|||
[JsonPropertyName("appid")] |
|||
public string AppId { get; set; } |
|||
/// <summary>
|
|||
/// 点击跳转的小程序的pagepath,type是2时选填
|
|||
/// </summary>
|
|||
[CanBeNull] |
|||
[JsonProperty("pagepath")] |
|||
[JsonPropertyName("pagepath")] |
|||
public string PagePath { get; set; } |
|||
private WebhookTemplateCardJump( |
|||
string title, |
|||
int? type = null, |
|||
string url = null, |
|||
string appId = null, |
|||
string pagePath = null) |
|||
{ |
|||
Type = type; |
|||
Title = title; |
|||
Url = url; |
|||
AppId = appId; |
|||
PagePath = pagePath; |
|||
} |
|||
/// <summary>
|
|||
/// 创建一个默认指引样式
|
|||
/// </summary>
|
|||
/// <param name="title">跳转链接样式的文案内容</param>
|
|||
/// <returns></returns>
|
|||
public static WebhookTemplateCardJump Default(string title) |
|||
{ |
|||
Check.NotNullOrWhiteSpace(title, nameof(title)); |
|||
|
|||
return new WebhookTemplateCardJump(title); |
|||
} |
|||
/// <summary>
|
|||
/// 创建一个跳转链接的指引样式
|
|||
/// </summary>
|
|||
/// <param name="title">跳转链接样式的文案内容</param>
|
|||
/// <param name="url">跳转链接的url</param>
|
|||
/// <returns></returns>
|
|||
public static WebhookTemplateCardJump Link(string title, string url) |
|||
{ |
|||
Check.NotNullOrWhiteSpace(title, nameof(title)); |
|||
Check.NotNullOrWhiteSpace(url, nameof(url)); |
|||
|
|||
return new WebhookTemplateCardJump(title, 1, url); |
|||
} |
|||
/// <summary>
|
|||
/// 创建一个跳转小程序的指引样式
|
|||
/// </summary>
|
|||
/// <param name="title">跳转链接样式的文案内容</param>
|
|||
/// <param name="appId">跳转链接的小程序的appid</param>
|
|||
/// <param name="pagePath">跳转链接的小程序的pagepath</param>
|
|||
/// <returns></returns>
|
|||
public static WebhookTemplateCardJump MiniProgram(string title, string appId, string pagePath) |
|||
{ |
|||
Check.NotNullOrWhiteSpace(title, nameof(title)); |
|||
Check.NotNullOrWhiteSpace(appId, nameof(appId)); |
|||
Check.NotNullOrWhiteSpace(pagePath, nameof(pagePath)); |
|||
|
|||
return new WebhookTemplateCardJump(title, 2, appId: appId, pagePath: pagePath); |
|||
} |
|||
} |
|||
@ -0,0 +1,35 @@ |
|||
using JetBrains.Annotations; |
|||
using Newtonsoft.Json; |
|||
using System.Text.Json.Serialization; |
|||
|
|||
namespace LINGYUN.Abp.WeChat.Work.Messages.Models; |
|||
/// <summary>
|
|||
/// 模版卡片的主要内容
|
|||
/// </summary>
|
|||
public class WebhookTemplateCardMainTitle |
|||
{ |
|||
/// <summary>
|
|||
/// 一级标题,建议不超过26个字。模版卡片主要内容的一级标题main_title.title和二级普通文本sub_title_text必须有一项填写
|
|||
/// </summary>
|
|||
[CanBeNull] |
|||
[JsonProperty("title")] |
|||
[JsonPropertyName("title")] |
|||
public string Title { get; set; } |
|||
/// <summary>
|
|||
/// 标题辅助信息,建议不超过30个字
|
|||
/// </summary>
|
|||
[CanBeNull] |
|||
[JsonProperty("desc")] |
|||
[JsonPropertyName("desc")] |
|||
public string Description { get; set; } |
|||
/// <summary>
|
|||
/// 创建一个模版卡片的主要内容
|
|||
/// </summary>
|
|||
/// <param name="title">一级标题</param>
|
|||
/// <param name="description">标题辅助信息</param>
|
|||
public WebhookTemplateCardMainTitle(string title, string description = null) |
|||
{ |
|||
Title = title; |
|||
Description = description; |
|||
} |
|||
} |
|||
@ -0,0 +1,111 @@ |
|||
using JetBrains.Annotations; |
|||
using Newtonsoft.Json; |
|||
using System.Text.Json.Serialization; |
|||
using Volo.Abp; |
|||
|
|||
namespace LINGYUN.Abp.WeChat.Work.Messages.Models; |
|||
/// <summary>
|
|||
/// 引用文献
|
|||
/// </summary>
|
|||
public class WebhookTemplateCardQuoteArea |
|||
{ |
|||
/// <summary>
|
|||
/// 引用文献样式区域点击事件,0或不填代表没有点击事件,1 代表跳转url,2 代表跳转小程序
|
|||
/// </summary>
|
|||
[CanBeNull] |
|||
[JsonProperty("type")] |
|||
[JsonPropertyName("type")] |
|||
public int? Type { get; set; } |
|||
/// <summary>
|
|||
/// 点击跳转的url,type是1时必填
|
|||
/// </summary>
|
|||
[CanBeNull] |
|||
[JsonProperty("url")] |
|||
[JsonPropertyName("url")] |
|||
public string Url { get; set; } |
|||
/// <summary>
|
|||
/// 点击跳转的小程序的appid,type是2时必填
|
|||
/// </summary>
|
|||
[CanBeNull] |
|||
[JsonProperty("appid")] |
|||
[JsonPropertyName("appid")] |
|||
public string AppId { get; set; } |
|||
/// <summary>
|
|||
/// 点击跳转的小程序的pagepath,type是2时选填
|
|||
/// </summary>
|
|||
[CanBeNull] |
|||
[JsonProperty("pagepath")] |
|||
[JsonPropertyName("pagepath")] |
|||
public string PagePath { get; set; } |
|||
/// <summary>
|
|||
/// 引用文献样式的标题
|
|||
/// </summary>
|
|||
[CanBeNull] |
|||
[JsonProperty("title")] |
|||
[JsonPropertyName("title")] |
|||
public string Title { get; set; } |
|||
/// <summary>
|
|||
/// 引用文献样式的引用文案
|
|||
/// </summary>
|
|||
[CanBeNull] |
|||
[JsonProperty("quote_text")] |
|||
[JsonPropertyName("quote_text")] |
|||
public string QuoteText { get; set; } |
|||
private WebhookTemplateCardQuoteArea( |
|||
string title, |
|||
int? type = null, |
|||
string url = null, |
|||
string appId = null, |
|||
string pagePath = null, |
|||
string quoteText = null) |
|||
{ |
|||
Title = title; |
|||
QuoteText = quoteText; |
|||
Type = type; |
|||
Url = url; |
|||
AppId = appId; |
|||
PagePath = pagePath; |
|||
} |
|||
/// <summary>
|
|||
/// 创建一个默认引用文献
|
|||
/// </summary>
|
|||
/// <param name="title">引用文献样式的标题</param>
|
|||
/// <param name="quoteText">引用文献样式的引用文案</param>
|
|||
/// <returns></returns>
|
|||
public static WebhookTemplateCardQuoteArea Default(string title, string quoteText = null) |
|||
{ |
|||
Check.NotNullOrWhiteSpace(title, nameof(title)); |
|||
|
|||
return new WebhookTemplateCardQuoteArea(title, quoteText: quoteText); |
|||
} |
|||
/// <summary>
|
|||
/// 创建一个跳转链接的引用文献
|
|||
/// </summary>
|
|||
/// <param name="title">引用文献样式的标题</param>
|
|||
/// <param name="url">点击跳转的url</param>
|
|||
/// <param name="quoteText">引用文献样式的引用文案</param>
|
|||
/// <returns></returns>
|
|||
public static WebhookTemplateCardQuoteArea Link(string title, string url, string quoteText = null) |
|||
{ |
|||
Check.NotNullOrWhiteSpace(title, nameof(title)); |
|||
Check.NotNullOrWhiteSpace(url, nameof(url)); |
|||
|
|||
return new WebhookTemplateCardQuoteArea(title, 1, url, quoteText: quoteText); |
|||
} |
|||
/// <summary>
|
|||
/// 创建一个跳转小程序的引用文献
|
|||
/// </summary>
|
|||
/// <param name="title">引用文献样式的标题</param>
|
|||
/// <param name="appId">跳转链接的小程序的appid</param>
|
|||
/// <param name="pagePath">跳转链接的小程序的pagepath</param>
|
|||
/// <param name="quoteText">引用文献样式的引用文案</param>
|
|||
/// <returns></returns>
|
|||
public static WebhookTemplateCardQuoteArea MiniProgram(string title, string appId, string pagePath, string quoteText = null) |
|||
{ |
|||
Check.NotNullOrWhiteSpace(title, nameof(title)); |
|||
Check.NotNullOrWhiteSpace(appId, nameof(appId)); |
|||
Check.NotNullOrWhiteSpace(pagePath, nameof(pagePath)); |
|||
|
|||
return new WebhookTemplateCardQuoteArea(title, 2, appId: appId, pagePath: pagePath, quoteText: quoteText); |
|||
} |
|||
} |
|||
@ -0,0 +1,81 @@ |
|||
using JetBrains.Annotations; |
|||
using Newtonsoft.Json; |
|||
using System.Text.Json.Serialization; |
|||
|
|||
namespace LINGYUN.Abp.WeChat.Work.Messages.Models; |
|||
/// <summary>
|
|||
/// 卡片来源样式信息
|
|||
/// </summary>
|
|||
public class WebhookTemplateCardSource |
|||
{ |
|||
/// <summary>
|
|||
/// 来源图片的url
|
|||
/// </summary>
|
|||
[CanBeNull] |
|||
[JsonProperty("icon_url")] |
|||
[JsonPropertyName("icon_url")] |
|||
public string IconUrl { get; set; } |
|||
/// <summary>
|
|||
/// 来源图片的描述,建议不超过13个字
|
|||
/// </summary>
|
|||
[CanBeNull] |
|||
[JsonProperty("desc")] |
|||
[JsonPropertyName("desc")] |
|||
public string Description { get; set; } |
|||
/// <summary>
|
|||
/// 来源文字的颜色,目前支持:0(默认) 灰色,1 黑色,2 红色,3 绿色
|
|||
/// </summary>
|
|||
[CanBeNull] |
|||
[JsonProperty("desc_color")] |
|||
[JsonPropertyName("desc_color")] |
|||
public int? DescriptionColor { get; set; } |
|||
private WebhookTemplateCardSource( |
|||
string iconUrl = null, |
|||
string description = null, |
|||
int? descriptionColor = 0) |
|||
{ |
|||
IconUrl = iconUrl; |
|||
Description = description; |
|||
DescriptionColor = descriptionColor; |
|||
} |
|||
/// <summary>
|
|||
/// 创建一个灰色卡片来源样式
|
|||
/// </summary>
|
|||
/// <param name="iconUrl">来源图片的url</param>
|
|||
/// <param name="description">来源图片的描述</param>
|
|||
/// <returns></returns>
|
|||
public static WebhookTemplateCardSource Grey(string iconUrl, string description = null) |
|||
{ |
|||
return new WebhookTemplateCardSource(iconUrl, description, 0); |
|||
} |
|||
/// <summary>
|
|||
/// 创建一个黑色卡片来源样式
|
|||
/// </summary>
|
|||
/// <param name="iconUrl">来源图片的url</param>
|
|||
/// <param name="description">来源图片的描述</param>
|
|||
/// <returns></returns>
|
|||
public static WebhookTemplateCardSource Black(string iconUrl, string description = null) |
|||
{ |
|||
return new WebhookTemplateCardSource(iconUrl, description, 1); |
|||
} |
|||
/// <summary>
|
|||
/// 创建一个红色卡片来源样式
|
|||
/// </summary>
|
|||
/// <param name="iconUrl">来源图片的url</param>
|
|||
/// <param name="description">来源图片的描述</param>
|
|||
/// <returns></returns>
|
|||
public static WebhookTemplateCardSource Red(string iconUrl, string description = null) |
|||
{ |
|||
return new WebhookTemplateCardSource(iconUrl, description, 2); |
|||
} |
|||
/// <summary>
|
|||
/// 创建一个绿色卡片来源样式
|
|||
/// </summary>
|
|||
/// <param name="iconUrl">来源图片的url</param>
|
|||
/// <param name="description">来源图片的描述</param>
|
|||
/// <returns></returns>
|
|||
public static WebhookTemplateCardSource Green(string iconUrl, string description = null) |
|||
{ |
|||
return new WebhookTemplateCardSource(iconUrl, description, 3); |
|||
} |
|||
} |
|||
@ -1,31 +0,0 @@ |
|||
using JetBrains.Annotations; |
|||
using Newtonsoft.Json; |
|||
using System.Text.Json.Serialization; |
|||
|
|||
namespace LINGYUN.Abp.WeChat.Work.Messages.Templates; |
|||
/// <summary>
|
|||
/// 卡片操作按钮
|
|||
/// </summary>
|
|||
public class TemplateCardAction |
|||
{ |
|||
public TemplateCardAction(string key, string text) |
|||
{ |
|||
Key = key; |
|||
Text = text; |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// 操作key值,用户点击后,会产生回调事件将本参数作为EventKey返回,回调事件会带上该key值,最长支持1024字节,不可重复
|
|||
/// </summary>
|
|||
[NotNull] |
|||
[JsonProperty("key")] |
|||
[JsonPropertyName("key")] |
|||
public string Key { get; set; } |
|||
/// <summary>
|
|||
/// 操作的描述文案
|
|||
/// </summary>
|
|||
[NotNull] |
|||
[JsonProperty("text")] |
|||
[JsonPropertyName("text")] |
|||
public string Text { get; set; } |
|||
} |
|||
@ -1,93 +0,0 @@ |
|||
using JetBrains.Annotations; |
|||
using Newtonsoft.Json; |
|||
using System.Text.Json.Serialization; |
|||
|
|||
namespace LINGYUN.Abp.WeChat.Work.Messages.Templates; |
|||
/// <summary>
|
|||
/// 二级标题+文本
|
|||
/// </summary>
|
|||
public class TemplateCardHorizontalContent |
|||
{ |
|||
public static TemplateCardHorizontalContent None(string keyName, string value = "") |
|||
{ |
|||
return new TemplateCardHorizontalContent( |
|||
keyName, 0, value); |
|||
} |
|||
|
|||
public static TemplateCardHorizontalContent FromUrl(string keyName, string url, string value = "") |
|||
{ |
|||
return new TemplateCardHorizontalContent( |
|||
keyName, 1, value, url); |
|||
} |
|||
|
|||
public static TemplateCardHorizontalContent FromMedia(string keyName, string mediaId, string value = "") |
|||
{ |
|||
return new TemplateCardHorizontalContent( |
|||
keyName, 2, value, mediaId: mediaId); |
|||
} |
|||
|
|||
public static TemplateCardHorizontalContent FromUser(string keyName, string userId, string value = "") |
|||
{ |
|||
return new TemplateCardHorizontalContent( |
|||
keyName, 3, value, userId: userId); |
|||
} |
|||
|
|||
public TemplateCardHorizontalContent( |
|||
string keyName, |
|||
byte type = 0, |
|||
string value = "", |
|||
string url = "", |
|||
string mediaId = "", |
|||
string userId = "") |
|||
{ |
|||
Type = type; |
|||
KeyName = keyName; |
|||
Value = value; |
|||
Url = url; |
|||
MediaId = mediaId; |
|||
UserId = userId; |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// 链接类型,0或不填代表不是链接,1 代表跳转url,2 代表下载附件,3 代表点击跳转成员详情
|
|||
/// </summary>
|
|||
[CanBeNull] |
|||
[JsonProperty("type")] |
|||
[JsonPropertyName("type")] |
|||
public byte Type { get; } |
|||
/// <summary>
|
|||
/// 二级标题,建议不超过5个字
|
|||
/// </summary>
|
|||
[NotNull] |
|||
[JsonProperty("keyname")] |
|||
[JsonPropertyName("keyname")] |
|||
public string KeyName { get; set; } |
|||
/// <summary>
|
|||
/// 二级文本,如果horizontal_content_list.type是2,该字段代表文件名称(要包含文件类型),建议不超过30个字,(支持id转译)
|
|||
/// </summary>
|
|||
[CanBeNull] |
|||
[JsonProperty("value")] |
|||
[JsonPropertyName("value")] |
|||
public string Value { get; set; } |
|||
/// <summary>
|
|||
/// 链接跳转的url,horizontal_content_list.type是1时必填
|
|||
/// </summary>
|
|||
[CanBeNull] |
|||
[JsonProperty("url")] |
|||
[JsonPropertyName("url")] |
|||
public string Url { get; set; } |
|||
/// <summary>
|
|||
/// 附件的media_id,horizontal_content_list.type是2时必填
|
|||
/// </summary>
|
|||
[CanBeNull] |
|||
[JsonProperty("media_id")] |
|||
[JsonPropertyName("media_id")] |
|||
public string MediaId { get; set; } |
|||
/// <summary>
|
|||
/// 成员详情的userid,horizontal_content_list.type是3时必填
|
|||
/// </summary>
|
|||
[CanBeNull] |
|||
[JsonProperty("userid")] |
|||
[JsonPropertyName("userid")] |
|||
public string UserId { get; set; } |
|||
} |
|||
@ -1,62 +0,0 @@ |
|||
using JetBrains.Annotations; |
|||
using Newtonsoft.Json; |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.Text; |
|||
using System.Text.Json.Serialization; |
|||
|
|||
namespace LINGYUN.Abp.WeChat.Work.Messages.Templates; |
|||
/// <summary>
|
|||
/// 跳转指引样式
|
|||
/// </summary>
|
|||
public class TemplateCardJump |
|||
{ |
|||
public TemplateCardJump(string title, string url) |
|||
{ |
|||
Type = 1; |
|||
Url = url; |
|||
Title = title; |
|||
} |
|||
public TemplateCardJump(string title, string appid, string pagePath) |
|||
{ |
|||
Type = 2; |
|||
AppId = appid; |
|||
PagePath = pagePath; |
|||
Title = title; |
|||
} |
|||
/// <summary>
|
|||
/// 跳转链接类型,0或不填代表不是链接,1 代表跳转url,2 代表跳转小程序
|
|||
/// </summary>
|
|||
[CanBeNull] |
|||
[JsonProperty("type")] |
|||
[JsonPropertyName("type")] |
|||
public byte Type { get; } |
|||
/// <summary>
|
|||
/// 跳转链接样式的文案内容,建议不超过18个字
|
|||
/// </summary>
|
|||
[NotNull] |
|||
[JsonProperty("title")] |
|||
[JsonPropertyName("title")] |
|||
public string Title { get; set; } |
|||
/// <summary>
|
|||
/// 跳转链接的url,jump_list.type是1时必填
|
|||
/// </summary>
|
|||
[CanBeNull] |
|||
[JsonProperty("url")] |
|||
[JsonPropertyName("url")] |
|||
public string Url { get; set; } |
|||
/// <summary>
|
|||
/// 跳转链接的小程序的appid,必须是与当前应用关联的小程序,jump_list.type是2时必填
|
|||
/// </summary>
|
|||
[CanBeNull] |
|||
[JsonProperty("appid")] |
|||
[JsonPropertyName("appid")] |
|||
public string AppId { get; set; } |
|||
/// <summary>
|
|||
/// 跳转链接的小程序的pagepath,jump_list.type是2时选填
|
|||
/// </summary>
|
|||
[CanBeNull] |
|||
[JsonProperty("pagepath")] |
|||
[JsonPropertyName("pagepath")] |
|||
public string PagePath { get; set; } |
|||
} |
|||
@ -1,33 +0,0 @@ |
|||
using JetBrains.Annotations; |
|||
using Newtonsoft.Json; |
|||
using System.Text.Json.Serialization; |
|||
|
|||
namespace LINGYUN.Abp.WeChat.Work.Messages.Templates; |
|||
/// <summary>
|
|||
/// 卡票标题
|
|||
/// </summary>
|
|||
public class TemplateCardMainTitle |
|||
{ |
|||
public TemplateCardMainTitle( |
|||
string title = "", |
|||
string description = "") |
|||
{ |
|||
Title = title; |
|||
Description = description; |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// 一级标题,建议不超过36个字,文本通知型卡片本字段非必填,但不可本字段和sub_title_text都不填,(支持id转译)
|
|||
/// </summary>
|
|||
[CanBeNull] |
|||
[JsonProperty("title")] |
|||
[JsonPropertyName("title")] |
|||
public string Title { get; set; } |
|||
/// <summary>
|
|||
/// 标题辅助信息,建议不超过44个字,(支持id转译)
|
|||
/// </summary>
|
|||
[CanBeNull] |
|||
[JsonProperty("desc")] |
|||
[JsonPropertyName("desc")] |
|||
public string Description { get; set; } |
|||
} |
|||
@ -1,68 +0,0 @@ |
|||
using JetBrains.Annotations; |
|||
using Newtonsoft.Json; |
|||
using System.Text.Json.Serialization; |
|||
|
|||
namespace LINGYUN.Abp.WeChat.Work.Messages.Templates; |
|||
/// <summary>
|
|||
/// 引用文献样式
|
|||
/// </summary>
|
|||
public class TemplateCardQuoteArea |
|||
{ |
|||
public TemplateCardQuoteArea(string url, string title = "", string text = "") |
|||
{ |
|||
Type = 1; |
|||
Url = url; |
|||
Title = title; |
|||
Text = text; |
|||
} |
|||
public TemplateCardQuoteArea(string appid, string pagePath, string title = "", string text = "") |
|||
{ |
|||
Type = 2; |
|||
AppId = appid; |
|||
PagePath = pagePath; |
|||
Title = title; |
|||
Text = text; |
|||
} |
|||
/// <summary>
|
|||
/// 引用文献样式区域点击事件,0或不填代表没有点击事件,1 代表跳转url,2 代表跳转小程序
|
|||
/// </summary>
|
|||
[CanBeNull] |
|||
[JsonProperty("type")] |
|||
[JsonPropertyName("type")] |
|||
public byte Type { get; } |
|||
/// <summary>
|
|||
/// 点击跳转的url,quote_area.type是1时必填
|
|||
/// </summary>
|
|||
[CanBeNull] |
|||
[JsonProperty("url")] |
|||
[JsonPropertyName("url")] |
|||
public string Url { get; set; } |
|||
/// <summary>
|
|||
/// 点击跳转的小程序的appid,必须是与当前应用关联的小程序,quote_area.type是2时必填
|
|||
/// </summary>
|
|||
[CanBeNull] |
|||
[JsonProperty("appid")] |
|||
[JsonPropertyName("appid")] |
|||
public string AppId { get; set; } |
|||
/// <summary>
|
|||
/// 点击跳转的小程序的pagepath,quote_area.type是2时选填
|
|||
/// </summary>
|
|||
[CanBeNull] |
|||
[JsonProperty("pagepath")] |
|||
[JsonPropertyName("pagepath")] |
|||
public string PagePath { get; set; } |
|||
/// <summary>
|
|||
/// 引用文献样式的标题
|
|||
/// </summary>
|
|||
[CanBeNull] |
|||
[JsonProperty("title")] |
|||
[JsonPropertyName("title")] |
|||
public string Title { get; set; } |
|||
/// <summary>
|
|||
/// 引用文献样式的引用文案
|
|||
/// </summary>
|
|||
[CanBeNull] |
|||
[JsonProperty("quote_text")] |
|||
[JsonPropertyName("quote_text")] |
|||
public string Text { get; set; } |
|||
} |
|||
@ -1,52 +0,0 @@ |
|||
using JetBrains.Annotations; |
|||
using Newtonsoft.Json; |
|||
using System.Text.Json.Serialization; |
|||
|
|||
namespace LINGYUN.Abp.WeChat.Work.Messages.Templates; |
|||
/// <summary>
|
|||
/// 来源文字颜色
|
|||
/// </summary>
|
|||
public enum DescriptionColor |
|||
{ |
|||
Gray = 0, |
|||
Black = 1, |
|||
Red = 2, |
|||
Green = 3, |
|||
} |
|||
/// <summary>
|
|||
/// 卡片来源样式信息
|
|||
/// </summary>
|
|||
public class TemplateCardSource |
|||
{ |
|||
public TemplateCardSource( |
|||
string iconUrl = "", |
|||
string description = "", |
|||
DescriptionColor descriptionColor = DescriptionColor.Gray) |
|||
{ |
|||
IconUrl = iconUrl; |
|||
Description = description; |
|||
DescriptionColor = descriptionColor; |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// 来源图片的url,来源图片的尺寸建议为72*72
|
|||
/// </summary>
|
|||
[CanBeNull] |
|||
[JsonProperty("icon_url")] |
|||
[JsonPropertyName("icon_url")] |
|||
public string IconUrl { get; set; } |
|||
/// <summary>
|
|||
/// 来源图片的描述,建议不超过20个字,(支持id转译)
|
|||
/// </summary>
|
|||
[CanBeNull] |
|||
[JsonProperty("desc")] |
|||
[JsonPropertyName("desc")] |
|||
public string Description { get; set; } |
|||
/// <summary>
|
|||
/// 来源文字的颜色,目前支持:0(默认) 灰色,1 黑色,2 红色,3 绿色
|
|||
/// </summary>
|
|||
[CanBeNull] |
|||
[JsonProperty("desc_color")] |
|||
[JsonPropertyName("desc_color")] |
|||
public DescriptionColor DescriptionColor { get; set; } |
|||
} |
|||
Loading…
Reference in new issue