mirror of
https://gitee.com/fudiwei/DotNetCore.SKIT.FlurlHttpClient.Wechat.git
synced 2025-09-18 17:48:12 +08:00
feat(work): 新增消息推送模板卡片相关接口
This commit is contained in:
@@ -0,0 +1,76 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace SKIT.FlurlHttpClient.Wechat.Work.Events
|
||||
{
|
||||
/// <summary>
|
||||
/// <para>表示 EVENT.template_card_event 事件的数据。</para>
|
||||
/// <para>REF: https://open.work.weixin.qq.com/api/doc/90000/90135/90240 </para>
|
||||
/// <para>REF: https://open.work.weixin.qq.com/api/doc/90001/90143/90240 </para>
|
||||
/// </summary>
|
||||
public class TemplateCardPushEvent : WechatWorkEvent, WechatWorkEvent.Types.IXmlSerializable
|
||||
{
|
||||
public new static class Types
|
||||
{
|
||||
public class SelectItem
|
||||
{
|
||||
/// <summary>
|
||||
/// 获取或设置问题的 Key 值。
|
||||
/// </summary>
|
||||
[System.Xml.Serialization.XmlElement("QuestionKey")]
|
||||
public string QuestionKey { get; set; } = default!;
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置选项 ID 列表。
|
||||
/// </summary>
|
||||
[System.Xml.Serialization.XmlElement("OpitonIds", Type = typeof(string))]
|
||||
public string[] OptionIdList { get; set; } = default!;
|
||||
}
|
||||
|
||||
public class SelectList
|
||||
{
|
||||
/// <summary>
|
||||
/// 获取或设置下拉框列表。
|
||||
/// </summary>
|
||||
[System.Xml.Serialization.XmlElement("SelectedItem", Type = typeof(SelectItem))]
|
||||
public SelectItem[]? Items { get; set; } = default!;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置应用 ID。
|
||||
/// </summary>
|
||||
[System.Xml.Serialization.XmlElement("AgentID")]
|
||||
public int AgentId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置任务 ID。
|
||||
/// </summary>
|
||||
[System.Xml.Serialization.XmlElement("TaskId")]
|
||||
public string TaskId { get; set; } = default!;
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置模板卡片类型。
|
||||
/// </summary>
|
||||
[System.Xml.Serialization.XmlElement("CardType")]
|
||||
public string CardType { get; set; } = default!;
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置用于更新卡片接口的 Code。
|
||||
/// </summary>
|
||||
[System.Xml.Serialization.XmlElement("ResponseCode")]
|
||||
public string ResponseCode { get; set; } = default!;
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置用户点击的按钮 Key 值。
|
||||
/// </summary>
|
||||
[System.Xml.Serialization.XmlElement("EventKey", IsNullable = true)]
|
||||
public string? ButtonKey { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置下拉框列表。
|
||||
/// </summary>
|
||||
[System.Xml.Serialization.XmlElement("SelectList")]
|
||||
public Types.SelectList? SelectList { get; set; } = default!;
|
||||
}
|
||||
}
|
@@ -0,0 +1,37 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace SKIT.FlurlHttpClient.Wechat.Work.Events
|
||||
{
|
||||
/// <summary>
|
||||
/// <para>表示被动回复更新点击用户的按钮点击文案消息的数据。</para>
|
||||
/// <para>REF: https://open.work.weixin.qq.com/api/doc/90000/90135/90241#%E6%A8%A1%E6%9D%BF%E5%8D%A1%E7%89%87%E6%9B%B4%E6%96%B0%E6%B6%88%E6%81%AF </para>
|
||||
/// <para>REF: https://open.work.weixin.qq.com/api/doc/90001/90143/90377#%E6%A8%A1%E6%9D%BF%E5%8D%A1%E7%89%87%E6%9B%B4%E6%96%B0%E6%B6%88%E6%81%AF </para>
|
||||
/// </summary>
|
||||
public class UpdateButtonReply : WechatWorkEvent, WechatWorkEvent.Types.IXmlSerializable
|
||||
{
|
||||
public new static class Types
|
||||
{
|
||||
public class Button
|
||||
{
|
||||
/// <summary>
|
||||
/// 获取或设置替换文案。
|
||||
/// </summary>
|
||||
[System.Xml.Serialization.XmlElement("ReplaceName")]
|
||||
public string ReplacementText { get; set; } = string.Empty;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置按钮信息。
|
||||
/// </summary>
|
||||
[System.Xml.Serialization.XmlElement("Button")]
|
||||
public Types.Button Button { get; set; } = new Types.Button();
|
||||
|
||||
public UpdateButtonReply()
|
||||
{
|
||||
Event = null;
|
||||
MessageType = "update_button";
|
||||
}
|
||||
}
|
||||
}
|
@@ -58,6 +58,29 @@ namespace SKIT.FlurlHttpClient.Wechat.Work
|
||||
return await client.SendRequestWithJsonAsync<Models.CgibinMessageUpdateTaskCardResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// <para>异步调用 [POST] /cgi-bin/message/update_template_card 接口。</para>
|
||||
/// <para>REF: https://open.work.weixin.qq.com/api/doc/90000/90135/94888 </para>
|
||||
/// <para>REF: https://open.work.weixin.qq.com/api/doc/90001/90143/94888 </para>
|
||||
/// </summary>
|
||||
/// <param name="client"></param>
|
||||
/// <param name="request"></param>
|
||||
/// <param name="cancellationToken"></param>
|
||||
/// <returns></returns>
|
||||
public static async Task<Models.CgibinMessageUpdateTemplateCardResponse> ExecuteCgibinMessageUpdateTemplateCardAsync(this WechatWorkClient client, Models.CgibinMessageUpdateTemplateCardRequest request, CancellationToken cancellationToken = default)
|
||||
{
|
||||
if (client is null) throw new ArgumentNullException(nameof(client));
|
||||
if (request is null) throw new ArgumentNullException(nameof(request));
|
||||
|
||||
if (!request.AgentId.HasValue)
|
||||
request.AgentId = client.Credentials.AgentId;
|
||||
|
||||
IFlurlRequest flurlReq = client
|
||||
.CreateRequest(request, HttpMethod.Post, "cgi-bin", "message", "update_template_card");
|
||||
|
||||
return await client.SendRequestWithJsonAsync<Models.CgibinMessageUpdateTemplateCardResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// <para>异步调用 [POST] /cgi-bin/message/get_statistics 接口。</para>
|
||||
/// <para>REF: https://open.work.weixin.qq.com/api/doc/90000/90135/92369 </para>
|
||||
@@ -76,5 +99,25 @@ namespace SKIT.FlurlHttpClient.Wechat.Work
|
||||
|
||||
return await client.SendRequestWithJsonAsync<Models.CgibinMessageGetStatisticsResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// <para>异步调用 [POST] /cgi-bin/message/recall 接口。</para>
|
||||
/// <para>REF: https://open.work.weixin.qq.com/api/doc/90000/90135/94867 </para>
|
||||
/// <para>REF: https://open.work.weixin.qq.com/api/doc/90001/90143/94867 </para>
|
||||
/// </summary>
|
||||
/// <param name="client"></param>
|
||||
/// <param name="request"></param>
|
||||
/// <param name="cancellationToken"></param>
|
||||
/// <returns></returns>
|
||||
public static async Task<Models.CgibinMessageRecallResponse> ExecuteCgibinMessageRecallAsync(this WechatWorkClient client, Models.CgibinMessageRecallRequest request, CancellationToken cancellationToken = default)
|
||||
{
|
||||
if (client is null) throw new ArgumentNullException(nameof(client));
|
||||
if (request is null) throw new ArgumentNullException(nameof(request));
|
||||
|
||||
IFlurlRequest flurlReq = client
|
||||
.CreateRequest(request, HttpMethod.Post, "cgi-bin", "message", "recall");
|
||||
|
||||
return await client.SendRequestWithJsonAsync<Models.CgibinMessageRecallResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -0,0 +1,18 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace SKIT.FlurlHttpClient.Wechat.Work.Models
|
||||
{
|
||||
/// <summary>
|
||||
/// <para>表示 [POST] /cgi-bin/message/recall 接口的请求。</para>
|
||||
/// </summary>
|
||||
public class CgibinMessageRecallRequest : WechatWorkRequest
|
||||
{
|
||||
/// <summary>
|
||||
/// 获取或设置消息 ID。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("msgid")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("msgid")]
|
||||
public string MessageId { get; set; } = string.Empty;
|
||||
}
|
||||
}
|
@@ -0,0 +1,12 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace SKIT.FlurlHttpClient.Wechat.Work.Models
|
||||
{
|
||||
/// <summary>
|
||||
/// <para>表示 [POST] /cgi-bin/message/recall 接口的响应。</para>
|
||||
/// </summary>
|
||||
public class CgibinMessageRecallResponse : WechatWorkResponse
|
||||
{
|
||||
}
|
||||
}
|
@@ -145,6 +145,20 @@ namespace SKIT.FlurlHttpClient.Wechat.Work.Models
|
||||
[Newtonsoft.Json.JsonProperty("btntxt")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("btntxt")]
|
||||
public string? ButtonText { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置跳转的小程序 AppId。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("appid")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("appid")]
|
||||
public string? MiniProgramAppId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置跳转的小程序页面路径。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("pagepath")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("pagepath")]
|
||||
public string? MiniProgramPagePath { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -368,48 +382,404 @@ namespace SKIT.FlurlHttpClient.Wechat.Work.Models
|
||||
public IList<Types.Button> ButtonList { get; set; } = new List<Types.Button>();
|
||||
}
|
||||
|
||||
public class TemplateMessage
|
||||
public class TemplateCardMessage
|
||||
{
|
||||
public static class Types
|
||||
{
|
||||
public class KeyValue
|
||||
public class Source
|
||||
{
|
||||
/// <summary>
|
||||
/// 获取或设置消息内容的 Key。
|
||||
/// 获取或设置来源图片的 URL。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("icon_url")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("icon_url")]
|
||||
public string IconUrl { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置来源图片的描述。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("desc")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("desc")]
|
||||
public string? Description { get; set; }
|
||||
}
|
||||
|
||||
public class MainTitle
|
||||
{
|
||||
/// <summary>
|
||||
/// 获取或设置标题。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("title")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("title")]
|
||||
public string Title { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置描述。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("desc")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("desc")]
|
||||
public string? Description { get; set; }
|
||||
}
|
||||
|
||||
public class Image
|
||||
{
|
||||
/// <summary>
|
||||
/// 获取或设置图片 URL。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("url")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("url")]
|
||||
public string Url { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置图片的宽高比。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("aspect_ratio")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("aspect_ratio")]
|
||||
public double? AspectRatio { get; set; }
|
||||
}
|
||||
|
||||
public class EmphasisContent : MainTitle
|
||||
{
|
||||
}
|
||||
|
||||
public class VerticalContent : MainTitle
|
||||
{
|
||||
}
|
||||
|
||||
public class HorizontalContent
|
||||
{
|
||||
/// <summary>
|
||||
/// 获取或设置二级标题。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("keyname")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("keyname")]
|
||||
public string Key { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置二级文本。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("value")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("value")]
|
||||
public string Value { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置链接类型。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("type")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("type")]
|
||||
public int? Type { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置跳转链接。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("url")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("url")]
|
||||
public string? Url { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置附件的 MediaId。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("media_id")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("media_id")]
|
||||
public string? MediaId { get; set; }
|
||||
}
|
||||
|
||||
public class Action
|
||||
{
|
||||
/// <summary>
|
||||
/// 获取或设置跳转链接类型。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("type")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("type")]
|
||||
public int? Type { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置跳转链接样式的文案内容。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("title")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("title")]
|
||||
public string Title { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置跳转链接。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("url")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("url")]
|
||||
public string? Url { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置跳转小程序的 AppId。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("appid")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("appid")]
|
||||
public string? MiniProgramAppId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置跳转小程序的路径。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("pagepath")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("pagepath")]
|
||||
public string? MiniProgramPagePath { get; set; }
|
||||
}
|
||||
|
||||
public class Button
|
||||
{
|
||||
/// <summary>
|
||||
/// 获取或设置按钮 Key 值。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("key")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("key")]
|
||||
public string Key { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置消息内容的值。
|
||||
/// 获取或设置按钮文案。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("value")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("value")]
|
||||
public string Value { get; set; } = string.Empty;
|
||||
[Newtonsoft.Json.JsonProperty("text")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("text")]
|
||||
public string Text { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置按钮样式类型。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("style")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("style")]
|
||||
public int? Style { get; set; }
|
||||
}
|
||||
|
||||
public class Checkbox
|
||||
{
|
||||
public static class Types
|
||||
{
|
||||
public class Option
|
||||
{
|
||||
/// <summary>
|
||||
/// 获取或设置选项 ID。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("id")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("id")]
|
||||
public string Id { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置选项文案描述。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("text")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("text")]
|
||||
public string Text { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置是否要默认选中。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("is_checked")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("is_checked")]
|
||||
public bool IsChecked { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置是否可以选择。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("disable")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("disable")]
|
||||
public bool? IsDisabled { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置选择题 Key 值。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("question_key")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("question_key")]
|
||||
public string QuestionKey { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置选择题模式。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("mode")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("mode")]
|
||||
public int? Mode { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置选项列表。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("option_list")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("option_list")]
|
||||
public IList<Types.Option> OptionList { get; set; } = new List<Types.Option>();
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置是否可以选择。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("disable")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("disable")]
|
||||
public bool? IsDisabled { get; set; }
|
||||
}
|
||||
|
||||
public class Select
|
||||
{
|
||||
public static class Types
|
||||
{
|
||||
public class Option
|
||||
{
|
||||
/// <summary>
|
||||
/// 获取或设置选项 ID。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("id")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("id")]
|
||||
public string Id { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置选项文案描述。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("text")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("text")]
|
||||
public string Text { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置是否可以选择。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("disable")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("disable")]
|
||||
public bool? IsDisabled { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置选择题 Key 值。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("question_key")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("question_key")]
|
||||
public string QuestionKey { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置选择器标题。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("title")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("title")]
|
||||
public string Title { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置默认选定的选项 ID。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("selected_id")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("selected_id")]
|
||||
public string? SelectedOptoinId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置选项列表。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("option_list")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("option_list")]
|
||||
public IList<Types.Option> OptionList { get; set; } = new List<Types.Option>();
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置是否可以选择。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("disable")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("disable")]
|
||||
public bool? IsDisabled { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置模板 ID。
|
||||
/// 获取或设置模板卡片类型。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("template_id")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("template_id")]
|
||||
public string TemplateId { get; set; } = string.Empty;
|
||||
[Newtonsoft.Json.JsonProperty("card_type")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("card_type")]
|
||||
public string CardType { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置点击模板消息后的跳转链接。
|
||||
/// 获取或设置图片样式信息。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("url")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("url")]
|
||||
public string Url { get; set; } = string.Empty;
|
||||
[Newtonsoft.Json.JsonProperty("card_image")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("card_image")]
|
||||
public Types.Image? CardImage { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置消息内容键值对。
|
||||
/// 获取或设置卡片来源样式信息。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("content_item")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("content_item")]
|
||||
public IList<Types.KeyValue> ContentItemList { get; set; } = new List<Types.KeyValue>();
|
||||
[Newtonsoft.Json.JsonProperty("source")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("source")]
|
||||
public Types.Source? Source { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置一级标题信息。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("main_title")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("main_title")]
|
||||
public Types.MainTitle? MainTitle { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置关键数据样式信息。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("emphasis_content")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("emphasis_content")]
|
||||
public Types.EmphasisContent? EmphasisContent { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置二级普通文本。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("sub_title_text")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("sub_title_text")]
|
||||
public string? SubTitleText { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置二级垂直内容列表。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("vertical_content_list")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("vertical_content_list")]
|
||||
public IList<Types.VerticalContent>? VerticalContentList { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置二级文本列表。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("horizontal_content_list")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("horizontal_content_list")]
|
||||
public IList<Types.HorizontalContent>? HorizontalContentList { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置跳转指引样式的列表。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("jump_list")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("jump_list")]
|
||||
public IList<Types.Action>? JumpActionList { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置卡片的点击跳转事件信息。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("card_action")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("card_action")]
|
||||
public Types.Action? CardAction { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置任务 ID。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("task_id")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("task_id")]
|
||||
public string? TaskId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置按钮列表。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("button_list")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("button_list")]
|
||||
public IList<Types.Button>? ButtonList { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置选择题信息。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("checkbox")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("checkbox")]
|
||||
public Types.Checkbox? Checkbox { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置选择器列表。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("select_list")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("select_list")]
|
||||
public IList<Types.Select>? SelectList { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置提交按钮列表。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("submit_button")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("submit_button")]
|
||||
public Types.Button? SubmitButton { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -525,11 +895,11 @@ namespace SKIT.FlurlHttpClient.Wechat.Work.Models
|
||||
public Types.TaskCardMessage? MessageContentForTaskCard { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置模板消息信息。
|
||||
/// 获取或设置模板卡片信息。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("template_msg")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("template_msg")]
|
||||
public Types.TemplateMessage? MessageContentForTemplate { get; set; }
|
||||
[Newtonsoft.Json.JsonProperty("template_card")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("template_card")]
|
||||
public Types.TemplateCardMessage? MessageContentForTemplateCard { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置应用 ID。如果不指定将使用构造 <see cref="WechatWorkClient"/> 时的 <see cref="WechatWorkClientOptions.AgentId"/> 参数。
|
||||
|
@@ -34,5 +34,19 @@ namespace SKIT.FlurlHttpClient.Wechat.Work.Models
|
||||
[System.Text.Json.Serialization.JsonPropertyName("invalidtag")]
|
||||
[System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Converters.SeparatedByVBarInt32ArrayConverter))]
|
||||
public int[]? InvalidTagIdList { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置消息 ID。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("msgid")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("msgid")]
|
||||
public string MessageId { get; set; } = default!;
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置更新卡片所需要消费的 Code。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("response_code")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("response_code")]
|
||||
public string? ResponseCode { get; set; }
|
||||
}
|
||||
}
|
||||
|
@@ -0,0 +1,106 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace SKIT.FlurlHttpClient.Wechat.Work.Models
|
||||
{
|
||||
/// <summary>
|
||||
/// <para>表示 [POST] /cgi-bin/message/update_template_card 接口的请求。</para>
|
||||
/// </summary>
|
||||
public class CgibinMessageUpdateTemplateCardRequest : WechatWorkRequest
|
||||
{
|
||||
public static class Types
|
||||
{
|
||||
public class Button
|
||||
{
|
||||
/// <summary>
|
||||
/// 获取或设置任务 ID。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("task_id")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("task_id")]
|
||||
public string TaskId { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置替换文案。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("replace_name")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("replace_name")]
|
||||
public string ReplacementText { get; set; } = string.Empty;
|
||||
}
|
||||
|
||||
public class TemplateCardMessage : CgibinMessageSendRequest.Types.TemplateCardMessage
|
||||
{
|
||||
/// <summary>
|
||||
/// 获取或设置按钮替换文案。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("replace_text")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("replace_text")]
|
||||
public string? ReplacementText { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置应用 ID。如果不指定将使用构造 <see cref="WechatWorkClient"/> 时的 <see cref="WechatWorkClientOptions.AgentId"/> 参数。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonIgnore]
|
||||
[System.Text.Json.Serialization.JsonIgnore]
|
||||
public int? AgentId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置成员账号列表。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("userids")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("userids")]
|
||||
public IList<string>? UserIdList { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置部门 ID 列表。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("partyids")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("partyids")]
|
||||
public IList<int>? DepartmentIdList { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置标签 ID 列表。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("tagids")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("tagids")]
|
||||
public IList<int>? TagIdList { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置是否更新整个任务接收人员。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("atall")]
|
||||
[Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.NumberTypedNullableBooleanConverter))]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("atall")]
|
||||
[System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Converters.NumberTypedNullableBooleanConverter))]
|
||||
public bool? IsAtAll { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置更新卡片所需要消费的 Code。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("response_code")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("response_code")]
|
||||
public string ResponseCode { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置原始卡片的任务 ID。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("original_task_id")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("original_task_id")]
|
||||
public string? OriginalTaskId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置按钮信息。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("button")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("button")]
|
||||
public Types.Button? Button { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置模板卡片信息。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("template_card")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("template_card")]
|
||||
public Types.TemplateCardMessage? TemplateCard { get; set; }
|
||||
}
|
||||
}
|
@@ -0,0 +1,18 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace SKIT.FlurlHttpClient.Wechat.Work.Models
|
||||
{
|
||||
/// <summary>
|
||||
/// <para>表示 [POST] /cgi-bin/message/update_template_card 接口的响应。</para>
|
||||
/// </summary>
|
||||
public class CgibinMessageUpdateTemplateCardResponse : WechatWorkResponse
|
||||
{
|
||||
/// <summary>
|
||||
/// 获取或设置无效的成员账号列表。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("invaliduser")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("invaliduser")]
|
||||
public string[]? InvalidUserIdList { get; set; }
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user