feat(openai): 重命名 "WechatOpenAI" → "WechatChatbot"

This commit is contained in:
Fu Diwei
2024-06-04 19:56:01 +08:00
parent 7909b8615b
commit ad9b5a1641
82 changed files with 143 additions and 194 deletions

View File

@@ -35,13 +35,13 @@
using SKIT.FlurlHttpClient.Wechat; using SKIT.FlurlHttpClient.Wechat;
using SKIT.FlurlHttpClient.Wechat.OpenAI; using SKIT.FlurlHttpClient.Wechat.OpenAI;
var options = new WechatOpenAIClientOptions() var options = new WechatChatbotClientOptions()
{ {
AppId = "微信智能对话 AppId", AppId = "微信智能对话 AppId",
Token = "微信智能对话 Token", Token = "微信智能对话 Token",
EncodingAESKey = "微信智能对话 EncodingAESKey" EncodingAESKey = "微信智能对话 EncodingAESKey"
}; };
var client = WechatOpenAIClientBuilder.Create(options).Build(); var client = WechatChatbotClientBuilder.Create(options).Build();
``` ```
### 请求 & 响应: ### 请求 & 响应:
@@ -66,6 +66,7 @@ if (response.IsSuccessful())
else else
{ {
Console.WriteLine("错误代码:" + response.ErrorCode); Console.WriteLine("错误代码:" + response.ErrorCode);
Console.WriteLine("错误描述:" + response.ErrorMessage);
Console.WriteLine("返回代码:" + response.ReturnCode); Console.WriteLine("返回代码:" + response.ReturnCode);
Console.WriteLine("返回错误:" + response.ReturnError); Console.WriteLine("返回错误:" + response.ReturnError);
} }

View File

@@ -7,7 +7,7 @@ namespace SKIT.FlurlHttpClient.Wechat.OpenAI.Events
/// <![CDATA[ https://developers.weixin.qq.com/doc/aispeech/confapi/thirdkefu/recivemsg.html ]]> /// <![CDATA[ https://developers.weixin.qq.com/doc/aispeech/confapi/thirdkefu/recivemsg.html ]]>
/// </para> /// </para>
/// </summary> /// </summary>
public class UserEnterEvent : WechatOpenAIEvent public class UserEnterEvent : WechatChatbotEvent
{ {
public static class Types public static class Types
{ {

View File

@@ -3,43 +3,43 @@ using System;
namespace SKIT.FlurlHttpClient.Wechat.OpenAI namespace SKIT.FlurlHttpClient.Wechat.OpenAI
{ {
/// <summary> /// <summary>
/// 为 <see cref="WechatOpenAIClient"/> 提供回调通知事件的扩展方法。 /// 为 <see cref="WechatChatbotClient"/> 提供回调通知事件的扩展方法。
/// </summary> /// </summary>
public static partial class WechatOpenAIClientEventExtensions public static partial class WechatChatbotClientEventExtensions
{ {
/// <summary> /// <summary>
/// <para>从 XML 反序列化得到 <see cref="WechatOpenAIEvent"/> 对象。</para> /// <para>从 XML 反序列化得到 <see cref="WechatChatbotEvent"/> 对象。</para>
/// </summary> /// </summary>
/// <typeparam name="TEvent"></typeparam> /// <typeparam name="TEvent"></typeparam>
/// <param name="client"></param> /// <param name="client"></param>
/// <param name="webhookXml"></param> /// <param name="webhookXml"></param>
/// <returns></returns> /// <returns></returns>
public static TEvent DeserializeEventFromXml<TEvent>(this WechatOpenAIClient client, string webhookXml) public static TEvent DeserializeEventFromXml<TEvent>(this WechatChatbotClient client, string webhookXml)
where TEvent : WechatOpenAIEvent, new() where TEvent : WechatChatbotEvent, new()
{ {
return InnerDeserializeEventFromXml<TEvent>(client, webhookXml); return InnerDeserializeEventFromXml<TEvent>(client, webhookXml);
} }
/// <summary> /// <summary>
/// <para>从 XML 反序列化得到 <see cref="WechatOpenAIEvent"/> 对象。</para> /// <para>从 XML 反序列化得到 <see cref="WechatChatbotEvent"/> 对象。</para>
/// </summary> /// </summary>
/// <param name="client"></param> /// <param name="client"></param>
/// <param name="webhookXml"></param> /// <param name="webhookXml"></param>
/// <returns></returns> /// <returns></returns>
public static WechatOpenAIEvent DeserializeEventFromXml(this WechatOpenAIClient client, string webhookXml) public static WechatChatbotEvent DeserializeEventFromXml(this WechatChatbotClient client, string webhookXml)
{ {
return InnerDeserializeEventFromXml<WechatOpenAIEvent>(client, webhookXml); return InnerDeserializeEventFromXml<WechatChatbotEvent>(client, webhookXml);
} }
/// <summary> /// <summary>
/// 将 <see cref="WechatOpenAIEvent"/> 对象序列化成 XML。 /// 将 <see cref="WechatChatbotEvent"/> 对象序列化成 XML。
/// </summary> /// </summary>
/// <typeparam name="TEvent"></typeparam> /// <typeparam name="TEvent"></typeparam>
/// <param name="client"></param> /// <param name="client"></param>
/// <param name="webhookEvent"></param> /// <param name="webhookEvent"></param>
/// <returns></returns> /// <returns></returns>
public static string SerializeEventToXml<TEvent>(this WechatOpenAIClient client, TEvent webhookEvent) public static string SerializeEventToXml<TEvent>(this WechatChatbotClient client, TEvent webhookEvent)
where TEvent : WechatOpenAIEvent, new() where TEvent : WechatChatbotEvent, new()
{ {
string xml; string xml;
@@ -49,13 +49,13 @@ namespace SKIT.FlurlHttpClient.Wechat.OpenAI
} }
catch (Exception ex) catch (Exception ex)
{ {
throw new WechatOpenAIException("Failed to serialize event data. Please see the inner exception for more details.", ex); throw new WechatChatbotException("Failed to serialize event data. Please see the inner exception for more details.", ex);
} }
if (string.IsNullOrEmpty(client.Credentials.EncodingAESKey)) if (string.IsNullOrEmpty(client.Credentials.EncodingAESKey))
throw new WechatOpenAIException("Failed to encrypt event data, because the push encoding AES key is not set."); throw new WechatChatbotException("Failed to encrypt event data, because the push encoding AES key is not set.");
if (string.IsNullOrEmpty(client.Credentials.Token)) if (string.IsNullOrEmpty(client.Credentials.Token))
throw new WechatOpenAIException("Failed to encrypt event data, because the push token is not set."); throw new WechatChatbotException("Failed to encrypt event data, because the push token is not set.");
try try
{ {
@@ -69,17 +69,17 @@ namespace SKIT.FlurlHttpClient.Wechat.OpenAI
} }
catch (Exception ex) catch (Exception ex)
{ {
throw new WechatOpenAIException("Failed to encrypt event data. Please see the inner exception for more details.", ex); throw new WechatChatbotException("Failed to encrypt event data. Please see the inner exception for more details.", ex);
} }
return xml; return xml;
} }
} }
partial class WechatOpenAIClientEventExtensions partial class WechatChatbotClientEventExtensions
{ {
private static TEvent InnerDeserializeEventFromXml<TEvent>(this WechatOpenAIClient client, string webhookXml) private static TEvent InnerDeserializeEventFromXml<TEvent>(this WechatChatbotClient client, string webhookXml)
where TEvent : WechatOpenAIEvent where TEvent : WechatChatbotEvent
{ {
if (client is null) throw new ArgumentNullException(nameof(client)); if (client is null) throw new ArgumentNullException(nameof(client));
if (webhookXml is null) throw new ArgumentNullException(webhookXml); if (webhookXml is null) throw new ArgumentNullException(webhookXml);
@@ -87,18 +87,18 @@ namespace SKIT.FlurlHttpClient.Wechat.OpenAI
try try
{ {
if (!Utilities.WxMsgCryptor.TryParseXml(webhookXml, out string? encryptedXml)) if (!Utilities.WxMsgCryptor.TryParseXml(webhookXml, out string? encryptedXml))
throw new WechatOpenAIException("Failed to decrypt event data, because of the encrypted data is empty."); throw new WechatChatbotException("Failed to decrypt event data, because of the encrypted data is empty.");
webhookXml = Utilities.WxMsgCryptor.AESDecrypt(cipherText: encryptedXml!, encodingAESKey: client.Credentials.EncodingAESKey!, out _); webhookXml = Utilities.WxMsgCryptor.AESDecrypt(cipherText: encryptedXml!, encodingAESKey: client.Credentials.EncodingAESKey!, out _);
return Utilities.XmlHelper.Deserialize<TEvent>(webhookXml); return Utilities.XmlHelper.Deserialize<TEvent>(webhookXml);
} }
catch (WechatOpenAIException) catch (WechatChatbotException)
{ {
throw; throw;
} }
catch (Exception ex) catch (Exception ex)
{ {
throw new WechatOpenAIException("Failed to deserialize event data. Please see the inner exception for more details.", ex); throw new WechatChatbotException("Failed to deserialize event data. Please see the inner exception for more details.", ex);
} }
} }
} }

View File

@@ -6,7 +6,7 @@ using Flurl.Http;
namespace SKIT.FlurlHttpClient.Wechat.OpenAI namespace SKIT.FlurlHttpClient.Wechat.OpenAI
{ {
public static class WechatOpenAIClientExecuteBotExtensions public static class WechatChatbotClientExecuteBotExtensions
{ {
/// <summary> /// <summary>
/// <para>异步调用 [POST] /batchimportskill/{TOKEN} 接口。</para> /// <para>异步调用 [POST] /batchimportskill/{TOKEN} 接口。</para>
@@ -19,8 +19,7 @@ namespace SKIT.FlurlHttpClient.Wechat.OpenAI
/// <param name="request"></param> /// <param name="request"></param>
/// <param name="cancellationToken"></param> /// <param name="cancellationToken"></param>
/// <returns></returns> /// <returns></returns>
[Obsolete("相关接口或字段于 2023-04-10 下线。")] public static async Task<Models.BatchImportSkillResponse> ExecuteBatchImportSkillAsync(this WechatChatbotClient client, Models.BatchImportSkillRequest request, CancellationToken cancellationToken = default)
public static async Task<Models.BatchImportSkillResponse> ExecuteBatchImportSkillAsync(this WechatOpenAIClient client, Models.BatchImportSkillRequest request, CancellationToken cancellationToken = default)
{ {
if (client is null) throw new ArgumentNullException(nameof(client)); if (client is null) throw new ArgumentNullException(nameof(client));
if (request is null) throw new ArgumentNullException(nameof(request)); if (request is null) throw new ArgumentNullException(nameof(request));
@@ -42,8 +41,7 @@ namespace SKIT.FlurlHttpClient.Wechat.OpenAI
/// <param name="request"></param> /// <param name="request"></param>
/// <param name="cancellationToken"></param> /// <param name="cancellationToken"></param>
/// <returns></returns> /// <returns></returns>
[Obsolete("相关接口或字段于 2023-04-10 下线。")] public static async Task<Models.PublishResponse> ExecutePublishAsync(this WechatChatbotClient client, Models.PublishRequest request, CancellationToken cancellationToken = default)
public static async Task<Models.PublishResponse> ExecutePublishAsync(this WechatOpenAIClient client, Models.PublishRequest request, CancellationToken cancellationToken = default)
{ {
if (client is null) throw new ArgumentNullException(nameof(client)); if (client is null) throw new ArgumentNullException(nameof(client));
if (request is null) throw new ArgumentNullException(nameof(request)); if (request is null) throw new ArgumentNullException(nameof(request));
@@ -65,8 +63,7 @@ namespace SKIT.FlurlHttpClient.Wechat.OpenAI
/// <param name="request"></param> /// <param name="request"></param>
/// <param name="cancellationToken"></param> /// <param name="cancellationToken"></param>
/// <returns></returns> /// <returns></returns>
[Obsolete("相关接口或字段于 2023-04-10 下线。")] public static async Task<Models.PublishProgressResponse> ExecutePublishProgressAsync(this WechatChatbotClient client, Models.PublishProgressRequest request, CancellationToken cancellationToken = default)
public static async Task<Models.PublishProgressResponse> ExecutePublishProgressAsync(this WechatOpenAIClient client, Models.PublishProgressRequest request, CancellationToken cancellationToken = default)
{ {
if (client is null) throw new ArgumentNullException(nameof(client)); if (client is null) throw new ArgumentNullException(nameof(client));
if (request is null) throw new ArgumentNullException(nameof(request)); if (request is null) throw new ArgumentNullException(nameof(request));
@@ -88,8 +85,7 @@ namespace SKIT.FlurlHttpClient.Wechat.OpenAI
/// <param name="request"></param> /// <param name="request"></param>
/// <param name="cancellationToken"></param> /// <param name="cancellationToken"></param>
/// <returns></returns> /// <returns></returns>
[Obsolete("相关接口或字段于 2023-04-10 下线。")] public static async Task<Models.SetAutoReplyResponse> ExecuteSetAutoReplyAsync(this WechatChatbotClient client, Models.SetAutoReplyRequest request, CancellationToken cancellationToken = default)
public static async Task<Models.SetAutoReplyResponse> ExecuteSetAutoReplyAsync(this WechatOpenAIClient client, Models.SetAutoReplyRequest request, CancellationToken cancellationToken = default)
{ {
if (client is null) throw new ArgumentNullException(nameof(client)); if (client is null) throw new ArgumentNullException(nameof(client));
if (request is null) throw new ArgumentNullException(nameof(request)); if (request is null) throw new ArgumentNullException(nameof(request));
@@ -111,8 +107,7 @@ namespace SKIT.FlurlHttpClient.Wechat.OpenAI
/// <param name="request"></param> /// <param name="request"></param>
/// <param name="cancellationToken"></param> /// <param name="cancellationToken"></param>
/// <returns></returns> /// <returns></returns>
[Obsolete("相关接口或字段于 2023-04-10 下线。")] public static async Task<Models.LabelBatchSetResponse> ExecuteLabelBatchSetAsync(this WechatChatbotClient client, Models.LabelBatchSetRequest request, CancellationToken cancellationToken = default)
public static async Task<Models.LabelBatchSetResponse> ExecuteLabelBatchSetAsync(this WechatOpenAIClient client, Models.LabelBatchSetRequest request, CancellationToken cancellationToken = default)
{ {
if (client is null) throw new ArgumentNullException(nameof(client)); if (client is null) throw new ArgumentNullException(nameof(client));
if (request is null) throw new ArgumentNullException(nameof(request)); if (request is null) throw new ArgumentNullException(nameof(request));

View File

@@ -6,7 +6,7 @@ using Flurl.Http;
namespace SKIT.FlurlHttpClient.Wechat.OpenAI namespace SKIT.FlurlHttpClient.Wechat.OpenAI
{ {
public static class WechatOpenAIClientExecuteDialogExtensions public static class WechatChatbotClientExecuteDialogExtensions
{ {
/// <summary> /// <summary>
/// <para>异步调用 [POST] /sign/{TOKEN} 接口。</para> /// <para>异步调用 [POST] /sign/{TOKEN} 接口。</para>
@@ -19,8 +19,7 @@ namespace SKIT.FlurlHttpClient.Wechat.OpenAI
/// <param name="request"></param> /// <param name="request"></param>
/// <param name="cancellationToken"></param> /// <param name="cancellationToken"></param>
/// <returns></returns> /// <returns></returns>
[Obsolete("相关接口或字段于 2023-04-10 下线。")] public static async Task<Models.SignResponse> ExecuteSignAsync(this WechatChatbotClient client, Models.SignRequest request, CancellationToken cancellationToken = default)
public static async Task<Models.SignResponse> ExecuteSignAsync(this WechatOpenAIClient client, Models.SignRequest request, CancellationToken cancellationToken = default)
{ {
if (client is null) throw new ArgumentNullException(nameof(client)); if (client is null) throw new ArgumentNullException(nameof(client));
if (request is null) throw new ArgumentNullException(nameof(request)); if (request is null) throw new ArgumentNullException(nameof(request));
@@ -42,8 +41,7 @@ namespace SKIT.FlurlHttpClient.Wechat.OpenAI
/// <param name="request"></param> /// <param name="request"></param>
/// <param name="cancellationToken"></param> /// <param name="cancellationToken"></param>
/// <returns></returns> /// <returns></returns>
[Obsolete("相关接口或字段于 2023-04-10 下线。")] public static async Task<Models.AIBotResponse> ExecuteAIBotAsync(this WechatChatbotClient client, Models.AIBotRequest request, CancellationToken cancellationToken = default)
public static async Task<Models.AIBotResponse> ExecuteAIBotAsync(this WechatOpenAIClient client, Models.AIBotRequest request, CancellationToken cancellationToken = default)
{ {
if (client is null) throw new ArgumentNullException(nameof(client)); if (client is null) throw new ArgumentNullException(nameof(client));
if (request is null) throw new ArgumentNullException(nameof(request)); if (request is null) throw new ArgumentNullException(nameof(request));
@@ -66,7 +64,7 @@ namespace SKIT.FlurlHttpClient.Wechat.OpenAI
/// <param name="cancellationToken"></param> /// <param name="cancellationToken"></param>
/// <returns></returns> /// <returns></returns>
[Obsolete("相关接口或字段于 2023-04-07 下线。")] [Obsolete("相关接口或字段于 2023-04-07 下线。")]
public static async Task<Models.FeedbackResponse> ExecuteFeedbackAsync(this WechatOpenAIClient client, Models.FeedbackRequest request, CancellationToken cancellationToken = default) public static async Task<Models.FeedbackResponse> ExecuteFeedbackAsync(this WechatChatbotClient client, Models.FeedbackRequest request, CancellationToken cancellationToken = default)
{ {
if (client is null) throw new ArgumentNullException(nameof(client)); if (client is null) throw new ArgumentNullException(nameof(client));
if (request is null) throw new ArgumentNullException(nameof(request)); if (request is null) throw new ArgumentNullException(nameof(request));
@@ -89,7 +87,7 @@ namespace SKIT.FlurlHttpClient.Wechat.OpenAI
/// <param name="cancellationToken"></param> /// <param name="cancellationToken"></param>
/// <returns></returns> /// <returns></returns>
[Obsolete("相关接口或字段于 2023-04-07 下线。")] [Obsolete("相关接口或字段于 2023-04-07 下线。")]
public static async Task<Models.GetHotQueryListResponse> ExecuteGetHotQueryListAsync(this WechatOpenAIClient client, Models.GetHotQueryListRequest request, CancellationToken cancellationToken = default) public static async Task<Models.GetHotQueryListResponse> ExecuteGetHotQueryListAsync(this WechatChatbotClient client, Models.GetHotQueryListRequest request, CancellationToken cancellationToken = default)
{ {
if (client is null) throw new ArgumentNullException(nameof(client)); if (client is null) throw new ArgumentNullException(nameof(client));
if (request is null) throw new ArgumentNullException(nameof(request)); if (request is null) throw new ArgumentNullException(nameof(request));
@@ -112,7 +110,7 @@ namespace SKIT.FlurlHttpClient.Wechat.OpenAI
/// <param name="cancellationToken"></param> /// <param name="cancellationToken"></param>
/// <returns></returns> /// <returns></returns>
[Obsolete("相关接口或字段于 2023-04-07 下线。")] [Obsolete("相关接口或字段于 2023-04-07 下线。")]
public static async Task<Models.GetHotQueryDetailResponse> ExecuteGetHotQueryDetailAsync(this WechatOpenAIClient client, Models.GetHotQueryDetailRequest request, CancellationToken cancellationToken = default) public static async Task<Models.GetHotQueryDetailResponse> ExecuteGetHotQueryDetailAsync(this WechatChatbotClient client, Models.GetHotQueryDetailRequest request, CancellationToken cancellationToken = default)
{ {
if (client is null) throw new ArgumentNullException(nameof(client)); if (client is null) throw new ArgumentNullException(nameof(client));
if (request is null) throw new ArgumentNullException(nameof(request)); if (request is null) throw new ArgumentNullException(nameof(request));

View File

@@ -9,7 +9,7 @@ using Flurl.Http;
namespace SKIT.FlurlHttpClient.Wechat.OpenAI namespace SKIT.FlurlHttpClient.Wechat.OpenAI
{ {
public static class WechatOpenAIClientExecuteMpExtensions public static class WechatChatbotClientExecuteMpExtensions
{ {
/// <summary> /// <summary>
/// <para>异步调用 [POST] /getbindlink/{TOKEN} 接口。</para> /// <para>异步调用 [POST] /getbindlink/{TOKEN} 接口。</para>
@@ -23,7 +23,7 @@ namespace SKIT.FlurlHttpClient.Wechat.OpenAI
/// <param name="cancellationToken"></param> /// <param name="cancellationToken"></param>
/// <returns></returns> /// <returns></returns>
[Obsolete("相关接口或字段于 2023-04-07 下线。")] [Obsolete("相关接口或字段于 2023-04-07 下线。")]
public static async Task<Models.GetBindLinkResponse> ExecuteGetBindLinkAsync(this WechatOpenAIClient client, Models.GetBindLinkRequest request, CancellationToken cancellationToken = default) public static async Task<Models.GetBindLinkResponse> ExecuteGetBindLinkAsync(this WechatChatbotClient client, Models.GetBindLinkRequest request, CancellationToken cancellationToken = default)
{ {
if (client is null) throw new ArgumentNullException(nameof(client)); if (client is null) throw new ArgumentNullException(nameof(client));
if (request is null) throw new ArgumentNullException(nameof(request)); if (request is null) throw new ArgumentNullException(nameof(request));
@@ -46,7 +46,7 @@ namespace SKIT.FlurlHttpClient.Wechat.OpenAI
/// <param name="cancellationToken"></param> /// <param name="cancellationToken"></param>
/// <returns></returns> /// <returns></returns>
[Obsolete("相关接口或字段于 2023-04-07 下线。")] [Obsolete("相关接口或字段于 2023-04-07 下线。")]
public static async Task<Models.GetBindListResponse> ExecuteGetBindListAsync(this WechatOpenAIClient client, Models.GetBindListRequest request, CancellationToken cancellationToken = default) public static async Task<Models.GetBindListResponse> ExecuteGetBindListAsync(this WechatChatbotClient client, Models.GetBindListRequest request, CancellationToken cancellationToken = default)
{ {
if (client is null) throw new ArgumentNullException(nameof(client)); if (client is null) throw new ArgumentNullException(nameof(client));
if (request is null) throw new ArgumentNullException(nameof(request)); if (request is null) throw new ArgumentNullException(nameof(request));
@@ -69,7 +69,7 @@ namespace SKIT.FlurlHttpClient.Wechat.OpenAI
/// <param name="cancellationToken"></param> /// <param name="cancellationToken"></param>
/// <returns></returns> /// <returns></returns>
[Obsolete("相关接口或字段于 2023-04-07 下线。")] [Obsolete("相关接口或字段于 2023-04-07 下线。")]
public static async Task<Models.UnbindMpResponse> ExecuteUnbindMpAsync(this WechatOpenAIClient client, Models.UnbindMpRequest request, CancellationToken cancellationToken = default) public static async Task<Models.UnbindMpResponse> ExecuteUnbindMpAsync(this WechatChatbotClient client, Models.UnbindMpRequest request, CancellationToken cancellationToken = default)
{ {
if (client is null) throw new ArgumentNullException(nameof(client)); if (client is null) throw new ArgumentNullException(nameof(client));
if (request is null) throw new ArgumentNullException(nameof(request)); if (request is null) throw new ArgumentNullException(nameof(request));
@@ -92,7 +92,7 @@ namespace SKIT.FlurlHttpClient.Wechat.OpenAI
/// <param name="cancellationToken"></param> /// <param name="cancellationToken"></param>
/// <returns></returns> /// <returns></returns>
[Obsolete("相关接口或字段于 2023-04-07 下线。")] [Obsolete("相关接口或字段于 2023-04-07 下线。")]
public static async Task<Models.GetH5LinkResponse> ExecuteGetH5LinkAsync(this WechatOpenAIClient client, Models.GetH5LinkRequest request, CancellationToken cancellationToken = default) public static async Task<Models.GetH5LinkResponse> ExecuteGetH5LinkAsync(this WechatChatbotClient client, Models.GetH5LinkRequest request, CancellationToken cancellationToken = default)
{ {
if (client is null) throw new ArgumentNullException(nameof(client)); if (client is null) throw new ArgumentNullException(nameof(client));
if (request is null) throw new ArgumentNullException(nameof(request)); if (request is null) throw new ArgumentNullException(nameof(request));
@@ -115,7 +115,7 @@ namespace SKIT.FlurlHttpClient.Wechat.OpenAI
/// <param name="cancellationToken"></param> /// <param name="cancellationToken"></param>
/// <returns></returns> /// <returns></returns>
[Obsolete("相关接口或字段于 2023-04-07 下线。")] [Obsolete("相关接口或字段于 2023-04-07 下线。")]
public static async Task<Models.AssetsUploadResponse> ExecuteAssetsUploadAsync(this WechatOpenAIClient client, Models.AssetsUploadRequest request, CancellationToken cancellationToken = default) public static async Task<Models.AssetsUploadResponse> ExecuteAssetsUploadAsync(this WechatChatbotClient client, Models.AssetsUploadRequest request, CancellationToken cancellationToken = default)
{ {
if (client is null) throw new ArgumentNullException(nameof(client)); if (client is null) throw new ArgumentNullException(nameof(client));
if (request is null) throw new ArgumentNullException(nameof(request)); if (request is null) throw new ArgumentNullException(nameof(request));

View File

@@ -6,7 +6,7 @@ using Flurl.Http;
namespace SKIT.FlurlHttpClient.Wechat.OpenAI namespace SKIT.FlurlHttpClient.Wechat.OpenAI
{ {
public static class WechatOpenAIClientExecuteThirdKefuExtensions public static class WechatChatbotClientExecuteThirdKefuExtensions
{ {
/// <summary> /// <summary>
/// <para>异步调用 [POST] /sendmsg/{TOKEN} 接口。</para> /// <para>异步调用 [POST] /sendmsg/{TOKEN} 接口。</para>
@@ -19,7 +19,7 @@ namespace SKIT.FlurlHttpClient.Wechat.OpenAI
/// <param name="request"></param> /// <param name="request"></param>
/// <param name="cancellationToken"></param> /// <param name="cancellationToken"></param>
/// <returns></returns> /// <returns></returns>
public static async Task<Models.SendMessageResponse> ExecuteSendMessageAsync(this WechatOpenAIClient client, Models.SendMessageRequest request, CancellationToken cancellationToken = default) public static async Task<Models.SendMessageResponse> ExecuteSendMessageAsync(this WechatChatbotClient client, Models.SendMessageRequest request, CancellationToken cancellationToken = default)
{ {
if (client is null) throw new ArgumentNullException(nameof(client)); if (client is null) throw new ArgumentNullException(nameof(client));
if (request is null) throw new ArgumentNullException(nameof(request)); if (request is null) throw new ArgumentNullException(nameof(request));
@@ -44,7 +44,7 @@ namespace SKIT.FlurlHttpClient.Wechat.OpenAI
/// <param name="request"></param> /// <param name="request"></param>
/// <param name="cancellationToken"></param> /// <param name="cancellationToken"></param>
/// <returns></returns> /// <returns></returns>
public static async Task<Models.KefuStateGetResponse> ExecuteKefuStateGetAsync(this WechatOpenAIClient client, Models.KefuStateGetRequest request, CancellationToken cancellationToken = default) public static async Task<Models.KefuStateGetResponse> ExecuteKefuStateGetAsync(this WechatChatbotClient client, Models.KefuStateGetRequest request, CancellationToken cancellationToken = default)
{ {
if (client is null) throw new ArgumentNullException(nameof(client)); if (client is null) throw new ArgumentNullException(nameof(client));
if (request is null) throw new ArgumentNullException(nameof(request)); if (request is null) throw new ArgumentNullException(nameof(request));
@@ -69,7 +69,7 @@ namespace SKIT.FlurlHttpClient.Wechat.OpenAI
/// <param name="request"></param> /// <param name="request"></param>
/// <param name="cancellationToken"></param> /// <param name="cancellationToken"></param>
/// <returns></returns> /// <returns></returns>
public static async Task<Models.KefuStateChangeResponse> ExecuteKefuStateChangeAsync(this WechatOpenAIClient client, Models.KefuStateChangeRequest request, CancellationToken cancellationToken = default) public static async Task<Models.KefuStateChangeResponse> ExecuteKefuStateChangeAsync(this WechatChatbotClient client, Models.KefuStateChangeRequest request, CancellationToken cancellationToken = default)
{ {
if (client is null) throw new ArgumentNullException(nameof(client)); if (client is null) throw new ArgumentNullException(nameof(client));
if (request is null) throw new ArgumentNullException(nameof(request)); if (request is null) throw new ArgumentNullException(nameof(request));

View File

@@ -1,4 +1,3 @@
using System;
using System.Collections.Generic; using System.Collections.Generic;
namespace SKIT.FlurlHttpClient.Wechat.OpenAI.Models namespace SKIT.FlurlHttpClient.Wechat.OpenAI.Models
@@ -6,8 +5,7 @@ namespace SKIT.FlurlHttpClient.Wechat.OpenAI.Models
/// <summary> /// <summary>
/// <para>表示 [POST] /batchimportskill/{TOKEN} 接口的请求。</para> /// <para>表示 [POST] /batchimportskill/{TOKEN} 接口的请求。</para>
/// </summary> /// </summary>
[Obsolete("相关接口或字段于 2023-04-10 下线。")] public class BatchImportSkillRequest : WechatChatbotRequest, WechatChatbotRequest.Serialization.IEncryptedXmlable
public class BatchImportSkillRequest : WechatOpenAIRequest, WechatOpenAIRequest.Serialization.IEncryptedXmlable
{ {
public static class Types public static class Types
{ {

View File

@@ -1,12 +1,9 @@
using System;
namespace SKIT.FlurlHttpClient.Wechat.OpenAI.Models namespace SKIT.FlurlHttpClient.Wechat.OpenAI.Models
{ {
/// <summary> /// <summary>
/// <para>表示 [POST] /batchimportskill/{TOKEN} 接口的响应。</para> /// <para>表示 [POST] /batchimportskill/{TOKEN} 接口的响应。</para>
/// </summary> /// </summary>
[Obsolete("相关接口或字段于 2023-04-10 下线。")] public class BatchImportSkillResponse : WechatChatbotResponse
public class BatchImportSkillResponse : WechatOpenAIResponse
{ {
/// <summary> /// <summary>
/// <inheritdoc/> /// <inheritdoc/>

View File

@@ -1,4 +1,3 @@
using System;
using System.Collections.Generic; using System.Collections.Generic;
namespace SKIT.FlurlHttpClient.Wechat.OpenAI.Models namespace SKIT.FlurlHttpClient.Wechat.OpenAI.Models
@@ -6,8 +5,7 @@ namespace SKIT.FlurlHttpClient.Wechat.OpenAI.Models
/// <summary> /// <summary>
/// <para>表示 [POST] /label/batchset/{TOKEN} 接口的请求。</para> /// <para>表示 [POST] /label/batchset/{TOKEN} 接口的请求。</para>
/// </summary> /// </summary>
[Obsolete("相关接口或字段于 2023-04-10 下线。")] public class LabelBatchSetRequest : WechatChatbotRequest, WechatChatbotRequest.Serialization.IEncryptedXmlable
public class LabelBatchSetRequest : WechatOpenAIRequest, WechatOpenAIRequest.Serialization.IEncryptedXmlable
{ {
public static class Types public static class Types
{ {

View File

@@ -1,12 +1,9 @@
using System;
namespace SKIT.FlurlHttpClient.Wechat.OpenAI.Models namespace SKIT.FlurlHttpClient.Wechat.OpenAI.Models
{ {
/// <summary> /// <summary>
/// <para>表示 [POST] /label/batchset/{TOKEN} 接口的响应。</para> /// <para>表示 [POST] /label/batchset/{TOKEN} 接口的响应。</para>
/// </summary> /// </summary>
[Obsolete("相关接口或字段于 2023-04-10 下线。")] public class LabelBatchSetResponse : WechatChatbotResponse
public class LabelBatchSetResponse : WechatOpenAIResponse
{ {
/// <summary> /// <summary>
/// <inheritdoc/> /// <inheritdoc/>

View File

@@ -1,12 +1,9 @@
using System;
namespace SKIT.FlurlHttpClient.Wechat.OpenAI.Models namespace SKIT.FlurlHttpClient.Wechat.OpenAI.Models
{ {
/// <summary> /// <summary>
/// <para>表示 [POST] /publish_progress/{TOKEN} 接口的请求。</para> /// <para>表示 [POST] /publish_progress/{TOKEN} 接口的请求。</para>
/// </summary> /// </summary>
[Obsolete("相关接口或字段于 2023-04-10 下线。")] public class PublishProgressRequest : WechatChatbotRequest, WechatChatbotRequest.Serialization.IEncryptedXmlable
public class PublishProgressRequest : WechatOpenAIRequest, WechatOpenAIRequest.Serialization.IEncryptedXmlable
{ {
/// <summary> /// <summary>
/// 获取或设置管理员 ID。 /// 获取或设置管理员 ID。

View File

@@ -1,12 +1,9 @@
using System;
namespace SKIT.FlurlHttpClient.Wechat.OpenAI.Models namespace SKIT.FlurlHttpClient.Wechat.OpenAI.Models
{ {
/// <summary> /// <summary>
/// <para>表示 [POST] /publish_progress/{TOKEN} 接口的响应。</para> /// <para>表示 [POST] /publish_progress/{TOKEN} 接口的响应。</para>
/// </summary> /// </summary>
[Obsolete("相关接口或字段于 2023-04-10 下线。")] public class PublishProgressResponse : WechatChatbotResponse<PublishProgressResponse.Types.Data>
public class PublishProgressResponse : WechatOpenAIResponse<PublishProgressResponse.Types.Data>
{ {
public static class Types public static class Types
{ {

View File

@@ -1,12 +1,9 @@
using System;
namespace SKIT.FlurlHttpClient.Wechat.OpenAI.Models namespace SKIT.FlurlHttpClient.Wechat.OpenAI.Models
{ {
/// <summary> /// <summary>
/// <para>表示 [POST] /publish/{TOKEN} 接口的请求。</para> /// <para>表示 [POST] /publish/{TOKEN} 接口的请求。</para>
/// </summary> /// </summary>
[Obsolete("相关接口或字段于 2023-04-10 下线。")] public class PublishRequest : WechatChatbotRequest, WechatChatbotRequest.Serialization.IEncryptedXmlable
public class PublishRequest : WechatOpenAIRequest, WechatOpenAIRequest.Serialization.IEncryptedXmlable
{ {
/// <summary> /// <summary>
/// 获取或设置管理员 ID。 /// 获取或设置管理员 ID。

View File

@@ -1,12 +1,9 @@
using System;
namespace SKIT.FlurlHttpClient.Wechat.OpenAI.Models namespace SKIT.FlurlHttpClient.Wechat.OpenAI.Models
{ {
/// <summary> /// <summary>
/// <para>表示 [POST] /publish/{TOKEN} 接口的响应。</para> /// <para>表示 [POST] /publish/{TOKEN} 接口的响应。</para>
/// </summary> /// </summary>
[Obsolete("相关接口或字段于 2023-04-10 下线。")] public class PublishResponse : WechatChatbotResponse
public class PublishResponse : WechatOpenAIResponse
{ {
/// <summary> /// <summary>
/// <inheritdoc/> /// <inheritdoc/>

View File

@@ -1,4 +1,3 @@
using System;
using System.Collections.Generic; using System.Collections.Generic;
namespace SKIT.FlurlHttpClient.Wechat.OpenAI.Models namespace SKIT.FlurlHttpClient.Wechat.OpenAI.Models
@@ -6,8 +5,7 @@ namespace SKIT.FlurlHttpClient.Wechat.OpenAI.Models
/// <summary> /// <summary>
/// <para>表示 [POST] /setautoreply/{TOKEN} 接口的请求。</para> /// <para>表示 [POST] /setautoreply/{TOKEN} 接口的请求。</para>
/// </summary> /// </summary>
[Obsolete("相关接口或字段于 2023-04-10 下线。")] public class SetAutoReplyRequest : WechatChatbotRequest, WechatChatbotRequest.Serialization.IEncryptedXmlable
public class SetAutoReplyRequest : WechatOpenAIRequest, WechatOpenAIRequest.Serialization.IEncryptedXmlable
{ {
public static class Types public static class Types
{ {

View File

@@ -1,12 +1,9 @@
using System;
namespace SKIT.FlurlHttpClient.Wechat.OpenAI.Models namespace SKIT.FlurlHttpClient.Wechat.OpenAI.Models
{ {
/// <summary> /// <summary>
/// <para>表示 [POST] /setautoreply/{TOKEN} 接口的响应。</para> /// <para>表示 [POST] /setautoreply/{TOKEN} 接口的响应。</para>
/// </summary> /// </summary>
[Obsolete("相关接口或字段于 2023-04-10 下线。")] public class SetAutoReplyResponse : WechatChatbotResponse
public class SetAutoReplyResponse : WechatOpenAIResponse
{ {
/// <summary> /// <summary>
/// <inheritdoc/> /// <inheritdoc/>

View File

@@ -1,4 +1,3 @@
using System;
using System.Collections.Generic; using System.Collections.Generic;
namespace SKIT.FlurlHttpClient.Wechat.OpenAI.Models namespace SKIT.FlurlHttpClient.Wechat.OpenAI.Models
@@ -6,8 +5,7 @@ namespace SKIT.FlurlHttpClient.Wechat.OpenAI.Models
/// <summary> /// <summary>
/// <para>表示 [POST] /aibot/{TOKEN} 接口的请求。</para> /// <para>表示 [POST] /aibot/{TOKEN} 接口的请求。</para>
/// </summary> /// </summary>
[Obsolete("相关接口或字段于 2023-04-10 下线。")] public class AIBotRequest : WechatChatbotRequest
public class AIBotRequest : WechatOpenAIRequest
{ {
/// <summary> /// <summary>
/// 获取或设置请求签名。 /// 获取或设置请求签名。

View File

@@ -5,8 +5,7 @@ namespace SKIT.FlurlHttpClient.Wechat.OpenAI.Models
/// <summary> /// <summary>
/// <para>表示 [POST] /aibot/{TOKEN} 接口的响应。</para> /// <para>表示 [POST] /aibot/{TOKEN} 接口的响应。</para>
/// </summary> /// </summary>
[Obsolete("相关接口或字段于 2023-04-10 下线。")] public class AIBotResponse : WechatChatbotResponse
public class AIBotResponse : WechatOpenAIResponse
{ {
public static class Types public static class Types
{ {

View File

@@ -6,7 +6,7 @@ namespace SKIT.FlurlHttpClient.Wechat.OpenAI.Models
/// <para>表示 [POST] /feedback/{TOKEN} 接口的请求。</para> /// <para>表示 [POST] /feedback/{TOKEN} 接口的请求。</para>
/// </summary> /// </summary>
[Obsolete("相关接口或字段于 2023-04-07 下线。")] [Obsolete("相关接口或字段于 2023-04-07 下线。")]
public class FeedbackRequest : WechatOpenAIRequest, WechatOpenAIRequest.Serialization.IEncryptedXmlable public class FeedbackRequest : WechatChatbotRequest, WechatChatbotRequest.Serialization.IEncryptedXmlable
{ {
/// <summary> /// <summary>
/// 获取或设置消息 ID。 /// 获取或设置消息 ID。

View File

@@ -6,7 +6,7 @@ namespace SKIT.FlurlHttpClient.Wechat.OpenAI.Models
/// <para>表示 [POST] /feedback/{TOKEN} 接口的响应。</para> /// <para>表示 [POST] /feedback/{TOKEN} 接口的响应。</para>
/// </summary> /// </summary>
[Obsolete("相关接口或字段于 2023-04-07 下线。")] [Obsolete("相关接口或字段于 2023-04-07 下线。")]
public class FeedbackResponse : WechatOpenAIResponse public class FeedbackResponse : WechatChatbotResponse
{ {
/// <summary> /// <summary>
/// <inheritdoc/> /// <inheritdoc/>

View File

@@ -6,7 +6,7 @@ namespace SKIT.FlurlHttpClient.Wechat.OpenAI.Models
/// <para>表示 [POST] /gethotquerydetail/{TOKEN} 接口的请求。</para> /// <para>表示 [POST] /gethotquerydetail/{TOKEN} 接口的请求。</para>
/// </summary> /// </summary>
[Obsolete("相关接口或字段于 2023-04-07 下线。")] [Obsolete("相关接口或字段于 2023-04-07 下线。")]
public class GetHotQueryDetailRequest : WechatOpenAIRequest, WechatOpenAIRequest.Serialization.IEncryptedXmlable public class GetHotQueryDetailRequest : WechatChatbotRequest, WechatChatbotRequest.Serialization.IEncryptedXmlable
{ {
/// <summary> /// <summary>
/// 获取或设置分页页数。 /// 获取或设置分页页数。

View File

@@ -6,7 +6,7 @@ namespace SKIT.FlurlHttpClient.Wechat.OpenAI.Models
/// <para>表示 [POST] /gethotquerydetail/{TOKEN} 接口的响应。</para> /// <para>表示 [POST] /gethotquerydetail/{TOKEN} 接口的响应。</para>
/// </summary> /// </summary>
[Obsolete("相关接口或字段于 2023-04-07 下线。")] [Obsolete("相关接口或字段于 2023-04-07 下线。")]
public class GetHotQueryDetailResponse : WechatOpenAIResponse<GetHotQueryDetailResponse.Types.Data> public class GetHotQueryDetailResponse : WechatChatbotResponse<GetHotQueryDetailResponse.Types.Data>
{ {
public static class Types public static class Types
{ {

View File

@@ -6,7 +6,7 @@ namespace SKIT.FlurlHttpClient.Wechat.OpenAI.Models
/// <para>表示 [POST] /gethotquerylist/{TOKEN} 接口的请求。</para> /// <para>表示 [POST] /gethotquerylist/{TOKEN} 接口的请求。</para>
/// </summary> /// </summary>
[Obsolete("相关接口或字段于 2023-04-07 下线。")] [Obsolete("相关接口或字段于 2023-04-07 下线。")]
public class GetHotQueryListRequest : WechatOpenAIRequest, WechatOpenAIRequest.Serialization.IEncryptedXmlable public class GetHotQueryListRequest : WechatChatbotRequest, WechatChatbotRequest.Serialization.IEncryptedXmlable
{ {
/// <summary> /// <summary>
/// 获取或设置分页页数。 /// 获取或设置分页页数。

View File

@@ -6,7 +6,7 @@ namespace SKIT.FlurlHttpClient.Wechat.OpenAI.Models
/// <para>表示 [POST] /gethotquerylist/{TOKEN} 接口的响应。</para> /// <para>表示 [POST] /gethotquerylist/{TOKEN} 接口的响应。</para>
/// </summary> /// </summary>
[Obsolete("相关接口或字段于 2023-04-07 下线。")] [Obsolete("相关接口或字段于 2023-04-07 下线。")]
public class GetHotQueryListResponse : WechatOpenAIResponse<GetHotQueryListResponse.Types.Data> public class GetHotQueryListResponse : WechatChatbotResponse<GetHotQueryListResponse.Types.Data>
{ {
public static class Types public static class Types
{ {

View File

@@ -1,12 +1,9 @@
using System;
namespace SKIT.FlurlHttpClient.Wechat.OpenAI.Models namespace SKIT.FlurlHttpClient.Wechat.OpenAI.Models
{ {
/// <summary> /// <summary>
/// <para>表示 [POST] /sign/{TOKEN} 接口的请求。</para> /// <para>表示 [POST] /sign/{TOKEN} 接口的请求。</para>
/// </summary> /// </summary>
[Obsolete("相关接口或字段于 2023-04-10 下线。")] public class SignRequest : WechatChatbotRequest
public class SignRequest : WechatOpenAIRequest
{ {
/// <summary> /// <summary>
/// 获取或设置用户 ID。 /// 获取或设置用户 ID。

View File

@@ -1,12 +1,9 @@
using System;
namespace SKIT.FlurlHttpClient.Wechat.OpenAI.Models namespace SKIT.FlurlHttpClient.Wechat.OpenAI.Models
{ {
/// <summary> /// <summary>
/// <para>表示 [POST] /sign/{TOKEN} 接口的响应。</para> /// <para>表示 [POST] /sign/{TOKEN} 接口的响应。</para>
/// </summary> /// </summary>
[Obsolete("相关接口或字段于 2023-04-10 下线。")] public class SignResponse : WechatChatbotResponse
public class SignResponse : WechatOpenAIResponse
{ {
/// <summary> /// <summary>
/// 获取或设置请求签名。 /// 获取或设置请求签名。

View File

@@ -6,7 +6,7 @@ namespace SKIT.FlurlHttpClient.Wechat.OpenAI.Models
/// <para>表示 [POST] /assetsupload/{TOKEN} 接口的请求。</para> /// <para>表示 [POST] /assetsupload/{TOKEN} 接口的请求。</para>
/// </summary> /// </summary>
[Obsolete("相关接口或字段于 2023-04-07 下线。")] [Obsolete("相关接口或字段于 2023-04-07 下线。")]
public class AssetsUploadRequest : WechatOpenAIRequest, WechatOpenAIRequest.Serialization.IEncryptedXmlable public class AssetsUploadRequest : WechatChatbotRequest, WechatChatbotRequest.Serialization.IEncryptedXmlable
{ {
/// <summary> /// <summary>
/// 获取或设置用户 ID。 /// 获取或设置用户 ID。

View File

@@ -6,7 +6,7 @@ namespace SKIT.FlurlHttpClient.Wechat.OpenAI.Models
/// <para>表示 [POST] /assetsupload/{TOKEN} 接口的响应。</para> /// <para>表示 [POST] /assetsupload/{TOKEN} 接口的响应。</para>
/// </summary> /// </summary>
[Obsolete("相关接口或字段于 2023-04-07 下线。")] [Obsolete("相关接口或字段于 2023-04-07 下线。")]
public class AssetsUploadResponse : WechatOpenAIResponse public class AssetsUploadResponse : WechatChatbotResponse
{ {
/// <summary> /// <summary>
/// <inheritdoc/> /// <inheritdoc/>

View File

@@ -6,7 +6,7 @@ namespace SKIT.FlurlHttpClient.Wechat.OpenAI.Models
/// <para>表示 [POST] /getbindlink/{TOKEN} 接口的请求。</para> /// <para>表示 [POST] /getbindlink/{TOKEN} 接口的请求。</para>
/// </summary> /// </summary>
[Obsolete("相关接口或字段于 2023-04-07 下线。")] [Obsolete("相关接口或字段于 2023-04-07 下线。")]
public class GetBindLinkRequest : WechatOpenAIRequest, WechatOpenAIRequest.Serialization.IEncryptedXmlable public class GetBindLinkRequest : WechatChatbotRequest, WechatChatbotRequest.Serialization.IEncryptedXmlable
{ {
/// <summary> /// <summary>
/// 获取或设置直播 ID。 /// 获取或设置直播 ID。

View File

@@ -6,7 +6,7 @@ namespace SKIT.FlurlHttpClient.Wechat.OpenAI.Models
/// <para>表示 [POST] /getbindlink/{TOKEN} 接口的响应。</para> /// <para>表示 [POST] /getbindlink/{TOKEN} 接口的响应。</para>
/// </summary> /// </summary>
[Obsolete("相关接口或字段于 2023-04-07 下线。")] [Obsolete("相关接口或字段于 2023-04-07 下线。")]
public class GetBindLinkResponse : WechatOpenAIResponse public class GetBindLinkResponse : WechatChatbotResponse
{ {
/// <summary> /// <summary>
/// <inheritdoc/> /// <inheritdoc/>

View File

@@ -6,7 +6,7 @@ namespace SKIT.FlurlHttpClient.Wechat.OpenAI.Models
/// <para>表示 [POST] /getbindlist/{TOKEN} 接口的请求。</para> /// <para>表示 [POST] /getbindlist/{TOKEN} 接口的请求。</para>
/// </summary> /// </summary>
[Obsolete("相关接口或字段于 2023-04-07 下线。")] [Obsolete("相关接口或字段于 2023-04-07 下线。")]
public class GetBindListRequest : WechatOpenAIRequest public class GetBindListRequest : WechatChatbotRequest
{ {
} }
} }

View File

@@ -6,7 +6,7 @@ namespace SKIT.FlurlHttpClient.Wechat.OpenAI.Models
/// <para>表示 [POST] /getbindlist/{TOKEN} 接口的响应。</para> /// <para>表示 [POST] /getbindlist/{TOKEN} 接口的响应。</para>
/// </summary> /// </summary>
[Obsolete("相关接口或字段于 2023-04-07 下线。")] [Obsolete("相关接口或字段于 2023-04-07 下线。")]
public class GetBindListResponse : WechatOpenAIResponse public class GetBindListResponse : WechatChatbotResponse
{ {
public static class Types public static class Types
{ {

View File

@@ -6,7 +6,7 @@ namespace SKIT.FlurlHttpClient.Wechat.OpenAI.Models
/// <para>表示 [POST] /geth5link/{TOKEN} 接口的请求。</para> /// <para>表示 [POST] /geth5link/{TOKEN} 接口的请求。</para>
/// </summary> /// </summary>
[Obsolete("相关接口或字段于 2023-04-07 下线。")] [Obsolete("相关接口或字段于 2023-04-07 下线。")]
public class GetH5LinkRequest : WechatOpenAIRequest, WechatOpenAIRequest.Serialization.IEncryptedXmlable public class GetH5LinkRequest : WechatChatbotRequest, WechatChatbotRequest.Serialization.IEncryptedXmlable
{ {
/// <summary> /// <summary>
/// 获取或设置页面标题。 /// 获取或设置页面标题。

View File

@@ -6,7 +6,7 @@ namespace SKIT.FlurlHttpClient.Wechat.OpenAI.Models
/// <para>表示 [POST] /geth5link/{TOKEN} 接口的响应。</para> /// <para>表示 [POST] /geth5link/{TOKEN} 接口的响应。</para>
/// </summary> /// </summary>
[Obsolete("相关接口或字段于 2023-04-07 下线。")] [Obsolete("相关接口或字段于 2023-04-07 下线。")]
public class GetH5LinkResponse : WechatOpenAIResponse public class GetH5LinkResponse : WechatChatbotResponse
{ {
/// <summary> /// <summary>
/// <inheritdoc/> /// <inheritdoc/>

View File

@@ -6,7 +6,7 @@ namespace SKIT.FlurlHttpClient.Wechat.OpenAI.Models
/// <para>表示 [POST] /unbindmp/{TOKEN} 接口的请求。</para> /// <para>表示 [POST] /unbindmp/{TOKEN} 接口的请求。</para>
/// </summary> /// </summary>
[Obsolete("相关接口或字段于 2023-04-07 下线。")] [Obsolete("相关接口或字段于 2023-04-07 下线。")]
public class UnbindMpRequest : WechatOpenAIRequest, WechatOpenAIRequest.Serialization.IEncryptedXmlable public class UnbindMpRequest : WechatChatbotRequest, WechatChatbotRequest.Serialization.IEncryptedXmlable
{ {
/// <summary> /// <summary>
/// 获取或设置微信 AppId。 /// 获取或设置微信 AppId。

View File

@@ -6,7 +6,7 @@ namespace SKIT.FlurlHttpClient.Wechat.OpenAI.Models
/// <para>表示 [POST] /unbindmp/{TOKEN} 接口的响应。</para> /// <para>表示 [POST] /unbindmp/{TOKEN} 接口的响应。</para>
/// </summary> /// </summary>
[Obsolete("相关接口或字段于 2023-04-07 下线。")] [Obsolete("相关接口或字段于 2023-04-07 下线。")]
public class UnbindMpResponse : WechatOpenAIResponse public class UnbindMpResponse : WechatChatbotResponse
{ {
/// <summary> /// <summary>
/// <inheritdoc/> /// <inheritdoc/>

View File

@@ -3,10 +3,10 @@ namespace SKIT.FlurlHttpClient.Wechat.OpenAI.Models
/// <summary> /// <summary>
/// <para>表示 [POST] /kefustate/change/{TOKEN} 接口的请求。</para> /// <para>表示 [POST] /kefustate/change/{TOKEN} 接口的请求。</para>
/// </summary> /// </summary>
public class KefuStateChangeRequest : WechatOpenAIRequest, WechatOpenAIRequest.Serialization.IEncryptedXmlable public class KefuStateChangeRequest : WechatChatbotRequest, WechatChatbotRequest.Serialization.IEncryptedXmlable
{ {
/// <summary> /// <summary>
/// 获取或设置微信 AppId。如果不指定将使用构造 <see cref="WechatOpenAIClient"/> 时的 <see cref="WechatOpenAIClientOptions.AppId"/> 参数。 /// 获取或设置微信 AppId。如果不指定将使用构造 <see cref="WechatChatbotClient"/> 时的 <see cref="WechatChatbotClientOptions.AppId"/> 参数。
/// </summary> /// </summary>
[Newtonsoft.Json.JsonProperty("appid")] [Newtonsoft.Json.JsonProperty("appid")]
[System.Text.Json.Serialization.JsonPropertyName("appid")] [System.Text.Json.Serialization.JsonPropertyName("appid")]

View File

@@ -3,7 +3,7 @@ namespace SKIT.FlurlHttpClient.Wechat.OpenAI.Models
/// <summary> /// <summary>
/// <para>表示 [POST] /kefustate/change/{TOKEN} 接口的响应。</para> /// <para>表示 [POST] /kefustate/change/{TOKEN} 接口的响应。</para>
/// </summary> /// </summary>
public class KefuStateChangeResponse : WechatOpenAIResponse public class KefuStateChangeResponse : WechatChatbotResponse
{ {
} }
} }

View File

@@ -3,10 +3,10 @@ namespace SKIT.FlurlHttpClient.Wechat.OpenAI.Models
/// <summary> /// <summary>
/// <para>表示 [POST] /kefustate/get/{TOKEN} 接口的请求。</para> /// <para>表示 [POST] /kefustate/get/{TOKEN} 接口的请求。</para>
/// </summary> /// </summary>
public class KefuStateGetRequest : WechatOpenAIRequest, WechatOpenAIRequest.Serialization.IEncryptedXmlable public class KefuStateGetRequest : WechatChatbotRequest, WechatChatbotRequest.Serialization.IEncryptedXmlable
{ {
/// <summary> /// <summary>
/// 获取或设置微信 AppId。如果不指定将使用构造 <see cref="WechatOpenAIClient"/> 时的 <see cref="WechatOpenAIClientOptions.AppId"/> 参数。 /// 获取或设置微信 AppId。如果不指定将使用构造 <see cref="WechatChatbotClient"/> 时的 <see cref="WechatChatbotClientOptions.AppId"/> 参数。
/// </summary> /// </summary>
[Newtonsoft.Json.JsonProperty("appid")] [Newtonsoft.Json.JsonProperty("appid")]
[System.Text.Json.Serialization.JsonPropertyName("appid")] [System.Text.Json.Serialization.JsonPropertyName("appid")]

View File

@@ -3,7 +3,7 @@ namespace SKIT.FlurlHttpClient.Wechat.OpenAI.Models
/// <summary> /// <summary>
/// <para>表示 [POST] /kefustate/get/{TOKEN} 接口的响应。</para> /// <para>表示 [POST] /kefustate/get/{TOKEN} 接口的响应。</para>
/// </summary> /// </summary>
public class KefuStateGetResponse : WechatOpenAIResponse public class KefuStateGetResponse : WechatChatbotResponse
{ {
/// <summary> /// <summary>
/// 获取或设置客服接入状态。 /// 获取或设置客服接入状态。

View File

@@ -3,10 +3,10 @@ namespace SKIT.FlurlHttpClient.Wechat.OpenAI.Models
/// <summary> /// <summary>
/// <para>表示 [POST] /sendmsg/{TOKEN} 接口的请求。</para> /// <para>表示 [POST] /sendmsg/{TOKEN} 接口的请求。</para>
/// </summary> /// </summary>
public class SendMessageRequest : WechatOpenAIRequest, WechatOpenAIRequest.Serialization.IEncryptedXmlable public class SendMessageRequest : WechatChatbotRequest, WechatChatbotRequest.Serialization.IEncryptedXmlable
{ {
/// <summary> /// <summary>
/// 获取或设置微信 AppId。如果不指定将使用构造 <see cref="WechatOpenAIClient"/> 时的 <see cref="WechatOpenAIClientOptions.AppId"/> 参数。 /// 获取或设置微信 AppId。如果不指定将使用构造 <see cref="WechatChatbotClient"/> 时的 <see cref="WechatChatbotClientOptions.AppId"/> 参数。
/// </summary> /// </summary>
[Newtonsoft.Json.JsonProperty("appid")] [Newtonsoft.Json.JsonProperty("appid")]
[System.Text.Json.Serialization.JsonPropertyName("appid")] [System.Text.Json.Serialization.JsonPropertyName("appid")]

View File

@@ -3,7 +3,7 @@
/// <summary> /// <summary>
/// <para>表示 [POST] /sendmsg/{TOKEN} 接口的响应。</para> /// <para>表示 [POST] /sendmsg/{TOKEN} 接口的响应。</para>
/// </summary> /// </summary>
public class SendMessageResponse : WechatOpenAIResponse public class SendMessageResponse : WechatChatbotResponse
{ {
} }
} }

View File

@@ -5,21 +5,21 @@ namespace SKIT.FlurlHttpClient.Wechat.OpenAI.Settings
public sealed class Credentials public sealed class Credentials
{ {
/// <summary> /// <summary>
/// 初始化客户端时 <see cref="WechatOpenAIClientOptions.AppId"/> 的副本。 /// 初始化客户端时 <see cref="WechatChatbotClientOptions.AppId"/> 的副本。
/// </summary> /// </summary>
public string AppId { get; } public string AppId { get; }
/// <summary> /// <summary>
/// 初始化客户端时 <see cref="WechatOpenAIClientOptions.Token"/> 的副本。 /// 初始化客户端时 <see cref="WechatChatbotClientOptions.Token"/> 的副本。
/// </summary> /// </summary>
public string Token { get; } public string Token { get; }
/// <summary> /// <summary>
/// 初始化客户端时 <see cref="WechatOpenAIClientOptions.EncodingAESKey"/> 的副本。 /// 初始化客户端时 <see cref="WechatChatbotClientOptions.EncodingAESKey"/> 的副本。
/// </summary> /// </summary>
public string EncodingAESKey { get; } public string EncodingAESKey { get; }
internal Credentials(WechatOpenAIClientOptions options) internal Credentials(WechatChatbotClientOptions options)
{ {
if (options is null) throw new ArgumentNullException(nameof(options)); if (options is null) throw new ArgumentNullException(nameof(options));

View File

@@ -9,7 +9,7 @@ namespace SKIT.FlurlHttpClient.Wechat.OpenAI
/// <summary> /// <summary>
/// 一个微信智能对话 API HTTP 客户端。 /// 一个微信智能对话 API HTTP 客户端。
/// </summary> /// </summary>
public class WechatOpenAIClient : CommonClientBase, ICommonClient public class WechatChatbotClient : CommonClientBase, ICommonClient
{ {
/// <summary> /// <summary>
/// 获取当前客户端使用的微信智能对话平台凭证。 /// 获取当前客户端使用的微信智能对话平台凭证。
@@ -17,10 +17,10 @@ namespace SKIT.FlurlHttpClient.Wechat.OpenAI
public Settings.Credentials Credentials { get; } public Settings.Credentials Credentials { get; }
/// <summary> /// <summary>
/// 用指定的配置项初始化 <see cref="WechatOpenAIClient"/> 类的新实例。 /// 用指定的配置项初始化 <see cref="WechatChatbotClient"/> 类的新实例。
/// </summary> /// </summary>
/// <param name="options">配置项。</param> /// <param name="options">配置项。</param>
public WechatOpenAIClient(WechatOpenAIClientOptions options) public WechatChatbotClient(WechatChatbotClientOptions options)
: this(options, null) : this(options, null)
{ {
} }
@@ -31,14 +31,14 @@ namespace SKIT.FlurlHttpClient.Wechat.OpenAI
/// <param name="options"></param> /// <param name="options"></param>
/// <param name="httpClient"></param> /// <param name="httpClient"></param>
/// <param name="disposeClient"></param> /// <param name="disposeClient"></param>
internal protected WechatOpenAIClient(WechatOpenAIClientOptions options, HttpClient? httpClient, bool disposeClient = true) internal protected WechatChatbotClient(WechatChatbotClientOptions options, HttpClient? httpClient, bool disposeClient = true)
: base(httpClient, disposeClient) : base(httpClient, disposeClient)
{ {
if (options is null) throw new ArgumentNullException(nameof(options)); if (options is null) throw new ArgumentNullException(nameof(options));
Credentials = new Settings.Credentials(options); Credentials = new Settings.Credentials(options);
FlurlClient.BaseUrl = options.Endpoint ?? WechatOpenAIEndpoints.DEFAULT; FlurlClient.BaseUrl = options.Endpoint ?? WechatChatbotEndpoints.DEFAULT;
FlurlClient.WithTimeout(options.Timeout <= 0 ? Timeout.InfiniteTimeSpan : TimeSpan.FromMilliseconds(options.Timeout)); FlurlClient.WithTimeout(options.Timeout <= 0 ? Timeout.InfiniteTimeSpan : TimeSpan.FromMilliseconds(options.Timeout));
} }
@@ -49,7 +49,7 @@ namespace SKIT.FlurlHttpClient.Wechat.OpenAI
/// <param name="httpMethod"></param> /// <param name="httpMethod"></param>
/// <param name="urlSegments"></param> /// <param name="urlSegments"></param>
/// <returns></returns> /// <returns></returns>
public IFlurlRequest CreateFlurlRequest(WechatOpenAIRequest request, HttpMethod httpMethod, params object[] urlSegments) public IFlurlRequest CreateFlurlRequest(WechatChatbotRequest request, HttpMethod httpMethod, params object[] urlSegments)
{ {
IFlurlRequest flurlRequest = base.CreateFlurlRequest(request, httpMethod, urlSegments); IFlurlRequest flurlRequest = base.CreateFlurlRequest(request, httpMethod, urlSegments);
@@ -65,7 +65,7 @@ namespace SKIT.FlurlHttpClient.Wechat.OpenAI
/// <param name="cancellationToken"></param> /// <param name="cancellationToken"></param>
/// <returns></returns> /// <returns></returns>
public async Task<T> SendFlurlRequestAsync<T>(IFlurlRequest flurlRequest, HttpContent? httpContent = null, CancellationToken cancellationToken = default) public async Task<T> SendFlurlRequestAsync<T>(IFlurlRequest flurlRequest, HttpContent? httpContent = null, CancellationToken cancellationToken = default)
where T : WechatOpenAIResponse, new() where T : WechatChatbotResponse, new()
{ {
if (flurlRequest is null) throw new ArgumentNullException(nameof(flurlRequest)); if (flurlRequest is null) throw new ArgumentNullException(nameof(flurlRequest));
@@ -82,11 +82,11 @@ namespace SKIT.FlurlHttpClient.Wechat.OpenAI
/// <param name="cancellationToken"></param> /// <param name="cancellationToken"></param>
/// <returns></returns> /// <returns></returns>
public async Task<T> SendFlurlRequestAsJsonAsync<T>(IFlurlRequest flurlRequest, object? data = null, CancellationToken cancellationToken = default) public async Task<T> SendFlurlRequestAsJsonAsync<T>(IFlurlRequest flurlRequest, object? data = null, CancellationToken cancellationToken = default)
where T : WechatOpenAIResponse, new() where T : WechatChatbotResponse, new()
{ {
if (flurlRequest is null) throw new ArgumentNullException(nameof(flurlRequest)); if (flurlRequest is null) throw new ArgumentNullException(nameof(flurlRequest));
if (data is WechatOpenAIRequest.Serialization.IEncryptedXmlable) if (data is WechatChatbotRequest.Serialization.IEncryptedXmlable)
{ {
string plainXml = Utilities.XmlHelper.ConvertFromJson(JsonSerializer.Serialize(data)); string plainXml = Utilities.XmlHelper.ConvertFromJson(JsonSerializer.Serialize(data));
string encryptedXml = Utilities.WxMsgCryptor.AESEncrypt(plainText: plainXml, encodingAESKey: Credentials.EncodingAESKey!, appId: Credentials.AppId!); string encryptedXml = Utilities.WxMsgCryptor.AESEncrypt(plainText: plainXml, encodingAESKey: Credentials.EncodingAESKey!, appId: Credentials.AppId!);

View File

@@ -5,39 +5,39 @@ using System.Net.Http;
namespace SKIT.FlurlHttpClient.Wechat.OpenAI namespace SKIT.FlurlHttpClient.Wechat.OpenAI
{ {
/// <summary> /// <summary>
/// 用于构造 <see cref="WechatOpenAIClient"/> 实例的构造器。 /// 用于构造 <see cref="WechatChatbotClient"/> 实例的构造器。
/// </summary> /// </summary>
public partial class WechatOpenAIClientBuilder : ICommonClientBuilder<WechatOpenAIClient> public partial class WechatChatbotClientBuilder : ICommonClientBuilder<WechatChatbotClient>
{ {
private readonly WechatOpenAIClientOptions _options; private readonly WechatChatbotClientOptions _options;
private readonly IList<Action<CommonClientSettings>> _configures; private readonly IList<Action<CommonClientSettings>> _configures;
private readonly IList<HttpInterceptor> _interceptors; private readonly IList<HttpInterceptor> _interceptors;
private HttpClient? _httpClient; private HttpClient? _httpClient;
private bool? _disposeClient; private bool? _disposeClient;
private WechatOpenAIClientBuilder(WechatOpenAIClientOptions options) private WechatChatbotClientBuilder(WechatChatbotClientOptions options)
{ {
_options = options; _options = options;
_configures = new List<Action<CommonClientSettings>>(); _configures = new List<Action<CommonClientSettings>>();
_interceptors = new List<HttpInterceptor>(); _interceptors = new List<HttpInterceptor>();
} }
ICommonClientBuilder<WechatOpenAIClient> ICommonClientBuilder<WechatOpenAIClient>.ConfigureSettings(Action<CommonClientSettings> configure) ICommonClientBuilder<WechatChatbotClient> ICommonClientBuilder<WechatChatbotClient>.ConfigureSettings(Action<CommonClientSettings> configure)
{ {
return ConfigureSettings(configure); return ConfigureSettings(configure);
} }
ICommonClientBuilder<WechatOpenAIClient> ICommonClientBuilder<WechatOpenAIClient>.UseInterceptor(HttpInterceptor interceptor) ICommonClientBuilder<WechatChatbotClient> ICommonClientBuilder<WechatChatbotClient>.UseInterceptor(HttpInterceptor interceptor)
{ {
return UseInterceptor(interceptor); return UseInterceptor(interceptor);
} }
ICommonClientBuilder<WechatOpenAIClient> ICommonClientBuilder<WechatOpenAIClient>.UseHttpClient(HttpClient httpClient, bool disposeClient) ICommonClientBuilder<WechatChatbotClient> ICommonClientBuilder<WechatChatbotClient>.UseHttpClient(HttpClient httpClient, bool disposeClient)
{ {
return UseHttpClient(httpClient, disposeClient); return UseHttpClient(httpClient, disposeClient);
} }
public WechatOpenAIClientBuilder ConfigureSettings(Action<CommonClientSettings> configure) public WechatChatbotClientBuilder ConfigureSettings(Action<CommonClientSettings> configure)
{ {
if (configure is null) throw new ArgumentNullException(nameof(configure)); if (configure is null) throw new ArgumentNullException(nameof(configure));
@@ -45,7 +45,7 @@ namespace SKIT.FlurlHttpClient.Wechat.OpenAI
return this; return this;
} }
public WechatOpenAIClientBuilder UseInterceptor(HttpInterceptor interceptor) public WechatChatbotClientBuilder UseInterceptor(HttpInterceptor interceptor)
{ {
if (interceptor is null) throw new ArgumentNullException(nameof(interceptor)); if (interceptor is null) throw new ArgumentNullException(nameof(interceptor));
@@ -53,7 +53,7 @@ namespace SKIT.FlurlHttpClient.Wechat.OpenAI
return this; return this;
} }
public WechatOpenAIClientBuilder UseHttpClient(HttpClient httpClient, bool disposeClient = true) public WechatChatbotClientBuilder UseHttpClient(HttpClient httpClient, bool disposeClient = true)
{ {
if (httpClient is null) throw new ArgumentNullException(nameof(httpClient)); if (httpClient is null) throw new ArgumentNullException(nameof(httpClient));
@@ -62,11 +62,11 @@ namespace SKIT.FlurlHttpClient.Wechat.OpenAI
return this; return this;
} }
public WechatOpenAIClient Build() public WechatChatbotClient Build()
{ {
WechatOpenAIClient client = _disposeClient.HasValue WechatChatbotClient client = _disposeClient.HasValue
? new WechatOpenAIClient(_options, _httpClient, _disposeClient.Value) ? new WechatChatbotClient(_options, _httpClient, _disposeClient.Value)
: new WechatOpenAIClient(_options, _httpClient); : new WechatChatbotClient(_options, _httpClient);
foreach (Action<CommonClientSettings> configure in _configures) foreach (Action<CommonClientSettings> configure in _configures)
{ {
@@ -82,13 +82,13 @@ namespace SKIT.FlurlHttpClient.Wechat.OpenAI
} }
} }
partial class WechatOpenAIClientBuilder partial class WechatChatbotClientBuilder
{ {
public static WechatOpenAIClientBuilder Create(WechatOpenAIClientOptions options) public static WechatChatbotClientBuilder Create(WechatChatbotClientOptions options)
{ {
if (options is null) throw new ArgumentNullException(nameof(options)); if (options is null) throw new ArgumentNullException(nameof(options));
return new WechatOpenAIClientBuilder(options); return new WechatChatbotClientBuilder(options);
} }
} }
} }

View File

@@ -1,9 +1,9 @@
namespace SKIT.FlurlHttpClient.Wechat.OpenAI namespace SKIT.FlurlHttpClient.Wechat.OpenAI
{ {
/// <summary> /// <summary>
/// 一个用于构造 <see cref="WechatOpenAIClient"/> 时使用的配置项。 /// 一个用于构造 <see cref="WechatChatbotClient"/> 时使用的配置项。
/// </summary> /// </summary>
public class WechatOpenAIClientOptions public class WechatChatbotClientOptions
{ {
/// <summary> /// <summary>
/// 获取或设置请求超时时间(单位:毫秒)。 /// 获取或设置请求超时时间(单位:毫秒)。
@@ -13,9 +13,9 @@ namespace SKIT.FlurlHttpClient.Wechat.OpenAI
/// <summary> /// <summary>
/// 获取或设置微信智能对话 API 入口点。 /// 获取或设置微信智能对话 API 入口点。
/// <para>默认值:<see cref="WechatOpenAIEndpoints.DEFAULT"/></para> /// <para>默认值:<see cref="WechatChatbotEndpoints.DEFAULT"/></para>
/// </summary> /// </summary>
public string Endpoint { get; set; } = WechatOpenAIEndpoints.DEFAULT; public string Endpoint { get; set; } = WechatChatbotEndpoints.DEFAULT;
/// <summary> /// <summary>
/// 获取或设置微信智能对话 AppId。 /// 获取或设置微信智能对话 AppId。

View File

@@ -3,7 +3,7 @@ namespace SKIT.FlurlHttpClient.Wechat.OpenAI
/// <summary> /// <summary>
/// <para>微信智能对话 API 接口域名。</para> /// <para>微信智能对话 API 接口域名。</para>
/// </summary> /// </summary>
public static class WechatOpenAIEndpoints public static class WechatChatbotEndpoints
{ {
/// <summary> /// <summary>
/// 主域名(默认)。 /// 主域名(默认)。

View File

@@ -4,7 +4,7 @@ namespace SKIT.FlurlHttpClient.Wechat.OpenAI
/// 表示微信智能对话 API 回调通知事件的基类。 /// 表示微信智能对话 API 回调通知事件的基类。
/// </summary> /// </summary>
[System.Xml.Serialization.XmlRoot("xml")] [System.Xml.Serialization.XmlRoot("xml")]
public class WechatOpenAIEvent : ICommonWebhookEvent public class WechatChatbotEvent : ICommonWebhookEvent
{ {
/// <summary> /// <summary>
/// 获取或设置 AppId。 /// 获取或设置 AppId。

View File

@@ -5,21 +5,21 @@ namespace SKIT.FlurlHttpClient.Wechat.OpenAI
/// <summary> /// <summary>
/// 当调用微信智能对话 API 出错时引发的异常。 /// 当调用微信智能对话 API 出错时引发的异常。
/// </summary> /// </summary>
public class WechatOpenAIException : CommonException public class WechatChatbotException : CommonException
{ {
/// <inheritdoc/> /// <inheritdoc/>
public WechatOpenAIException() public WechatChatbotException()
{ {
} }
/// <inheritdoc/> /// <inheritdoc/>
public WechatOpenAIException(string message) public WechatChatbotException(string message)
: base(message) : base(message)
{ {
} }
/// <inheritdoc/> /// <inheritdoc/>
public WechatOpenAIException(string message, Exception innerException) public WechatChatbotException(string message, Exception innerException)
: base(message, innerException) : base(message, innerException)
{ {
} }

View File

@@ -3,7 +3,7 @@ namespace SKIT.FlurlHttpClient.Wechat.OpenAI
/// <summary> /// <summary>
/// 表示微信智能对话 API 请求的基类。 /// 表示微信智能对话 API 请求的基类。
/// </summary> /// </summary>
public abstract class WechatOpenAIRequest : CommonRequestBase, ICommonRequest public abstract class WechatChatbotRequest : CommonRequestBase, ICommonRequest
{ {
public static class Serialization public static class Serialization
{ {

View File

@@ -3,7 +3,7 @@ namespace SKIT.FlurlHttpClient.Wechat.OpenAI
/// <summary> /// <summary>
/// 表示微信智能对话 API 响应的基类。 /// 表示微信智能对话 API 响应的基类。
/// </summary> /// </summary>
public abstract class WechatOpenAIResponse : CommonResponseBase, ICommonResponse public abstract class WechatChatbotResponse : CommonResponseBase, ICommonResponse
{ {
/// <summary> /// <summary>
/// 获取微信智能对话 API 返回的错误码。 /// 获取微信智能对话 API 返回的错误码。
@@ -49,7 +49,7 @@ namespace SKIT.FlurlHttpClient.Wechat.OpenAI
/// <summary> /// <summary>
/// 表示微信智能对话 API 响应的泛型基类。 /// 表示微信智能对话 API 响应的泛型基类。
/// </summary> /// </summary>
public abstract class WechatOpenAIResponse<TData> : WechatOpenAIResponse public abstract class WechatChatbotResponse<TData> : WechatChatbotResponse
where TData : class where TData : class
{ {
/// <summary> /// <summary>

View File

@@ -19,11 +19,15 @@ namespace SKIT.FlurlHttpClient.Wechat.OpenAI.UnitTests
{ {
var options = new TypeDeclarationAnalyzerOptions() var options = new TypeDeclarationAnalyzerOptions()
{ {
SdkAssembly = Assembly.GetAssembly(typeof(WechatOpenAIClient))!, SdkAssembly = Assembly.GetAssembly(typeof(WechatChatbotClient))!,
SdkRequestModelDeclarationNamespace = "SKIT.FlurlHttpClient.Wechat.OpenAI.Models", SdkRequestModelDeclarationNamespace = "SKIT.FlurlHttpClient.Wechat.OpenAI.Models",
SdkResponseModelDeclarationNamespace = "SKIT.FlurlHttpClient.Wechat.OpenAI.Models", SdkResponseModelDeclarationNamespace = "SKIT.FlurlHttpClient.Wechat.OpenAI.Models",
SdkExecutingExtensionDeclarationNamespace = "SKIT.FlurlHttpClient.Wechat.OpenAI", SdkExecutingExtensionDeclarationNamespace = "SKIT.FlurlHttpClient.Wechat.OpenAI",
SdkWebhookEventDeclarationNamespace = "SKIT.FlurlHttpClient.Wechat.OpenAI.Events", SdkWebhookEventDeclarationNamespace = "SKIT.FlurlHttpClient.Wechat.OpenAI.Events",
IgnoreRequestModelTypes = (type) => !typeof(WechatChatbotRequest).IsAssignableFrom(type),
IgnoreResponseModelTypes = (type) => !typeof(WechatChatbotResponse).IsAssignableFrom(type),
IgnoreExecutingExtensionTypes = (type) => !type.Name.StartsWith(nameof(WechatChatbotClient)),
IgnoreWebhookEventTypes = (type) => !typeof(WechatChatbotEvent).IsAssignableFrom(type),
ThrowOnNotFoundRequestModelTypes = true, ThrowOnNotFoundRequestModelTypes = true,
ThrowOnNotFoundResponseModelTypes = true, ThrowOnNotFoundResponseModelTypes = true,
ThrowOnNotFoundExecutingExtensionTypes = true, ThrowOnNotFoundExecutingExtensionTypes = true,
@@ -39,12 +43,18 @@ namespace SKIT.FlurlHttpClient.Wechat.OpenAI.UnitTests
var options = new SourceFileAnalyzerOptions() var options = new SourceFileAnalyzerOptions()
{ {
SdkAssembly = Assembly.GetAssembly(typeof(WechatOpenAIClient))!, SdkAssembly = Assembly.GetAssembly(typeof(WechatChatbotClient))!,
SdkRequestModelDeclarationNamespace = "SKIT.FlurlHttpClient.Wechat.OpenAI.Models", SdkRequestModelDeclarationNamespace = "SKIT.FlurlHttpClient.Wechat.OpenAI.Models",
SdkResponseModelDeclarationNamespace = "SKIT.FlurlHttpClient.Wechat.OpenAI.Models", SdkResponseModelDeclarationNamespace = "SKIT.FlurlHttpClient.Wechat.OpenAI.Models",
SdkWebhookEventDeclarationNamespace = "SKIT.FlurlHttpClient.Wechat.OpenAI.Events", SdkWebhookEventDeclarationNamespace = "SKIT.FlurlHttpClient.Wechat.OpenAI.Events",
ProjectSourceRootDirectory = Path.Combine(projdir, "./src/SKIT.FlurlHttpClient.Wechat.OpenAI/"), ProjectSourceRootDirectory = Path.Combine(projdir, "./src/SKIT.FlurlHttpClient.Wechat.OpenAI/"),
ProjectTestRootDirectory = Path.Combine(projdir, "./test/SKIT.FlurlHttpClient.Wechat.OpenAI.UnitTests/"), ProjectTestRootDirectory = Path.Combine(projdir, "./test/SKIT.FlurlHttpClient.Wechat.OpenAI.UnitTests/"),
ProjectSourceRequestModelClassCodeSubDirectory = "Models/Chatbot/",
ProjectSourceResponseModelClassCodeSubDirectory = "Models/Chatbot/",
ProjectSourceWebhookEventClassCodeSubDirectory = "Events/Chatbot/",
ProjectTestRequestModelSerializationSampleSubDirectory = "ModelSamples/Chatbot/",
ProjectTestResponseModelSerializationSampleSubDirectory = "ModelSamples/Chatbot/",
ProjectTestWebhookEventSerializationSampleSubDirectory = "EventSamples/Chatbot/",
ThrowOnNotFoundRequestModelClassCodeFiles = true, ThrowOnNotFoundRequestModelClassCodeFiles = true,
ThrowOnNotFoundResponseModelClassCodeFiles = true, ThrowOnNotFoundResponseModelClassCodeFiles = true,
ThrowOnNotFoundExecutingExtensionClassCodeFiles = true, ThrowOnNotFoundExecutingExtensionClassCodeFiles = true,

View File

@@ -1,17 +0,0 @@
using System.Threading.Tasks;
using Xunit;
namespace SKIT.FlurlHttpClient.Wechat.OpenAI.UnitTests
{
public class TestCase_ApiExecuteMpTests
{
[Fact(DisplayName = "测试用例:调用 API [POST] /getbindlink/{TOKEN}")]
public async Task TestExecuteSign()
{
var request = new Models.GetBindLinkRequest() { RedirectUrl = "https://example.com" };
var response = await TestClients.Instance.ExecuteGetBindLinkAsync(request);
Assert.NotNull(response.LinkUrl);
}
}
}

View File

@@ -1,5 +1,3 @@
using System;
using System.Text;
using Xunit; using Xunit;
namespace SKIT.FlurlHttpClient.Wechat.OpenAI.UnitTests namespace SKIT.FlurlHttpClient.Wechat.OpenAI.UnitTests

View File

@@ -4,7 +4,7 @@ namespace SKIT.FlurlHttpClient.Wechat.OpenAI.UnitTests
{ {
static TestClients() static TestClients()
{ {
Instance = new WechatOpenAIClient(new WechatOpenAIClientOptions() Instance = new WechatChatbotClient(new WechatChatbotClientOptions()
{ {
AppId = TestConfigs.WechatAppId, AppId = TestConfigs.WechatAppId,
Token = TestConfigs.WechatToken, Token = TestConfigs.WechatToken,
@@ -12,6 +12,6 @@ namespace SKIT.FlurlHttpClient.Wechat.OpenAI.UnitTests
}); });
} }
public static readonly WechatOpenAIClient Instance; public static readonly WechatChatbotClient Instance;
} }
} }