mirror of
https://gitee.com/fudiwei/DotNetCore.SKIT.FlurlHttpClient.Wechat.git
synced 2025-04-05 17:37:54 +08:00
feat(openai): 重命名 "WechatOpenAI" → "WechatChatbot"
This commit is contained in:
parent
7909b8615b
commit
ad9b5a1641
@ -35,13 +35,13 @@
|
||||
using SKIT.FlurlHttpClient.Wechat;
|
||||
using SKIT.FlurlHttpClient.Wechat.OpenAI;
|
||||
|
||||
var options = new WechatOpenAIClientOptions()
|
||||
var options = new WechatChatbotClientOptions()
|
||||
{
|
||||
AppId = "微信智能对话 AppId",
|
||||
Token = "微信智能对话 Token",
|
||||
EncodingAESKey = "微信智能对话 EncodingAESKey"
|
||||
};
|
||||
var client = WechatOpenAIClientBuilder.Create(options).Build();
|
||||
var client = WechatChatbotClientBuilder.Create(options).Build();
|
||||
```
|
||||
|
||||
### 请求 & 响应:
|
||||
@ -66,6 +66,7 @@ if (response.IsSuccessful())
|
||||
else
|
||||
{
|
||||
Console.WriteLine("错误代码:" + response.ErrorCode);
|
||||
Console.WriteLine("错误描述:" + response.ErrorMessage);
|
||||
Console.WriteLine("返回代码:" + response.ReturnCode);
|
||||
Console.WriteLine("返回错误:" + response.ReturnError);
|
||||
}
|
||||
|
@ -7,7 +7,7 @@ namespace SKIT.FlurlHttpClient.Wechat.OpenAI.Events
|
||||
/// <![CDATA[ https://developers.weixin.qq.com/doc/aispeech/confapi/thirdkefu/recivemsg.html ]]>
|
||||
/// </para>
|
||||
/// </summary>
|
||||
public class UserEnterEvent : WechatOpenAIEvent
|
||||
public class UserEnterEvent : WechatChatbotEvent
|
||||
{
|
||||
public static class Types
|
||||
{
|
@ -3,43 +3,43 @@ using System;
|
||||
namespace SKIT.FlurlHttpClient.Wechat.OpenAI
|
||||
{
|
||||
/// <summary>
|
||||
/// 为 <see cref="WechatOpenAIClient"/> 提供回调通知事件的扩展方法。
|
||||
/// 为 <see cref="WechatChatbotClient"/> 提供回调通知事件的扩展方法。
|
||||
/// </summary>
|
||||
public static partial class WechatOpenAIClientEventExtensions
|
||||
public static partial class WechatChatbotClientEventExtensions
|
||||
{
|
||||
/// <summary>
|
||||
/// <para>从 XML 反序列化得到 <see cref="WechatOpenAIEvent"/> 对象。</para>
|
||||
/// <para>从 XML 反序列化得到 <see cref="WechatChatbotEvent"/> 对象。</para>
|
||||
/// </summary>
|
||||
/// <typeparam name="TEvent"></typeparam>
|
||||
/// <param name="client"></param>
|
||||
/// <param name="webhookXml"></param>
|
||||
/// <returns></returns>
|
||||
public static TEvent DeserializeEventFromXml<TEvent>(this WechatOpenAIClient client, string webhookXml)
|
||||
where TEvent : WechatOpenAIEvent, new()
|
||||
public static TEvent DeserializeEventFromXml<TEvent>(this WechatChatbotClient client, string webhookXml)
|
||||
where TEvent : WechatChatbotEvent, new()
|
||||
{
|
||||
return InnerDeserializeEventFromXml<TEvent>(client, webhookXml);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// <para>从 XML 反序列化得到 <see cref="WechatOpenAIEvent"/> 对象。</para>
|
||||
/// <para>从 XML 反序列化得到 <see cref="WechatChatbotEvent"/> 对象。</para>
|
||||
/// </summary>
|
||||
/// <param name="client"></param>
|
||||
/// <param name="webhookXml"></param>
|
||||
/// <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>
|
||||
/// 将 <see cref="WechatOpenAIEvent"/> 对象序列化成 XML。
|
||||
/// 将 <see cref="WechatChatbotEvent"/> 对象序列化成 XML。
|
||||
/// </summary>
|
||||
/// <typeparam name="TEvent"></typeparam>
|
||||
/// <param name="client"></param>
|
||||
/// <param name="webhookEvent"></param>
|
||||
/// <returns></returns>
|
||||
public static string SerializeEventToXml<TEvent>(this WechatOpenAIClient client, TEvent webhookEvent)
|
||||
where TEvent : WechatOpenAIEvent, new()
|
||||
public static string SerializeEventToXml<TEvent>(this WechatChatbotClient client, TEvent webhookEvent)
|
||||
where TEvent : WechatChatbotEvent, new()
|
||||
{
|
||||
string xml;
|
||||
|
||||
@ -49,13 +49,13 @@ namespace SKIT.FlurlHttpClient.Wechat.OpenAI
|
||||
}
|
||||
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))
|
||||
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))
|
||||
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
|
||||
{
|
||||
@ -69,17 +69,17 @@ namespace SKIT.FlurlHttpClient.Wechat.OpenAI
|
||||
}
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
partial class WechatOpenAIClientEventExtensions
|
||||
partial class WechatChatbotClientEventExtensions
|
||||
{
|
||||
private static TEvent InnerDeserializeEventFromXml<TEvent>(this WechatOpenAIClient client, string webhookXml)
|
||||
where TEvent : WechatOpenAIEvent
|
||||
private static TEvent InnerDeserializeEventFromXml<TEvent>(this WechatChatbotClient client, string webhookXml)
|
||||
where TEvent : WechatChatbotEvent
|
||||
{
|
||||
if (client is null) throw new ArgumentNullException(nameof(client));
|
||||
if (webhookXml is null) throw new ArgumentNullException(webhookXml);
|
||||
@ -87,18 +87,18 @@ namespace SKIT.FlurlHttpClient.Wechat.OpenAI
|
||||
try
|
||||
{
|
||||
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 _);
|
||||
return Utilities.XmlHelper.Deserialize<TEvent>(webhookXml);
|
||||
}
|
||||
catch (WechatOpenAIException)
|
||||
catch (WechatChatbotException)
|
||||
{
|
||||
throw;
|
||||
}
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
@ -6,7 +6,7 @@ using Flurl.Http;
|
||||
|
||||
namespace SKIT.FlurlHttpClient.Wechat.OpenAI
|
||||
{
|
||||
public static class WechatOpenAIClientExecuteBotExtensions
|
||||
public static class WechatChatbotClientExecuteBotExtensions
|
||||
{
|
||||
/// <summary>
|
||||
/// <para>异步调用 [POST] /batchimportskill/{TOKEN} 接口。</para>
|
||||
@ -19,8 +19,7 @@ namespace SKIT.FlurlHttpClient.Wechat.OpenAI
|
||||
/// <param name="request"></param>
|
||||
/// <param name="cancellationToken"></param>
|
||||
/// <returns></returns>
|
||||
[Obsolete("相关接口或字段于 2023-04-10 下线。")]
|
||||
public static async Task<Models.BatchImportSkillResponse> ExecuteBatchImportSkillAsync(this WechatOpenAIClient client, Models.BatchImportSkillRequest request, CancellationToken cancellationToken = default)
|
||||
public static async Task<Models.BatchImportSkillResponse> ExecuteBatchImportSkillAsync(this WechatChatbotClient client, Models.BatchImportSkillRequest request, CancellationToken cancellationToken = default)
|
||||
{
|
||||
if (client is null) throw new ArgumentNullException(nameof(client));
|
||||
if (request is null) throw new ArgumentNullException(nameof(request));
|
||||
@ -42,8 +41,7 @@ namespace SKIT.FlurlHttpClient.Wechat.OpenAI
|
||||
/// <param name="request"></param>
|
||||
/// <param name="cancellationToken"></param>
|
||||
/// <returns></returns>
|
||||
[Obsolete("相关接口或字段于 2023-04-10 下线。")]
|
||||
public static async Task<Models.PublishResponse> ExecutePublishAsync(this WechatOpenAIClient client, Models.PublishRequest request, CancellationToken cancellationToken = default)
|
||||
public static async Task<Models.PublishResponse> ExecutePublishAsync(this WechatChatbotClient client, Models.PublishRequest request, CancellationToken cancellationToken = default)
|
||||
{
|
||||
if (client is null) throw new ArgumentNullException(nameof(client));
|
||||
if (request is null) throw new ArgumentNullException(nameof(request));
|
||||
@ -65,8 +63,7 @@ namespace SKIT.FlurlHttpClient.Wechat.OpenAI
|
||||
/// <param name="request"></param>
|
||||
/// <param name="cancellationToken"></param>
|
||||
/// <returns></returns>
|
||||
[Obsolete("相关接口或字段于 2023-04-10 下线。")]
|
||||
public static async Task<Models.PublishProgressResponse> ExecutePublishProgressAsync(this WechatOpenAIClient client, Models.PublishProgressRequest request, CancellationToken cancellationToken = default)
|
||||
public static async Task<Models.PublishProgressResponse> ExecutePublishProgressAsync(this WechatChatbotClient client, Models.PublishProgressRequest request, CancellationToken cancellationToken = default)
|
||||
{
|
||||
if (client is null) throw new ArgumentNullException(nameof(client));
|
||||
if (request is null) throw new ArgumentNullException(nameof(request));
|
||||
@ -88,8 +85,7 @@ namespace SKIT.FlurlHttpClient.Wechat.OpenAI
|
||||
/// <param name="request"></param>
|
||||
/// <param name="cancellationToken"></param>
|
||||
/// <returns></returns>
|
||||
[Obsolete("相关接口或字段于 2023-04-10 下线。")]
|
||||
public static async Task<Models.SetAutoReplyResponse> ExecuteSetAutoReplyAsync(this WechatOpenAIClient client, Models.SetAutoReplyRequest request, CancellationToken cancellationToken = default)
|
||||
public static async Task<Models.SetAutoReplyResponse> ExecuteSetAutoReplyAsync(this WechatChatbotClient client, Models.SetAutoReplyRequest request, CancellationToken cancellationToken = default)
|
||||
{
|
||||
if (client is null) throw new ArgumentNullException(nameof(client));
|
||||
if (request is null) throw new ArgumentNullException(nameof(request));
|
||||
@ -111,8 +107,7 @@ namespace SKIT.FlurlHttpClient.Wechat.OpenAI
|
||||
/// <param name="request"></param>
|
||||
/// <param name="cancellationToken"></param>
|
||||
/// <returns></returns>
|
||||
[Obsolete("相关接口或字段于 2023-04-10 下线。")]
|
||||
public static async Task<Models.LabelBatchSetResponse> ExecuteLabelBatchSetAsync(this WechatOpenAIClient client, Models.LabelBatchSetRequest request, CancellationToken cancellationToken = default)
|
||||
public static async Task<Models.LabelBatchSetResponse> ExecuteLabelBatchSetAsync(this WechatChatbotClient client, Models.LabelBatchSetRequest request, CancellationToken cancellationToken = default)
|
||||
{
|
||||
if (client is null) throw new ArgumentNullException(nameof(client));
|
||||
if (request is null) throw new ArgumentNullException(nameof(request));
|
@ -6,7 +6,7 @@ using Flurl.Http;
|
||||
|
||||
namespace SKIT.FlurlHttpClient.Wechat.OpenAI
|
||||
{
|
||||
public static class WechatOpenAIClientExecuteDialogExtensions
|
||||
public static class WechatChatbotClientExecuteDialogExtensions
|
||||
{
|
||||
/// <summary>
|
||||
/// <para>异步调用 [POST] /sign/{TOKEN} 接口。</para>
|
||||
@ -19,8 +19,7 @@ namespace SKIT.FlurlHttpClient.Wechat.OpenAI
|
||||
/// <param name="request"></param>
|
||||
/// <param name="cancellationToken"></param>
|
||||
/// <returns></returns>
|
||||
[Obsolete("相关接口或字段于 2023-04-10 下线。")]
|
||||
public static async Task<Models.SignResponse> ExecuteSignAsync(this WechatOpenAIClient client, Models.SignRequest request, CancellationToken cancellationToken = default)
|
||||
public static async Task<Models.SignResponse> ExecuteSignAsync(this WechatChatbotClient client, Models.SignRequest request, CancellationToken cancellationToken = default)
|
||||
{
|
||||
if (client is null) throw new ArgumentNullException(nameof(client));
|
||||
if (request is null) throw new ArgumentNullException(nameof(request));
|
||||
@ -42,8 +41,7 @@ namespace SKIT.FlurlHttpClient.Wechat.OpenAI
|
||||
/// <param name="request"></param>
|
||||
/// <param name="cancellationToken"></param>
|
||||
/// <returns></returns>
|
||||
[Obsolete("相关接口或字段于 2023-04-10 下线。")]
|
||||
public static async Task<Models.AIBotResponse> ExecuteAIBotAsync(this WechatOpenAIClient client, Models.AIBotRequest request, CancellationToken cancellationToken = default)
|
||||
public static async Task<Models.AIBotResponse> ExecuteAIBotAsync(this WechatChatbotClient client, Models.AIBotRequest request, CancellationToken cancellationToken = default)
|
||||
{
|
||||
if (client is null) throw new ArgumentNullException(nameof(client));
|
||||
if (request is null) throw new ArgumentNullException(nameof(request));
|
||||
@ -66,7 +64,7 @@ namespace SKIT.FlurlHttpClient.Wechat.OpenAI
|
||||
/// <param name="cancellationToken"></param>
|
||||
/// <returns></returns>
|
||||
[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 (request is null) throw new ArgumentNullException(nameof(request));
|
||||
@ -89,7 +87,7 @@ namespace SKIT.FlurlHttpClient.Wechat.OpenAI
|
||||
/// <param name="cancellationToken"></param>
|
||||
/// <returns></returns>
|
||||
[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 (request is null) throw new ArgumentNullException(nameof(request));
|
||||
@ -112,7 +110,7 @@ namespace SKIT.FlurlHttpClient.Wechat.OpenAI
|
||||
/// <param name="cancellationToken"></param>
|
||||
/// <returns></returns>
|
||||
[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 (request is null) throw new ArgumentNullException(nameof(request));
|
@ -9,7 +9,7 @@ using Flurl.Http;
|
||||
|
||||
namespace SKIT.FlurlHttpClient.Wechat.OpenAI
|
||||
{
|
||||
public static class WechatOpenAIClientExecuteMpExtensions
|
||||
public static class WechatChatbotClientExecuteMpExtensions
|
||||
{
|
||||
/// <summary>
|
||||
/// <para>异步调用 [POST] /getbindlink/{TOKEN} 接口。</para>
|
||||
@ -23,7 +23,7 @@ namespace SKIT.FlurlHttpClient.Wechat.OpenAI
|
||||
/// <param name="cancellationToken"></param>
|
||||
/// <returns></returns>
|
||||
[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 (request is null) throw new ArgumentNullException(nameof(request));
|
||||
@ -46,7 +46,7 @@ namespace SKIT.FlurlHttpClient.Wechat.OpenAI
|
||||
/// <param name="cancellationToken"></param>
|
||||
/// <returns></returns>
|
||||
[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 (request is null) throw new ArgumentNullException(nameof(request));
|
||||
@ -69,7 +69,7 @@ namespace SKIT.FlurlHttpClient.Wechat.OpenAI
|
||||
/// <param name="cancellationToken"></param>
|
||||
/// <returns></returns>
|
||||
[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 (request is null) throw new ArgumentNullException(nameof(request));
|
||||
@ -92,7 +92,7 @@ namespace SKIT.FlurlHttpClient.Wechat.OpenAI
|
||||
/// <param name="cancellationToken"></param>
|
||||
/// <returns></returns>
|
||||
[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 (request is null) throw new ArgumentNullException(nameof(request));
|
||||
@ -115,7 +115,7 @@ namespace SKIT.FlurlHttpClient.Wechat.OpenAI
|
||||
/// <param name="cancellationToken"></param>
|
||||
/// <returns></returns>
|
||||
[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 (request is null) throw new ArgumentNullException(nameof(request));
|
@ -6,7 +6,7 @@ using Flurl.Http;
|
||||
|
||||
namespace SKIT.FlurlHttpClient.Wechat.OpenAI
|
||||
{
|
||||
public static class WechatOpenAIClientExecuteThirdKefuExtensions
|
||||
public static class WechatChatbotClientExecuteThirdKefuExtensions
|
||||
{
|
||||
/// <summary>
|
||||
/// <para>异步调用 [POST] /sendmsg/{TOKEN} 接口。</para>
|
||||
@ -19,7 +19,7 @@ namespace SKIT.FlurlHttpClient.Wechat.OpenAI
|
||||
/// <param name="request"></param>
|
||||
/// <param name="cancellationToken"></param>
|
||||
/// <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 (request is null) throw new ArgumentNullException(nameof(request));
|
||||
@ -44,7 +44,7 @@ namespace SKIT.FlurlHttpClient.Wechat.OpenAI
|
||||
/// <param name="request"></param>
|
||||
/// <param name="cancellationToken"></param>
|
||||
/// <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 (request is null) throw new ArgumentNullException(nameof(request));
|
||||
@ -69,7 +69,7 @@ namespace SKIT.FlurlHttpClient.Wechat.OpenAI
|
||||
/// <param name="request"></param>
|
||||
/// <param name="cancellationToken"></param>
|
||||
/// <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 (request is null) throw new ArgumentNullException(nameof(request));
|
@ -1,4 +1,3 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace SKIT.FlurlHttpClient.Wechat.OpenAI.Models
|
||||
@ -6,8 +5,7 @@ namespace SKIT.FlurlHttpClient.Wechat.OpenAI.Models
|
||||
/// <summary>
|
||||
/// <para>表示 [POST] /batchimportskill/{TOKEN} 接口的请求。</para>
|
||||
/// </summary>
|
||||
[Obsolete("相关接口或字段于 2023-04-10 下线。")]
|
||||
public class BatchImportSkillRequest : WechatOpenAIRequest, WechatOpenAIRequest.Serialization.IEncryptedXmlable
|
||||
public class BatchImportSkillRequest : WechatChatbotRequest, WechatChatbotRequest.Serialization.IEncryptedXmlable
|
||||
{
|
||||
public static class Types
|
||||
{
|
@ -1,12 +1,9 @@
|
||||
using System;
|
||||
|
||||
namespace SKIT.FlurlHttpClient.Wechat.OpenAI.Models
|
||||
{
|
||||
/// <summary>
|
||||
/// <para>表示 [POST] /batchimportskill/{TOKEN} 接口的响应。</para>
|
||||
/// </summary>
|
||||
[Obsolete("相关接口或字段于 2023-04-10 下线。")]
|
||||
public class BatchImportSkillResponse : WechatOpenAIResponse
|
||||
public class BatchImportSkillResponse : WechatChatbotResponse
|
||||
{
|
||||
/// <summary>
|
||||
/// <inheritdoc/>
|
@ -1,4 +1,3 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace SKIT.FlurlHttpClient.Wechat.OpenAI.Models
|
||||
@ -6,8 +5,7 @@ namespace SKIT.FlurlHttpClient.Wechat.OpenAI.Models
|
||||
/// <summary>
|
||||
/// <para>表示 [POST] /label/batchset/{TOKEN} 接口的请求。</para>
|
||||
/// </summary>
|
||||
[Obsolete("相关接口或字段于 2023-04-10 下线。")]
|
||||
public class LabelBatchSetRequest : WechatOpenAIRequest, WechatOpenAIRequest.Serialization.IEncryptedXmlable
|
||||
public class LabelBatchSetRequest : WechatChatbotRequest, WechatChatbotRequest.Serialization.IEncryptedXmlable
|
||||
{
|
||||
public static class Types
|
||||
{
|
@ -1,12 +1,9 @@
|
||||
using System;
|
||||
|
||||
namespace SKIT.FlurlHttpClient.Wechat.OpenAI.Models
|
||||
{
|
||||
/// <summary>
|
||||
/// <para>表示 [POST] /label/batchset/{TOKEN} 接口的响应。</para>
|
||||
/// </summary>
|
||||
[Obsolete("相关接口或字段于 2023-04-10 下线。")]
|
||||
public class LabelBatchSetResponse : WechatOpenAIResponse
|
||||
public class LabelBatchSetResponse : WechatChatbotResponse
|
||||
{
|
||||
/// <summary>
|
||||
/// <inheritdoc/>
|
@ -1,12 +1,9 @@
|
||||
using System;
|
||||
|
||||
namespace SKIT.FlurlHttpClient.Wechat.OpenAI.Models
|
||||
{
|
||||
/// <summary>
|
||||
/// <para>表示 [POST] /publish_progress/{TOKEN} 接口的请求。</para>
|
||||
/// </summary>
|
||||
[Obsolete("相关接口或字段于 2023-04-10 下线。")]
|
||||
public class PublishProgressRequest : WechatOpenAIRequest, WechatOpenAIRequest.Serialization.IEncryptedXmlable
|
||||
public class PublishProgressRequest : WechatChatbotRequest, WechatChatbotRequest.Serialization.IEncryptedXmlable
|
||||
{
|
||||
/// <summary>
|
||||
/// 获取或设置管理员 ID。
|
@ -1,12 +1,9 @@
|
||||
using System;
|
||||
|
||||
namespace SKIT.FlurlHttpClient.Wechat.OpenAI.Models
|
||||
{
|
||||
/// <summary>
|
||||
/// <para>表示 [POST] /publish_progress/{TOKEN} 接口的响应。</para>
|
||||
/// </summary>
|
||||
[Obsolete("相关接口或字段于 2023-04-10 下线。")]
|
||||
public class PublishProgressResponse : WechatOpenAIResponse<PublishProgressResponse.Types.Data>
|
||||
public class PublishProgressResponse : WechatChatbotResponse<PublishProgressResponse.Types.Data>
|
||||
{
|
||||
public static class Types
|
||||
{
|
@ -1,12 +1,9 @@
|
||||
using System;
|
||||
|
||||
namespace SKIT.FlurlHttpClient.Wechat.OpenAI.Models
|
||||
{
|
||||
/// <summary>
|
||||
/// <para>表示 [POST] /publish/{TOKEN} 接口的请求。</para>
|
||||
/// </summary>
|
||||
[Obsolete("相关接口或字段于 2023-04-10 下线。")]
|
||||
public class PublishRequest : WechatOpenAIRequest, WechatOpenAIRequest.Serialization.IEncryptedXmlable
|
||||
public class PublishRequest : WechatChatbotRequest, WechatChatbotRequest.Serialization.IEncryptedXmlable
|
||||
{
|
||||
/// <summary>
|
||||
/// 获取或设置管理员 ID。
|
@ -1,12 +1,9 @@
|
||||
using System;
|
||||
|
||||
namespace SKIT.FlurlHttpClient.Wechat.OpenAI.Models
|
||||
{
|
||||
/// <summary>
|
||||
/// <para>表示 [POST] /publish/{TOKEN} 接口的响应。</para>
|
||||
/// </summary>
|
||||
[Obsolete("相关接口或字段于 2023-04-10 下线。")]
|
||||
public class PublishResponse : WechatOpenAIResponse
|
||||
public class PublishResponse : WechatChatbotResponse
|
||||
{
|
||||
/// <summary>
|
||||
/// <inheritdoc/>
|
@ -1,4 +1,3 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace SKIT.FlurlHttpClient.Wechat.OpenAI.Models
|
||||
@ -6,8 +5,7 @@ namespace SKIT.FlurlHttpClient.Wechat.OpenAI.Models
|
||||
/// <summary>
|
||||
/// <para>表示 [POST] /setautoreply/{TOKEN} 接口的请求。</para>
|
||||
/// </summary>
|
||||
[Obsolete("相关接口或字段于 2023-04-10 下线。")]
|
||||
public class SetAutoReplyRequest : WechatOpenAIRequest, WechatOpenAIRequest.Serialization.IEncryptedXmlable
|
||||
public class SetAutoReplyRequest : WechatChatbotRequest, WechatChatbotRequest.Serialization.IEncryptedXmlable
|
||||
{
|
||||
public static class Types
|
||||
{
|
@ -1,12 +1,9 @@
|
||||
using System;
|
||||
|
||||
namespace SKIT.FlurlHttpClient.Wechat.OpenAI.Models
|
||||
{
|
||||
/// <summary>
|
||||
/// <para>表示 [POST] /setautoreply/{TOKEN} 接口的响应。</para>
|
||||
/// </summary>
|
||||
[Obsolete("相关接口或字段于 2023-04-10 下线。")]
|
||||
public class SetAutoReplyResponse : WechatOpenAIResponse
|
||||
public class SetAutoReplyResponse : WechatChatbotResponse
|
||||
{
|
||||
/// <summary>
|
||||
/// <inheritdoc/>
|
@ -1,4 +1,3 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace SKIT.FlurlHttpClient.Wechat.OpenAI.Models
|
||||
@ -6,8 +5,7 @@ namespace SKIT.FlurlHttpClient.Wechat.OpenAI.Models
|
||||
/// <summary>
|
||||
/// <para>表示 [POST] /aibot/{TOKEN} 接口的请求。</para>
|
||||
/// </summary>
|
||||
[Obsolete("相关接口或字段于 2023-04-10 下线。")]
|
||||
public class AIBotRequest : WechatOpenAIRequest
|
||||
public class AIBotRequest : WechatChatbotRequest
|
||||
{
|
||||
/// <summary>
|
||||
/// 获取或设置请求签名。
|
@ -5,8 +5,7 @@ namespace SKIT.FlurlHttpClient.Wechat.OpenAI.Models
|
||||
/// <summary>
|
||||
/// <para>表示 [POST] /aibot/{TOKEN} 接口的响应。</para>
|
||||
/// </summary>
|
||||
[Obsolete("相关接口或字段于 2023-04-10 下线。")]
|
||||
public class AIBotResponse : WechatOpenAIResponse
|
||||
public class AIBotResponse : WechatChatbotResponse
|
||||
{
|
||||
public static class Types
|
||||
{
|
@ -6,7 +6,7 @@ namespace SKIT.FlurlHttpClient.Wechat.OpenAI.Models
|
||||
/// <para>表示 [POST] /feedback/{TOKEN} 接口的请求。</para>
|
||||
/// </summary>
|
||||
[Obsolete("相关接口或字段于 2023-04-07 下线。")]
|
||||
public class FeedbackRequest : WechatOpenAIRequest, WechatOpenAIRequest.Serialization.IEncryptedXmlable
|
||||
public class FeedbackRequest : WechatChatbotRequest, WechatChatbotRequest.Serialization.IEncryptedXmlable
|
||||
{
|
||||
/// <summary>
|
||||
/// 获取或设置消息 ID。
|
@ -6,7 +6,7 @@ namespace SKIT.FlurlHttpClient.Wechat.OpenAI.Models
|
||||
/// <para>表示 [POST] /feedback/{TOKEN} 接口的响应。</para>
|
||||
/// </summary>
|
||||
[Obsolete("相关接口或字段于 2023-04-07 下线。")]
|
||||
public class FeedbackResponse : WechatOpenAIResponse
|
||||
public class FeedbackResponse : WechatChatbotResponse
|
||||
{
|
||||
/// <summary>
|
||||
/// <inheritdoc/>
|
@ -6,7 +6,7 @@ namespace SKIT.FlurlHttpClient.Wechat.OpenAI.Models
|
||||
/// <para>表示 [POST] /gethotquerydetail/{TOKEN} 接口的请求。</para>
|
||||
/// </summary>
|
||||
[Obsolete("相关接口或字段于 2023-04-07 下线。")]
|
||||
public class GetHotQueryDetailRequest : WechatOpenAIRequest, WechatOpenAIRequest.Serialization.IEncryptedXmlable
|
||||
public class GetHotQueryDetailRequest : WechatChatbotRequest, WechatChatbotRequest.Serialization.IEncryptedXmlable
|
||||
{
|
||||
/// <summary>
|
||||
/// 获取或设置分页页数。
|
@ -6,7 +6,7 @@ namespace SKIT.FlurlHttpClient.Wechat.OpenAI.Models
|
||||
/// <para>表示 [POST] /gethotquerydetail/{TOKEN} 接口的响应。</para>
|
||||
/// </summary>
|
||||
[Obsolete("相关接口或字段于 2023-04-07 下线。")]
|
||||
public class GetHotQueryDetailResponse : WechatOpenAIResponse<GetHotQueryDetailResponse.Types.Data>
|
||||
public class GetHotQueryDetailResponse : WechatChatbotResponse<GetHotQueryDetailResponse.Types.Data>
|
||||
{
|
||||
public static class Types
|
||||
{
|
@ -6,7 +6,7 @@ namespace SKIT.FlurlHttpClient.Wechat.OpenAI.Models
|
||||
/// <para>表示 [POST] /gethotquerylist/{TOKEN} 接口的请求。</para>
|
||||
/// </summary>
|
||||
[Obsolete("相关接口或字段于 2023-04-07 下线。")]
|
||||
public class GetHotQueryListRequest : WechatOpenAIRequest, WechatOpenAIRequest.Serialization.IEncryptedXmlable
|
||||
public class GetHotQueryListRequest : WechatChatbotRequest, WechatChatbotRequest.Serialization.IEncryptedXmlable
|
||||
{
|
||||
/// <summary>
|
||||
/// 获取或设置分页页数。
|
@ -6,7 +6,7 @@ namespace SKIT.FlurlHttpClient.Wechat.OpenAI.Models
|
||||
/// <para>表示 [POST] /gethotquerylist/{TOKEN} 接口的响应。</para>
|
||||
/// </summary>
|
||||
[Obsolete("相关接口或字段于 2023-04-07 下线。")]
|
||||
public class GetHotQueryListResponse : WechatOpenAIResponse<GetHotQueryListResponse.Types.Data>
|
||||
public class GetHotQueryListResponse : WechatChatbotResponse<GetHotQueryListResponse.Types.Data>
|
||||
{
|
||||
public static class Types
|
||||
{
|
@ -1,12 +1,9 @@
|
||||
using System;
|
||||
|
||||
namespace SKIT.FlurlHttpClient.Wechat.OpenAI.Models
|
||||
{
|
||||
/// <summary>
|
||||
/// <para>表示 [POST] /sign/{TOKEN} 接口的请求。</para>
|
||||
/// </summary>
|
||||
[Obsolete("相关接口或字段于 2023-04-10 下线。")]
|
||||
public class SignRequest : WechatOpenAIRequest
|
||||
public class SignRequest : WechatChatbotRequest
|
||||
{
|
||||
/// <summary>
|
||||
/// 获取或设置用户 ID。
|
@ -1,12 +1,9 @@
|
||||
using System;
|
||||
|
||||
namespace SKIT.FlurlHttpClient.Wechat.OpenAI.Models
|
||||
{
|
||||
/// <summary>
|
||||
/// <para>表示 [POST] /sign/{TOKEN} 接口的响应。</para>
|
||||
/// </summary>
|
||||
[Obsolete("相关接口或字段于 2023-04-10 下线。")]
|
||||
public class SignResponse : WechatOpenAIResponse
|
||||
public class SignResponse : WechatChatbotResponse
|
||||
{
|
||||
/// <summary>
|
||||
/// 获取或设置请求签名。
|
@ -6,7 +6,7 @@ namespace SKIT.FlurlHttpClient.Wechat.OpenAI.Models
|
||||
/// <para>表示 [POST] /assetsupload/{TOKEN} 接口的请求。</para>
|
||||
/// </summary>
|
||||
[Obsolete("相关接口或字段于 2023-04-07 下线。")]
|
||||
public class AssetsUploadRequest : WechatOpenAIRequest, WechatOpenAIRequest.Serialization.IEncryptedXmlable
|
||||
public class AssetsUploadRequest : WechatChatbotRequest, WechatChatbotRequest.Serialization.IEncryptedXmlable
|
||||
{
|
||||
/// <summary>
|
||||
/// 获取或设置用户 ID。
|
@ -6,7 +6,7 @@ namespace SKIT.FlurlHttpClient.Wechat.OpenAI.Models
|
||||
/// <para>表示 [POST] /assetsupload/{TOKEN} 接口的响应。</para>
|
||||
/// </summary>
|
||||
[Obsolete("相关接口或字段于 2023-04-07 下线。")]
|
||||
public class AssetsUploadResponse : WechatOpenAIResponse
|
||||
public class AssetsUploadResponse : WechatChatbotResponse
|
||||
{
|
||||
/// <summary>
|
||||
/// <inheritdoc/>
|
@ -6,7 +6,7 @@ namespace SKIT.FlurlHttpClient.Wechat.OpenAI.Models
|
||||
/// <para>表示 [POST] /getbindlink/{TOKEN} 接口的请求。</para>
|
||||
/// </summary>
|
||||
[Obsolete("相关接口或字段于 2023-04-07 下线。")]
|
||||
public class GetBindLinkRequest : WechatOpenAIRequest, WechatOpenAIRequest.Serialization.IEncryptedXmlable
|
||||
public class GetBindLinkRequest : WechatChatbotRequest, WechatChatbotRequest.Serialization.IEncryptedXmlable
|
||||
{
|
||||
/// <summary>
|
||||
/// 获取或设置直播 ID。
|
@ -6,7 +6,7 @@ namespace SKIT.FlurlHttpClient.Wechat.OpenAI.Models
|
||||
/// <para>表示 [POST] /getbindlink/{TOKEN} 接口的响应。</para>
|
||||
/// </summary>
|
||||
[Obsolete("相关接口或字段于 2023-04-07 下线。")]
|
||||
public class GetBindLinkResponse : WechatOpenAIResponse
|
||||
public class GetBindLinkResponse : WechatChatbotResponse
|
||||
{
|
||||
/// <summary>
|
||||
/// <inheritdoc/>
|
@ -6,7 +6,7 @@ namespace SKIT.FlurlHttpClient.Wechat.OpenAI.Models
|
||||
/// <para>表示 [POST] /getbindlist/{TOKEN} 接口的请求。</para>
|
||||
/// </summary>
|
||||
[Obsolete("相关接口或字段于 2023-04-07 下线。")]
|
||||
public class GetBindListRequest : WechatOpenAIRequest
|
||||
public class GetBindListRequest : WechatChatbotRequest
|
||||
{
|
||||
}
|
||||
}
|
@ -6,7 +6,7 @@ namespace SKIT.FlurlHttpClient.Wechat.OpenAI.Models
|
||||
/// <para>表示 [POST] /getbindlist/{TOKEN} 接口的响应。</para>
|
||||
/// </summary>
|
||||
[Obsolete("相关接口或字段于 2023-04-07 下线。")]
|
||||
public class GetBindListResponse : WechatOpenAIResponse
|
||||
public class GetBindListResponse : WechatChatbotResponse
|
||||
{
|
||||
public static class Types
|
||||
{
|
@ -6,7 +6,7 @@ namespace SKIT.FlurlHttpClient.Wechat.OpenAI.Models
|
||||
/// <para>表示 [POST] /geth5link/{TOKEN} 接口的请求。</para>
|
||||
/// </summary>
|
||||
[Obsolete("相关接口或字段于 2023-04-07 下线。")]
|
||||
public class GetH5LinkRequest : WechatOpenAIRequest, WechatOpenAIRequest.Serialization.IEncryptedXmlable
|
||||
public class GetH5LinkRequest : WechatChatbotRequest, WechatChatbotRequest.Serialization.IEncryptedXmlable
|
||||
{
|
||||
/// <summary>
|
||||
/// 获取或设置页面标题。
|
@ -6,7 +6,7 @@ namespace SKIT.FlurlHttpClient.Wechat.OpenAI.Models
|
||||
/// <para>表示 [POST] /geth5link/{TOKEN} 接口的响应。</para>
|
||||
/// </summary>
|
||||
[Obsolete("相关接口或字段于 2023-04-07 下线。")]
|
||||
public class GetH5LinkResponse : WechatOpenAIResponse
|
||||
public class GetH5LinkResponse : WechatChatbotResponse
|
||||
{
|
||||
/// <summary>
|
||||
/// <inheritdoc/>
|
@ -6,7 +6,7 @@ namespace SKIT.FlurlHttpClient.Wechat.OpenAI.Models
|
||||
/// <para>表示 [POST] /unbindmp/{TOKEN} 接口的请求。</para>
|
||||
/// </summary>
|
||||
[Obsolete("相关接口或字段于 2023-04-07 下线。")]
|
||||
public class UnbindMpRequest : WechatOpenAIRequest, WechatOpenAIRequest.Serialization.IEncryptedXmlable
|
||||
public class UnbindMpRequest : WechatChatbotRequest, WechatChatbotRequest.Serialization.IEncryptedXmlable
|
||||
{
|
||||
/// <summary>
|
||||
/// 获取或设置微信 AppId。
|
@ -6,7 +6,7 @@ namespace SKIT.FlurlHttpClient.Wechat.OpenAI.Models
|
||||
/// <para>表示 [POST] /unbindmp/{TOKEN} 接口的响应。</para>
|
||||
/// </summary>
|
||||
[Obsolete("相关接口或字段于 2023-04-07 下线。")]
|
||||
public class UnbindMpResponse : WechatOpenAIResponse
|
||||
public class UnbindMpResponse : WechatChatbotResponse
|
||||
{
|
||||
/// <summary>
|
||||
/// <inheritdoc/>
|
@ -3,10 +3,10 @@ namespace SKIT.FlurlHttpClient.Wechat.OpenAI.Models
|
||||
/// <summary>
|
||||
/// <para>表示 [POST] /kefustate/change/{TOKEN} 接口的请求。</para>
|
||||
/// </summary>
|
||||
public class KefuStateChangeRequest : WechatOpenAIRequest, WechatOpenAIRequest.Serialization.IEncryptedXmlable
|
||||
public class KefuStateChangeRequest : WechatChatbotRequest, WechatChatbotRequest.Serialization.IEncryptedXmlable
|
||||
{
|
||||
/// <summary>
|
||||
/// 获取或设置微信 AppId。如果不指定将使用构造 <see cref="WechatOpenAIClient"/> 时的 <see cref="WechatOpenAIClientOptions.AppId"/> 参数。
|
||||
/// 获取或设置微信 AppId。如果不指定将使用构造 <see cref="WechatChatbotClient"/> 时的 <see cref="WechatChatbotClientOptions.AppId"/> 参数。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("appid")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("appid")]
|
@ -3,7 +3,7 @@ namespace SKIT.FlurlHttpClient.Wechat.OpenAI.Models
|
||||
/// <summary>
|
||||
/// <para>表示 [POST] /kefustate/change/{TOKEN} 接口的响应。</para>
|
||||
/// </summary>
|
||||
public class KefuStateChangeResponse : WechatOpenAIResponse
|
||||
public class KefuStateChangeResponse : WechatChatbotResponse
|
||||
{
|
||||
}
|
||||
}
|
@ -3,10 +3,10 @@ namespace SKIT.FlurlHttpClient.Wechat.OpenAI.Models
|
||||
/// <summary>
|
||||
/// <para>表示 [POST] /kefustate/get/{TOKEN} 接口的请求。</para>
|
||||
/// </summary>
|
||||
public class KefuStateGetRequest : WechatOpenAIRequest, WechatOpenAIRequest.Serialization.IEncryptedXmlable
|
||||
public class KefuStateGetRequest : WechatChatbotRequest, WechatChatbotRequest.Serialization.IEncryptedXmlable
|
||||
{
|
||||
/// <summary>
|
||||
/// 获取或设置微信 AppId。如果不指定将使用构造 <see cref="WechatOpenAIClient"/> 时的 <see cref="WechatOpenAIClientOptions.AppId"/> 参数。
|
||||
/// 获取或设置微信 AppId。如果不指定将使用构造 <see cref="WechatChatbotClient"/> 时的 <see cref="WechatChatbotClientOptions.AppId"/> 参数。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("appid")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("appid")]
|
@ -3,7 +3,7 @@ namespace SKIT.FlurlHttpClient.Wechat.OpenAI.Models
|
||||
/// <summary>
|
||||
/// <para>表示 [POST] /kefustate/get/{TOKEN} 接口的响应。</para>
|
||||
/// </summary>
|
||||
public class KefuStateGetResponse : WechatOpenAIResponse
|
||||
public class KefuStateGetResponse : WechatChatbotResponse
|
||||
{
|
||||
/// <summary>
|
||||
/// 获取或设置客服接入状态。
|
@ -3,10 +3,10 @@ namespace SKIT.FlurlHttpClient.Wechat.OpenAI.Models
|
||||
/// <summary>
|
||||
/// <para>表示 [POST] /sendmsg/{TOKEN} 接口的请求。</para>
|
||||
/// </summary>
|
||||
public class SendMessageRequest : WechatOpenAIRequest, WechatOpenAIRequest.Serialization.IEncryptedXmlable
|
||||
public class SendMessageRequest : WechatChatbotRequest, WechatChatbotRequest.Serialization.IEncryptedXmlable
|
||||
{
|
||||
/// <summary>
|
||||
/// 获取或设置微信 AppId。如果不指定将使用构造 <see cref="WechatOpenAIClient"/> 时的 <see cref="WechatOpenAIClientOptions.AppId"/> 参数。
|
||||
/// 获取或设置微信 AppId。如果不指定将使用构造 <see cref="WechatChatbotClient"/> 时的 <see cref="WechatChatbotClientOptions.AppId"/> 参数。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("appid")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("appid")]
|
@ -3,7 +3,7 @@
|
||||
/// <summary>
|
||||
/// <para>表示 [POST] /sendmsg/{TOKEN} 接口的响应。</para>
|
||||
/// </summary>
|
||||
public class SendMessageResponse : WechatOpenAIResponse
|
||||
public class SendMessageResponse : WechatChatbotResponse
|
||||
{
|
||||
}
|
||||
}
|
@ -5,21 +5,21 @@ namespace SKIT.FlurlHttpClient.Wechat.OpenAI.Settings
|
||||
public sealed class Credentials
|
||||
{
|
||||
/// <summary>
|
||||
/// 初始化客户端时 <see cref="WechatOpenAIClientOptions.AppId"/> 的副本。
|
||||
/// 初始化客户端时 <see cref="WechatChatbotClientOptions.AppId"/> 的副本。
|
||||
/// </summary>
|
||||
public string AppId { get; }
|
||||
|
||||
/// <summary>
|
||||
/// 初始化客户端时 <see cref="WechatOpenAIClientOptions.Token"/> 的副本。
|
||||
/// 初始化客户端时 <see cref="WechatChatbotClientOptions.Token"/> 的副本。
|
||||
/// </summary>
|
||||
public string Token { get; }
|
||||
|
||||
/// <summary>
|
||||
/// 初始化客户端时 <see cref="WechatOpenAIClientOptions.EncodingAESKey"/> 的副本。
|
||||
/// 初始化客户端时 <see cref="WechatChatbotClientOptions.EncodingAESKey"/> 的副本。
|
||||
/// </summary>
|
||||
public string EncodingAESKey { get; }
|
||||
|
||||
internal Credentials(WechatOpenAIClientOptions options)
|
||||
internal Credentials(WechatChatbotClientOptions options)
|
||||
{
|
||||
if (options is null) throw new ArgumentNullException(nameof(options));
|
||||
|
||||
|
@ -9,7 +9,7 @@ namespace SKIT.FlurlHttpClient.Wechat.OpenAI
|
||||
/// <summary>
|
||||
/// 一个微信智能对话 API HTTP 客户端。
|
||||
/// </summary>
|
||||
public class WechatOpenAIClient : CommonClientBase, ICommonClient
|
||||
public class WechatChatbotClient : CommonClientBase, ICommonClient
|
||||
{
|
||||
/// <summary>
|
||||
/// 获取当前客户端使用的微信智能对话平台凭证。
|
||||
@ -17,10 +17,10 @@ namespace SKIT.FlurlHttpClient.Wechat.OpenAI
|
||||
public Settings.Credentials Credentials { get; }
|
||||
|
||||
/// <summary>
|
||||
/// 用指定的配置项初始化 <see cref="WechatOpenAIClient"/> 类的新实例。
|
||||
/// 用指定的配置项初始化 <see cref="WechatChatbotClient"/> 类的新实例。
|
||||
/// </summary>
|
||||
/// <param name="options">配置项。</param>
|
||||
public WechatOpenAIClient(WechatOpenAIClientOptions options)
|
||||
public WechatChatbotClient(WechatChatbotClientOptions options)
|
||||
: this(options, null)
|
||||
{
|
||||
}
|
||||
@ -31,14 +31,14 @@ namespace SKIT.FlurlHttpClient.Wechat.OpenAI
|
||||
/// <param name="options"></param>
|
||||
/// <param name="httpClient"></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)
|
||||
{
|
||||
if (options is null) throw new ArgumentNullException(nameof(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));
|
||||
}
|
||||
|
||||
@ -49,7 +49,7 @@ namespace SKIT.FlurlHttpClient.Wechat.OpenAI
|
||||
/// <param name="httpMethod"></param>
|
||||
/// <param name="urlSegments"></param>
|
||||
/// <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);
|
||||
|
||||
@ -65,7 +65,7 @@ namespace SKIT.FlurlHttpClient.Wechat.OpenAI
|
||||
/// <param name="cancellationToken"></param>
|
||||
/// <returns></returns>
|
||||
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));
|
||||
|
||||
@ -82,11 +82,11 @@ namespace SKIT.FlurlHttpClient.Wechat.OpenAI
|
||||
/// <param name="cancellationToken"></param>
|
||||
/// <returns></returns>
|
||||
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 (data is WechatOpenAIRequest.Serialization.IEncryptedXmlable)
|
||||
if (data is WechatChatbotRequest.Serialization.IEncryptedXmlable)
|
||||
{
|
||||
string plainXml = Utilities.XmlHelper.ConvertFromJson(JsonSerializer.Serialize(data));
|
||||
string encryptedXml = Utilities.WxMsgCryptor.AESEncrypt(plainText: plainXml, encodingAESKey: Credentials.EncodingAESKey!, appId: Credentials.AppId!);
|
@ -5,39 +5,39 @@ using System.Net.Http;
|
||||
namespace SKIT.FlurlHttpClient.Wechat.OpenAI
|
||||
{
|
||||
/// <summary>
|
||||
/// 用于构造 <see cref="WechatOpenAIClient"/> 实例的构造器。
|
||||
/// 用于构造 <see cref="WechatChatbotClient"/> 实例的构造器。
|
||||
/// </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<HttpInterceptor> _interceptors;
|
||||
private HttpClient? _httpClient;
|
||||
private bool? _disposeClient;
|
||||
|
||||
private WechatOpenAIClientBuilder(WechatOpenAIClientOptions options)
|
||||
private WechatChatbotClientBuilder(WechatChatbotClientOptions options)
|
||||
{
|
||||
_options = options;
|
||||
_configures = new List<Action<CommonClientSettings>>();
|
||||
_interceptors = new List<HttpInterceptor>();
|
||||
}
|
||||
|
||||
ICommonClientBuilder<WechatOpenAIClient> ICommonClientBuilder<WechatOpenAIClient>.ConfigureSettings(Action<CommonClientSettings> configure)
|
||||
ICommonClientBuilder<WechatChatbotClient> ICommonClientBuilder<WechatChatbotClient>.ConfigureSettings(Action<CommonClientSettings> configure)
|
||||
{
|
||||
return ConfigureSettings(configure);
|
||||
}
|
||||
|
||||
ICommonClientBuilder<WechatOpenAIClient> ICommonClientBuilder<WechatOpenAIClient>.UseInterceptor(HttpInterceptor interceptor)
|
||||
ICommonClientBuilder<WechatChatbotClient> ICommonClientBuilder<WechatChatbotClient>.UseInterceptor(HttpInterceptor 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);
|
||||
}
|
||||
|
||||
public WechatOpenAIClientBuilder ConfigureSettings(Action<CommonClientSettings> configure)
|
||||
public WechatChatbotClientBuilder ConfigureSettings(Action<CommonClientSettings> configure)
|
||||
{
|
||||
if (configure is null) throw new ArgumentNullException(nameof(configure));
|
||||
|
||||
@ -45,7 +45,7 @@ namespace SKIT.FlurlHttpClient.Wechat.OpenAI
|
||||
return this;
|
||||
}
|
||||
|
||||
public WechatOpenAIClientBuilder UseInterceptor(HttpInterceptor interceptor)
|
||||
public WechatChatbotClientBuilder UseInterceptor(HttpInterceptor interceptor)
|
||||
{
|
||||
if (interceptor is null) throw new ArgumentNullException(nameof(interceptor));
|
||||
|
||||
@ -53,7 +53,7 @@ namespace SKIT.FlurlHttpClient.Wechat.OpenAI
|
||||
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));
|
||||
|
||||
@ -62,11 +62,11 @@ namespace SKIT.FlurlHttpClient.Wechat.OpenAI
|
||||
return this;
|
||||
}
|
||||
|
||||
public WechatOpenAIClient Build()
|
||||
public WechatChatbotClient Build()
|
||||
{
|
||||
WechatOpenAIClient client = _disposeClient.HasValue
|
||||
? new WechatOpenAIClient(_options, _httpClient, _disposeClient.Value)
|
||||
: new WechatOpenAIClient(_options, _httpClient);
|
||||
WechatChatbotClient client = _disposeClient.HasValue
|
||||
? new WechatChatbotClient(_options, _httpClient, _disposeClient.Value)
|
||||
: new WechatChatbotClient(_options, _httpClient);
|
||||
|
||||
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));
|
||||
|
||||
return new WechatOpenAIClientBuilder(options);
|
||||
return new WechatChatbotClientBuilder(options);
|
||||
}
|
||||
}
|
||||
}
|
@ -1,9 +1,9 @@
|
||||
namespace SKIT.FlurlHttpClient.Wechat.OpenAI
|
||||
{
|
||||
/// <summary>
|
||||
/// 一个用于构造 <see cref="WechatOpenAIClient"/> 时使用的配置项。
|
||||
/// 一个用于构造 <see cref="WechatChatbotClient"/> 时使用的配置项。
|
||||
/// </summary>
|
||||
public class WechatOpenAIClientOptions
|
||||
public class WechatChatbotClientOptions
|
||||
{
|
||||
/// <summary>
|
||||
/// 获取或设置请求超时时间(单位:毫秒)。
|
||||
@ -13,9 +13,9 @@ namespace SKIT.FlurlHttpClient.Wechat.OpenAI
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置微信智能对话 API 入口点。
|
||||
/// <para>默认值:<see cref="WechatOpenAIEndpoints.DEFAULT"/></para>
|
||||
/// <para>默认值:<see cref="WechatChatbotEndpoints.DEFAULT"/></para>
|
||||
/// </summary>
|
||||
public string Endpoint { get; set; } = WechatOpenAIEndpoints.DEFAULT;
|
||||
public string Endpoint { get; set; } = WechatChatbotEndpoints.DEFAULT;
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置微信智能对话 AppId。
|
@ -3,7 +3,7 @@ namespace SKIT.FlurlHttpClient.Wechat.OpenAI
|
||||
/// <summary>
|
||||
/// <para>微信智能对话 API 接口域名。</para>
|
||||
/// </summary>
|
||||
public static class WechatOpenAIEndpoints
|
||||
public static class WechatChatbotEndpoints
|
||||
{
|
||||
/// <summary>
|
||||
/// 主域名(默认)。
|
@ -4,7 +4,7 @@ namespace SKIT.FlurlHttpClient.Wechat.OpenAI
|
||||
/// 表示微信智能对话 API 回调通知事件的基类。
|
||||
/// </summary>
|
||||
[System.Xml.Serialization.XmlRoot("xml")]
|
||||
public class WechatOpenAIEvent : ICommonWebhookEvent
|
||||
public class WechatChatbotEvent : ICommonWebhookEvent
|
||||
{
|
||||
/// <summary>
|
||||
/// 获取或设置 AppId。
|
@ -5,21 +5,21 @@ namespace SKIT.FlurlHttpClient.Wechat.OpenAI
|
||||
/// <summary>
|
||||
/// 当调用微信智能对话 API 出错时引发的异常。
|
||||
/// </summary>
|
||||
public class WechatOpenAIException : CommonException
|
||||
public class WechatChatbotException : CommonException
|
||||
{
|
||||
/// <inheritdoc/>
|
||||
public WechatOpenAIException()
|
||||
public WechatChatbotException()
|
||||
{
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public WechatOpenAIException(string message)
|
||||
public WechatChatbotException(string message)
|
||||
: base(message)
|
||||
{
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public WechatOpenAIException(string message, Exception innerException)
|
||||
public WechatChatbotException(string message, Exception innerException)
|
||||
: base(message, innerException)
|
||||
{
|
||||
}
|
@ -3,7 +3,7 @@ namespace SKIT.FlurlHttpClient.Wechat.OpenAI
|
||||
/// <summary>
|
||||
/// 表示微信智能对话 API 请求的基类。
|
||||
/// </summary>
|
||||
public abstract class WechatOpenAIRequest : CommonRequestBase, ICommonRequest
|
||||
public abstract class WechatChatbotRequest : CommonRequestBase, ICommonRequest
|
||||
{
|
||||
public static class Serialization
|
||||
{
|
@ -3,7 +3,7 @@ namespace SKIT.FlurlHttpClient.Wechat.OpenAI
|
||||
/// <summary>
|
||||
/// 表示微信智能对话 API 响应的基类。
|
||||
/// </summary>
|
||||
public abstract class WechatOpenAIResponse : CommonResponseBase, ICommonResponse
|
||||
public abstract class WechatChatbotResponse : CommonResponseBase, ICommonResponse
|
||||
{
|
||||
/// <summary>
|
||||
/// 获取微信智能对话 API 返回的错误码。
|
||||
@ -49,7 +49,7 @@ namespace SKIT.FlurlHttpClient.Wechat.OpenAI
|
||||
/// <summary>
|
||||
/// 表示微信智能对话 API 响应的泛型基类。
|
||||
/// </summary>
|
||||
public abstract class WechatOpenAIResponse<TData> : WechatOpenAIResponse
|
||||
public abstract class WechatChatbotResponse<TData> : WechatChatbotResponse
|
||||
where TData : class
|
||||
{
|
||||
/// <summary>
|
@ -19,11 +19,15 @@ namespace SKIT.FlurlHttpClient.Wechat.OpenAI.UnitTests
|
||||
{
|
||||
var options = new TypeDeclarationAnalyzerOptions()
|
||||
{
|
||||
SdkAssembly = Assembly.GetAssembly(typeof(WechatOpenAIClient))!,
|
||||
SdkAssembly = Assembly.GetAssembly(typeof(WechatChatbotClient))!,
|
||||
SdkRequestModelDeclarationNamespace = "SKIT.FlurlHttpClient.Wechat.OpenAI.Models",
|
||||
SdkResponseModelDeclarationNamespace = "SKIT.FlurlHttpClient.Wechat.OpenAI.Models",
|
||||
SdkExecutingExtensionDeclarationNamespace = "SKIT.FlurlHttpClient.Wechat.OpenAI",
|
||||
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,
|
||||
ThrowOnNotFoundResponseModelTypes = true,
|
||||
ThrowOnNotFoundExecutingExtensionTypes = true,
|
||||
@ -39,12 +43,18 @@ namespace SKIT.FlurlHttpClient.Wechat.OpenAI.UnitTests
|
||||
|
||||
var options = new SourceFileAnalyzerOptions()
|
||||
{
|
||||
SdkAssembly = Assembly.GetAssembly(typeof(WechatOpenAIClient))!,
|
||||
SdkAssembly = Assembly.GetAssembly(typeof(WechatChatbotClient))!,
|
||||
SdkRequestModelDeclarationNamespace = "SKIT.FlurlHttpClient.Wechat.OpenAI.Models",
|
||||
SdkResponseModelDeclarationNamespace = "SKIT.FlurlHttpClient.Wechat.OpenAI.Models",
|
||||
SdkWebhookEventDeclarationNamespace = "SKIT.FlurlHttpClient.Wechat.OpenAI.Events",
|
||||
ProjectSourceRootDirectory = Path.Combine(projdir, "./src/SKIT.FlurlHttpClient.Wechat.OpenAI/"),
|
||||
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,
|
||||
ThrowOnNotFoundResponseModelClassCodeFiles = true,
|
||||
ThrowOnNotFoundExecutingExtensionClassCodeFiles = true,
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
@ -1,5 +1,3 @@
|
||||
using System;
|
||||
using System.Text;
|
||||
using Xunit;
|
||||
|
||||
namespace SKIT.FlurlHttpClient.Wechat.OpenAI.UnitTests
|
||||
|
@ -4,7 +4,7 @@ namespace SKIT.FlurlHttpClient.Wechat.OpenAI.UnitTests
|
||||
{
|
||||
static TestClients()
|
||||
{
|
||||
Instance = new WechatOpenAIClient(new WechatOpenAIClientOptions()
|
||||
Instance = new WechatChatbotClient(new WechatChatbotClientOptions()
|
||||
{
|
||||
AppId = TestConfigs.WechatAppId,
|
||||
Token = TestConfigs.WechatToken,
|
||||
@ -12,6 +12,6 @@ namespace SKIT.FlurlHttpClient.Wechat.OpenAI.UnitTests
|
||||
});
|
||||
}
|
||||
|
||||
public static readonly WechatOpenAIClient Instance;
|
||||
public static readonly WechatChatbotClient Instance;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user