mirror of
https://gitee.com/fudiwei/DotNetCore.SKIT.FlurlHttpClient.Wechat.git
synced 2025-09-20 02:29:40 +08:00
feat(wxapi): 新增获取公众号的自动回复规则相关接口
This commit is contained in:
@@ -135,5 +135,25 @@ namespace SKIT.FlurlHttpClient.Wechat.Api
|
||||
|
||||
return await client.SendRequestWithJsonAsync<Models.CgibinChangeOpenIdResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// <para>异步调用 [GET] /cgi-bin/get_current_autoreply_info 接口。</para>
|
||||
/// <para>REF: https://developers.weixin.qq.com/doc/offiaccount/Message_Management/Getting_Rules_for_Auto_Replies.html </para>
|
||||
/// </summary>
|
||||
/// <param name="client"></param>
|
||||
/// <param name="request"></param>
|
||||
/// <param name="cancellationToken"></param>
|
||||
/// <returns></returns>
|
||||
public static async Task<Models.CgibinGetCurrentAutoReplyInfoResponse> ExecuteCgibinGetCurrentAutoReplyInfoAsync(this WechatApiClient client, Models.CgibinGetCurrentAutoReplyInfoRequest 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.Get, "cgi-bin", "get_current_autoreply_info")
|
||||
.SetQueryParam("access_token", request.AccessToken);
|
||||
|
||||
return await client.SendRequestWithJsonAsync<Models.CgibinGetCurrentAutoReplyInfoResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -0,0 +1,9 @@
|
||||
namespace SKIT.FlurlHttpClient.Wechat.Api.Models
|
||||
{
|
||||
/// <summary>
|
||||
/// <para>表示 [GET] /cgi-bin/get_current_autoreply_info 接口的请求。</para>
|
||||
/// </summary>
|
||||
public class CgibinGetCurrentAutoReplyInfoRequest : WechatApiRequest, IInferable<CgibinGetCurrentAutoReplyInfoRequest, CgibinGetCurrentAutoReplyInfoResponse>
|
||||
{
|
||||
}
|
||||
}
|
@@ -0,0 +1,183 @@
|
||||
namespace SKIT.FlurlHttpClient.Wechat.Api.Models
|
||||
{
|
||||
/// <summary>
|
||||
/// <para>表示 [GET] /cgi-bin/get_current_autoreply_info 接口的响应。</para>
|
||||
/// </summary>
|
||||
public class CgibinGetCurrentAutoReplyInfoResponse : WechatApiResponse
|
||||
{
|
||||
public static class Types
|
||||
{
|
||||
public class AutoReplyInfo
|
||||
{
|
||||
/// <summary>
|
||||
/// 获取或设置自动回复类型。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("type")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("type")]
|
||||
public string Type { get; set; } = default!;
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置自动回复内容。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("content")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("content")]
|
||||
public string Content { get; set; } = default!;
|
||||
}
|
||||
|
||||
public class KeywordAutoReplyRuleList
|
||||
{
|
||||
/// <summary>
|
||||
/// 获取或设置关键字回复规则列表。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("list")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("list")]
|
||||
public KeywordAutoReplyRule[] Items { get; set; } = default!;
|
||||
}
|
||||
|
||||
public class KeywordAutoReplyRule
|
||||
{
|
||||
public static class Types
|
||||
{
|
||||
public class Keyword
|
||||
{
|
||||
/// <summary>
|
||||
/// 获取或设置匹配模式。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("match_mode")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("match_mode")]
|
||||
public string MatchMode { get; set; } = default!;
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置关键词类型。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("type")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("type")]
|
||||
public string Type { get; set; } = default!;
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置关键词内容。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("content")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("content")]
|
||||
public string Content { get; set; } = default!;
|
||||
}
|
||||
|
||||
public class Reply
|
||||
{
|
||||
public static class Types
|
||||
{
|
||||
public class NewsList
|
||||
{
|
||||
/// <summary>
|
||||
/// 获取或设置图文消息列表。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("list")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("list")]
|
||||
public NewsItem[] List { get; set; } = default!;
|
||||
}
|
||||
|
||||
public class NewsItem : CgibinGetCurrentSelfMenuInfoResponse.Types.Menu.Types.Button.Types.NewsItem
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置回复类型。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("type")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("type")]
|
||||
public string Type { get; set; } = default!;
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置回复内容。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("content")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("content")]
|
||||
public string? Content { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置图文消息列表。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("news_info")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("news_info")]
|
||||
public Types.NewsList? NewsList { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置规则名称。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("rule_name")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("rule_name")]
|
||||
public string RuleName { get; set; } = default!;
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置回复模式。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("reply_mode")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("reply_mode")]
|
||||
public string ReplyMode { get; set; } = default!;
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置创建时间戳。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("create_time")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("create_time")]
|
||||
public long CreateTimestamp { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置匹配的关键词列表。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("keyword_list_info")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("keyword_list_info")]
|
||||
public Types.Keyword[] KeywordList { get; set; } = default!;
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置自动回复列表。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("reply_list_info")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("reply_list_info")]
|
||||
public Types.Reply[] ReplyList { get; set; } = default!;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置关注后自动回复是否开启。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("is_add_friend_reply_open")]
|
||||
[Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.NumericalBooleanConverter))]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("is_add_friend_reply_open")]
|
||||
[System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Converters.NumericalBooleanConverter))]
|
||||
public bool IsAddFriendReplyOpen { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置消息自动回复是否开启。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("is_autoreply_open")]
|
||||
[Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.NumericalBooleanConverter))]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("is_autoreply_open")]
|
||||
[System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Converters.NumericalBooleanConverter))]
|
||||
public bool IsAutoReplyOpen { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置关注后自动回复的信息。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("add_friend_autoreply_info")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("add_friend_autoreply_info")]
|
||||
public Types.AutoReplyInfo? AddFriendAutoReplyInfo { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置消息自动回复的信息。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("message_default_autoreply_info")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("message_default_autoreply_info")]
|
||||
public Types.AutoReplyInfo? MessageDefaultAutoReplyInfo { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置关键字回复规则列表。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("keyword_autoreply_info")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("keyword_autoreply_info")]
|
||||
public Types.KeywordAutoReplyRuleList? KeywordAutoReplyRuleList { get; set; } = default!;
|
||||
}
|
||||
}
|
@@ -15,7 +15,7 @@
|
||||
{
|
||||
public static class Types
|
||||
{
|
||||
public class News
|
||||
public class NewsList
|
||||
{
|
||||
/// <summary>
|
||||
/// 获取或设置图文消息列表。
|
||||
@@ -130,7 +130,7 @@
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("news_info")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("news_info")]
|
||||
public Types.News? News { get; set; }
|
||||
public Types.NewsList? News { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置子菜单信息。
|
||||
|
@@ -0,0 +1,126 @@
|
||||
{
|
||||
"is_add_friend_reply_open": 1,
|
||||
"is_autoreply_open": 1,
|
||||
"add_friend_autoreply_info": {
|
||||
"type": "text",
|
||||
"content": "Thanks for your attention!"
|
||||
},
|
||||
"message_default_autoreply_info": {
|
||||
"type": "text",
|
||||
"content": "Hello, this is autoreply!"
|
||||
},
|
||||
"keyword_autoreply_info": {
|
||||
"list": [
|
||||
{
|
||||
"rule_name": "autoreply-news",
|
||||
"create_time": 1423028166,
|
||||
"reply_mode": "reply_all",
|
||||
"keyword_list_info": [
|
||||
{
|
||||
"type": "text",
|
||||
"match_mode": "contain",
|
||||
"content": "news测试"
|
||||
}
|
||||
],
|
||||
"reply_list_info": [
|
||||
{
|
||||
"type": "news",
|
||||
"news_info": {
|
||||
"list": [
|
||||
{
|
||||
"title": "it's news",
|
||||
"author": "jim",
|
||||
"digest": "it's digest",
|
||||
"show_cover": 1,
|
||||
"cover_url": "http://mmbiz.qpic.cn/mmbiz/GE7et87vE9vicuCibqXsX9GPPLuEtBfXfKbE8sWdt2DDcL0dMfQWJWTVn1N8DxI0gcRmrtqBOuwQH euPKmFLK0ZQ/0",
|
||||
"content_url": "http://mp.weixin.qq.com/s?__biz=MjM5ODUwNTM3Ng==&mid=203929886&idx=1&sn=628f964cf0c6d84c026881b6959aea8b#rd",
|
||||
"source_url": "http://www.url.com"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "news",
|
||||
"content": "KQb_w_Tiz-nSdVLoTV35Psmty8hGBulGhEdbb9SKs-o",
|
||||
"news_info": {
|
||||
"list": [
|
||||
{
|
||||
"title": "MULTI_NEWS",
|
||||
"author": "JIMZHENG",
|
||||
"digest": "text",
|
||||
"show_cover": 0,
|
||||
"cover_url": "http://mmbiz.qpic.cn/mmbiz/GE7et87vE9vicuCibqXsX9GPPLuEtBfXfK0HKuBIa1A1cypS0uY1wickv70iaY1gf3I1DTszuJoS3lAVLv hTcm9sDA/0",
|
||||
"content_url": "http://mp.weixin.qq.com/s?__biz=MjM5ODUwNTM3Ng==&mid=204013432&idx=1&sn=80ce6d9abcb832237bf86c87e50fda15#rd",
|
||||
"source_url": ""
|
||||
},
|
||||
{
|
||||
"title": "MULTI_NEWS4",
|
||||
"author": "JIMZHENG",
|
||||
"digest": "MULTI_NEWSMULTI_NEWSMULTI_NEWSMULTI_NEWSMULTI_NEWSMULT",
|
||||
"show_cover": 1,
|
||||
"cover_url": "http://mmbiz.qpic.cn/mmbiz/GE7et87vE9vicuCibqXsX9GPPLuEtBfXfKbE8sWdt2DDcL0dMfQWJWTVn1N8DxI0gcRmrtqBOuwQ HeuPKmFLK0ZQ/0",
|
||||
"content_url": "http://mp.weixin.qq.com/s?__biz=MjM5ODUwNTM3Ng==&mid=204013432&idx=5&sn=b4ef73a915e7c2265e437096582774af#rd",
|
||||
"source_url": ""
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"rule_name": "autoreply-voice",
|
||||
"create_time": 1423027971,
|
||||
"reply_mode": "random_one",
|
||||
"keyword_list_info": [
|
||||
{
|
||||
"type": "text",
|
||||
"match_mode": "contain",
|
||||
"content": "voice测试"
|
||||
}
|
||||
],
|
||||
"reply_list_info": [
|
||||
{
|
||||
"type": "voice",
|
||||
"content": "NESsxgHEvAcg3egJTtYj4uG1PTL6iPhratdWKDLAXYErhN6oEEfMdVyblWtBY5vp"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"rule_name": "autoreply-text",
|
||||
"create_time": 1423027926,
|
||||
"reply_mode": "random_one",
|
||||
"keyword_list_info": [
|
||||
{
|
||||
"type": "text",
|
||||
"match_mode": "contain",
|
||||
"content": "text测试"
|
||||
}
|
||||
],
|
||||
"reply_list_info": [
|
||||
{
|
||||
"type": "text",
|
||||
"content": "hello!text!"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"rule_name": "autoreply-video",
|
||||
"create_time": 1423027801,
|
||||
"reply_mode": "random_one",
|
||||
"keyword_list_info": [
|
||||
{
|
||||
"type": "text",
|
||||
"match_mode": "equal",
|
||||
"content": "video测试"
|
||||
}
|
||||
],
|
||||
"reply_list_info": [
|
||||
{
|
||||
"type": "video",
|
||||
"content": "http://61.182.133.153/vweixinp.tc.qq.com/1007_114bcede9a2244eeb5ab7f76d951df5f.f10.mp4?vkey=7183E5C952B16C3AB1991BA8138673DE1037CB82A29801A504B64A77F691BF9DF7AD054A9B7FE683&sha=0&save=1"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user