feat(wxapi): 随官方更新客服管理相关接口模型

This commit is contained in:
Fu Diwei
2022-07-01 20:08:05 +08:00
parent ab1a8dbd92
commit 5eae91e126
11 changed files with 161 additions and 3 deletions

View File

@@ -13,6 +13,7 @@ namespace SKIT.FlurlHttpClient.Wechat.Api
/// <para>异步调用 [GET] /cgi-bin/customservice/getkflist 接口。</para> /// <para>异步调用 [GET] /cgi-bin/customservice/getkflist 接口。</para>
/// <para>REF: https://developers.weixin.qq.com/doc/offiaccount/Message_Management/Service_Center_messages.html#5 </para> /// <para>REF: https://developers.weixin.qq.com/doc/offiaccount/Message_Management/Service_Center_messages.html#5 </para>
/// <para>REF: https://developers.weixin.qq.com/doc/offiaccount/Customer_Service/Customer_Service_Management.html#0 </para> /// <para>REF: https://developers.weixin.qq.com/doc/offiaccount/Customer_Service/Customer_Service_Management.html#0 </para>
/// <para>REF: https://developers.weixin.qq.com/miniprogram/introduction/custom.html#%E8%8E%B7%E5%8F%96%E5%AE%A2%E6%9C%8D%E5%9F%BA%E6%9C%AC%E4%BF%A1%E6%81%AF </para>
/// </summary> /// </summary>
/// <param name="client"></param> /// <param name="client"></param>
/// <param name="request"></param> /// <param name="request"></param>
@@ -33,6 +34,7 @@ namespace SKIT.FlurlHttpClient.Wechat.Api
/// <summary> /// <summary>
/// <para>异步调用 [GET] /cgi-bin/customservice/getonlinekflist 接口。</para> /// <para>异步调用 [GET] /cgi-bin/customservice/getonlinekflist 接口。</para>
/// <para>REF: https://developers.weixin.qq.com/doc/offiaccount/Customer_Service/Customer_Service_Management.html#0 </para> /// <para>REF: https://developers.weixin.qq.com/doc/offiaccount/Customer_Service/Customer_Service_Management.html#0 </para>
/// <para>REF: https://developers.weixin.qq.com/miniprogram/introduction/custom.html#%E8%8E%B7%E5%8F%96%E5%9C%A8%E7%BA%BF%E5%AE%A2%E6%9C%8D%E5%88%97%E8%A1%A8 </para>
/// </summary> /// </summary>
/// <param name="client"></param> /// <param name="client"></param>
/// <param name="request"></param> /// <param name="request"></param>

View File

@@ -14,6 +14,7 @@ namespace SKIT.FlurlHttpClient.Wechat.Api
/// <para>异步调用 [POST] /customservice/kfaccount/add 接口。</para> /// <para>异步调用 [POST] /customservice/kfaccount/add 接口。</para>
/// <para>REF: https://developers.weixin.qq.com/doc/offiaccount/Message_Management/Service_Center_messages.html#1 </para> /// <para>REF: https://developers.weixin.qq.com/doc/offiaccount/Message_Management/Service_Center_messages.html#1 </para>
/// <para>REF: https://developers.weixin.qq.com/doc/offiaccount/Customer_Service/Customer_Service_Management.html#2 </para> /// <para>REF: https://developers.weixin.qq.com/doc/offiaccount/Customer_Service/Customer_Service_Management.html#2 </para>
/// <para>REF: https://developers.weixin.qq.com/miniprogram/introduction/custom.html#%E6%B7%BB%E5%8A%A0%E5%AE%A2%E6%9C%8D%E8%B4%A6%E5%8F%B7 </para>
/// </summary> /// </summary>
/// <param name="client"></param> /// <param name="client"></param>
/// <param name="request"></param> /// <param name="request"></param>
@@ -68,12 +69,32 @@ namespace SKIT.FlurlHttpClient.Wechat.Api
IFlurlRequest flurlReq = client IFlurlRequest flurlReq = client
.CreateRequest(request, HttpMethod.Post, "customservice", "kfaccount", "del") .CreateRequest(request, HttpMethod.Post, "customservice", "kfaccount", "del")
.SetQueryParam("access_token", request.AccessToken) .SetQueryParam("access_token", request.AccessToken);
.SetQueryParam("kf_account", request.KfAccount);
return await client.SendRequestWithJsonAsync<Models.CustomServiceKfAccountDeleteResponse>(flurlReq, data: request, cancellationToken: cancellationToken); return await client.SendRequestWithJsonAsync<Models.CustomServiceKfAccountDeleteResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
} }
/// <summary>
/// <para>异步调用 [GET] /customservice/kfaccount/del 接口。</para>
/// <para>REF: https://developers.weixin.qq.com/miniprogram/introduction/custom.html#%E5%88%A0%E9%99%A4%E5%AE%A2%E6%9C%8D%E8%B4%A6%E5%8F%B7 </para>
/// </summary>
/// <param name="client"></param>
/// <param name="request"></param>
/// <param name="cancellationToken"></param>
/// <returns></returns>
public static async Task<Models.CustomServiceKfAccountDeleteByOpenIdResponse> ExecuteCustomServiceKfAccountDeleteByOpenIdAsync(this WechatApiClient client, Models.CustomServiceKfAccountDeleteByOpenIdRequest request, CancellationToken cancellationToken = default)
{
if (client is null) throw new ArgumentNullException(nameof(client));
if (request is null) throw new ArgumentNullException(nameof(request));
IFlurlRequest flurlReq = client
.CreateRequest(request, HttpMethod.Get, "customservice", "kfaccount", "del")
.SetQueryParam("access_token", request.AccessToken)
.SetQueryParam("kf_openid", request.OpenId);
return await client.SendRequestWithJsonAsync<Models.CustomServiceKfAccountDeleteByOpenIdResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
}
/// <summary> /// <summary>
/// <para>异步调用 [POST] /customservice/kfaccount/uploadheadimg 接口。</para> /// <para>异步调用 [POST] /customservice/kfaccount/uploadheadimg 接口。</para>
/// <para>REF: https://developers.weixin.qq.com/doc/offiaccount/Message_Management/Service_Center_messages.html#4 </para> /// <para>REF: https://developers.weixin.qq.com/doc/offiaccount/Message_Management/Service_Center_messages.html#4 </para>
@@ -115,6 +136,48 @@ namespace SKIT.FlurlHttpClient.Wechat.Api
return await client.SendRequestWithJsonAsync<Models.CustomServiceKfAccountInviteWorkerResponse>(flurlReq, data: request, cancellationToken: cancellationToken); return await client.SendRequestWithJsonAsync<Models.CustomServiceKfAccountInviteWorkerResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
} }
/// <summary>
/// <para>异步调用 [GET] /customservice/kfaccount/setadmin 接口。</para>
/// <para>REF: https://developers.weixin.qq.com/miniprogram/introduction/custom.html#%E8%AE%BE%E7%BD%AE%E5%AE%A2%E6%9C%8D%E7%AE%A1%E7%90%86%E5%91%98 </para>
/// </summary>
/// <param name="client"></param>
/// <param name="request"></param>
/// <param name="cancellationToken"></param>
/// <returns></returns>
public static async Task<Models.CustomServiceKfAccountSetAdminByOpenIdResponse> ExecuteCustomServiceKfAccountSetAdminByOpenIdAsync(this WechatApiClient client, Models.CustomServiceKfAccountSetAdminByOpenIdRequest request, CancellationToken cancellationToken = default)
{
if (client is null) throw new ArgumentNullException(nameof(client));
if (request is null) throw new ArgumentNullException(nameof(request));
IFlurlRequest flurlReq = client
.CreateRequest(request, HttpMethod.Get, "customservice", "kfaccount", "setadmin")
.SetQueryParam("access_token", request.AccessToken)
.SetQueryParam("kf_openid", request.OpenId);
return await client.SendRequestWithJsonAsync<Models.CustomServiceKfAccountSetAdminByOpenIdResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
}
/// <summary>
/// <para>异步调用 [GET] /customservice/kfaccount/canceladmin 接口。</para>
/// <para>REF: https://developers.weixin.qq.com/miniprogram/introduction/custom.html#%E5%8F%96%E6%B6%88%E5%AE%A2%E6%9C%8D%E7%AE%A1%E7%90%86%E5%91%98 </para>
/// </summary>
/// <param name="client"></param>
/// <param name="request"></param>
/// <param name="cancellationToken"></param>
/// <returns></returns>
public static async Task<Models.CustomServiceKfAccountCancelAdminByOpenIdResponse> ExecuteCustomServiceKfAccountCancelAdminByOpenIdAsync(this WechatApiClient client, Models.CustomServiceKfAccountCancelAdminByOpenIdRequest request, CancellationToken cancellationToken = default)
{
if (client is null) throw new ArgumentNullException(nameof(client));
if (request is null) throw new ArgumentNullException(nameof(request));
IFlurlRequest flurlReq = client
.CreateRequest(request, HttpMethod.Get, "customservice", "kfaccount", "canceladmin")
.SetQueryParam("access_token", request.AccessToken)
.SetQueryParam("kf_openid", request.OpenId);
return await client.SendRequestWithJsonAsync<Models.CustomServiceKfAccountCancelAdminByOpenIdResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
}
#endregion #endregion
#region KfSession #region KfSession

View File

@@ -44,6 +44,13 @@
[System.Text.Json.Serialization.JsonPropertyName("kf_wx")] [System.Text.Json.Serialization.JsonPropertyName("kf_wx")]
public string? Wxname { get; set; } public string? Wxname { get; set; }
/// <summary>
/// 获取或设置客服 OpenId。
/// </summary>
[Newtonsoft.Json.JsonProperty("kf_openid")]
[System.Text.Json.Serialization.JsonPropertyName("kf_openid")]
public string? OpenId { get; set; }
/// <summary> /// <summary>
/// 获取或设置绑定邀请的微信号。 /// 获取或设置绑定邀请的微信号。
/// </summary> /// </summary>

View File

@@ -30,6 +30,13 @@
[System.Text.Json.Serialization.JsonPropertyName("status")] [System.Text.Json.Serialization.JsonPropertyName("status")]
public int Status { get; set; } public int Status { get; set; }
/// <summary>
/// 获取或设置客服 OpenId。
/// </summary>
[Newtonsoft.Json.JsonProperty("kf_openid")]
[System.Text.Json.Serialization.JsonPropertyName("kf_openid")]
public string? OpenId { get; set; }
/// <summary> /// <summary>
/// 获取或设置客服当前正在接待的会话数。 /// 获取或设置客服当前正在接待的会话数。
/// </summary> /// </summary>

View File

@@ -10,7 +10,7 @@
/// </summary> /// </summary>
[Newtonsoft.Json.JsonProperty("kf_account")] [Newtonsoft.Json.JsonProperty("kf_account")]
[System.Text.Json.Serialization.JsonPropertyName("kf_account")] [System.Text.Json.Serialization.JsonPropertyName("kf_account")]
public string KfAccount { get; set; } = string.Empty; public string? KfAccount { get; set; }
/// <summary> /// <summary>
/// 获取或设置客服昵称。 /// 获取或设置客服昵称。
@@ -25,5 +25,12 @@
[Newtonsoft.Json.JsonProperty("password")] [Newtonsoft.Json.JsonProperty("password")]
[System.Text.Json.Serialization.JsonPropertyName("password")] [System.Text.Json.Serialization.JsonPropertyName("password")]
public string? Password { get; set; } public string? Password { get; set; }
/// <summary>
/// 获取或设置客服微信号。
/// </summary>
[Newtonsoft.Json.JsonProperty("kf_wx")]
[System.Text.Json.Serialization.JsonPropertyName("kf_wx")]
public string? Wxname { get; set; }
} }
} }

View File

@@ -0,0 +1,15 @@
namespace SKIT.FlurlHttpClient.Wechat.Api.Models
{
/// <summary>
/// <para>表示 [GET] /customservice/kfaccount/canceladmin 接口的请求。</para>
/// </summary>
public class CustomServiceKfAccountCancelAdminByOpenIdRequest : WechatApiRequest, IInferable<CustomServiceKfAccountCancelAdminByOpenIdRequest, CustomServiceKfAccountCancelAdminByOpenIdResponse>
{
/// <summary>
/// 获取或设置客服 OpenId。
/// </summary>
[Newtonsoft.Json.JsonIgnore]
[System.Text.Json.Serialization.JsonIgnore]
public string OpenId { get; set; } = string.Empty;
}
}

View File

@@ -0,0 +1,9 @@
namespace SKIT.FlurlHttpClient.Wechat.Api.Models
{
/// <summary>
/// <para>表示 [GET] /customservice/kfaccount/canceladmin 接口的响应。</para>
/// </summary>
public class CustomServiceKfAccountCancelAdminByOpenIdResponse : WechatApiResponse
{
}
}

View File

@@ -0,0 +1,15 @@
namespace SKIT.FlurlHttpClient.Wechat.Api.Models
{
/// <summary>
/// <para>表示 [GET] /customservice/kfaccount/del 接口的请求。</para>
/// </summary>
public class CustomServiceKfAccountDeleteByOpenIdRequest : WechatApiRequest, IInferable<CustomServiceKfAccountDeleteByOpenIdRequest, CustomServiceKfAccountDeleteByOpenIdResponse>
{
/// <summary>
/// 获取或设置客服 OpenId。
/// </summary>
[Newtonsoft.Json.JsonIgnore]
[System.Text.Json.Serialization.JsonIgnore]
public string OpenId { get; set; } = string.Empty;
}
}

View File

@@ -0,0 +1,9 @@
namespace SKIT.FlurlHttpClient.Wechat.Api.Models
{
/// <summary>
/// <para>表示 [GET] /customservice/kfaccount/del 接口的响应。</para>
/// </summary>
public class CustomServiceKfAccountDeleteByOpenIdResponse : WechatApiResponse
{
}
}

View File

@@ -0,0 +1,15 @@
namespace SKIT.FlurlHttpClient.Wechat.Api.Models
{
/// <summary>
/// <para>表示 [GET] /customservice/kfaccount/setadmin 接口的请求。</para>
/// </summary>
public class CustomServiceKfAccountSetAdminByOpenIdRequest : WechatApiRequest, IInferable<CustomServiceKfAccountSetAdminByOpenIdRequest, CustomServiceKfAccountSetAdminByOpenIdResponse>
{
/// <summary>
/// 获取或设置客服 OpenId。
/// </summary>
[Newtonsoft.Json.JsonIgnore]
[System.Text.Json.Serialization.JsonIgnore]
public string OpenId { get; set; } = string.Empty;
}
}

View File

@@ -0,0 +1,9 @@
namespace SKIT.FlurlHttpClient.Wechat.Api.Models
{
/// <summary>
/// <para>表示 [GET] /customservice/kfaccount/setadmin 接口的响应。</para>
/// </summary>
public class CustomServiceKfAccountSetAdminByOpenIdResponse : WechatApiResponse
{
}
}