mirror of
https://gitee.com/fudiwei/DotNetCore.SKIT.FlurlHttpClient.Wechat.git
synced 2026-03-10 00:13:36 +08:00
feat(wxapi): 新增小程序企业微信客服相关接口
This commit is contained in:
@@ -85,9 +85,10 @@
|
|||||||
| √ | 物流助手 | 行业能力 | |
|
| √ | 物流助手 | 行业能力 | |
|
||||||
| √ | 微信服务市场 | | |
|
| √ | 微信服务市场 | | |
|
||||||
| √ | 生物认证 | | |
|
| √ | 生物认证 | | |
|
||||||
| × | <del>广告</del> | | 异构协议,需独立模块 |
|
|
||||||
| √ | 购物订单 | 商业能力 | |
|
|
||||||
| √ | 交易保障 | 商业能力 | |
|
| √ | 交易保障 | 商业能力 | |
|
||||||
|
| √ | 购物订单 | 商业能力 | |
|
||||||
|
| √ | 微信客服 | 商业能力 | |
|
||||||
|
| × | <del>广告</del> | | 异构协议,需独立模块 |
|
||||||
| √ | 交易组件 | 商业能力 | |
|
| √ | 交易组件 | 商业能力 | |
|
||||||
| √ | 小程序联盟 | 商业能力 | |
|
| √ | 小程序联盟 | 商业能力 | |
|
||||||
| √ | 小程序支付管理服务 | 商业能力 | |
|
| √ | 小程序支付管理服务 | 商业能力 | |
|
||||||
|
|||||||
+63
-1
@@ -1,4 +1,4 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Net.Http;
|
using System.Net.Http;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
@@ -305,5 +305,67 @@ namespace SKIT.FlurlHttpClient.Wechat.Api
|
|||||||
return await client.SendRequestWithJsonAsync<Models.CustomServiceMessageRecordGetMessageListResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
|
return await client.SendRequestWithJsonAsync<Models.CustomServiceMessageRecordGetMessageListResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
#region Work
|
||||||
|
/// <summary>
|
||||||
|
/// <para>异步调用 [POST] /customservice/work/get 接口。</para>
|
||||||
|
/// <para>REF: https://developers.weixin.qq.com/miniprogram/dev/OpenApiDoc/kf-work/getKfWorkBound.html </para>
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="client"></param>
|
||||||
|
/// <param name="request"></param>
|
||||||
|
/// <param name="cancellationToken"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public static async Task<Models.CustomServiceWorkGetResponse> ExecuteCustomServiceWorkGetAsync(this WechatApiClient client, Models.CustomServiceWorkGetRequest request, CancellationToken cancellationToken = default)
|
||||||
|
{
|
||||||
|
if (client is null) throw new ArgumentNullException(nameof(client));
|
||||||
|
if (request is null) throw new ArgumentNullException(nameof(request));
|
||||||
|
|
||||||
|
IFlurlRequest flurlReq = client
|
||||||
|
.CreateRequest(request, HttpMethod.Post, "customservice", "work", "get")
|
||||||
|
.SetQueryParam("access_token", request.AccessToken);
|
||||||
|
|
||||||
|
return await client.SendRequestWithJsonAsync<Models.CustomServiceWorkGetResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// <para>异步调用 [POST] /customservice/work/unbind 接口。</para>
|
||||||
|
/// <para>REF: https://developers.weixin.qq.com/miniprogram/dev/OpenApiDoc/kf-work/unbindKfWork.html </para>
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="client"></param>
|
||||||
|
/// <param name="request"></param>
|
||||||
|
/// <param name="cancellationToken"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public static async Task<Models.CustomServiceWorkUnbindResponse> ExecuteCustomServiceWorkUnbindAsync(this WechatApiClient client, Models.CustomServiceWorkUnbindRequest request, CancellationToken cancellationToken = default)
|
||||||
|
{
|
||||||
|
if (client is null) throw new ArgumentNullException(nameof(client));
|
||||||
|
if (request is null) throw new ArgumentNullException(nameof(request));
|
||||||
|
|
||||||
|
IFlurlRequest flurlReq = client
|
||||||
|
.CreateRequest(request, HttpMethod.Post, "customservice", "work", "unbind")
|
||||||
|
.SetQueryParam("access_token", request.AccessToken);
|
||||||
|
|
||||||
|
return await client.SendRequestWithJsonAsync<Models.CustomServiceWorkUnbindResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// <para>异步调用 [POST] /customservice/work/bind 接口。</para>
|
||||||
|
/// <para>REF: https://developers.weixin.qq.com/miniprogram/dev/OpenApiDoc/kf-work/bindKfWork.html </para>
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="client"></param>
|
||||||
|
/// <param name="request"></param>
|
||||||
|
/// <param name="cancellationToken"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public static async Task<Models.CustomServiceWorkBindResponse> ExecuteCustomServiceWorkBindAsync(this WechatApiClient client, Models.CustomServiceWorkBindRequest request, CancellationToken cancellationToken = default)
|
||||||
|
{
|
||||||
|
if (client is null) throw new ArgumentNullException(nameof(client));
|
||||||
|
if (request is null) throw new ArgumentNullException(nameof(request));
|
||||||
|
|
||||||
|
IFlurlRequest flurlReq = client
|
||||||
|
.CreateRequest(request, HttpMethod.Post, "customservice", "work", "bind")
|
||||||
|
.SetQueryParam("access_token", request.AccessToken);
|
||||||
|
|
||||||
|
return await client.SendRequestWithJsonAsync<Models.CustomServiceWorkBindResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+15
@@ -0,0 +1,15 @@
|
|||||||
|
namespace SKIT.FlurlHttpClient.Wechat.Api.Models
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// <para>表示 [POST] /customservice/work/bind 接口的请求。</para>
|
||||||
|
/// </summary>
|
||||||
|
public class CustomServiceWorkBindRequest : WechatApiRequest, IInferable<CustomServiceWorkBindRequest, CustomServiceWorkBindResponse>
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 获取或设置企业 ID。
|
||||||
|
/// </summary>
|
||||||
|
[Newtonsoft.Json.JsonProperty("corpid")]
|
||||||
|
[System.Text.Json.Serialization.JsonPropertyName("corpid")]
|
||||||
|
public string CorpId { get; set; } = string.Empty;
|
||||||
|
}
|
||||||
|
}
|
||||||
+9
@@ -0,0 +1,9 @@
|
|||||||
|
namespace SKIT.FlurlHttpClient.Wechat.Api.Models
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// <para>表示 [POST] /customservice/work/bind 接口的响应。</para>
|
||||||
|
/// </summary>
|
||||||
|
public class CustomServiceWorkBindResponse : WechatApiResponse
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
+9
@@ -0,0 +1,9 @@
|
|||||||
|
namespace SKIT.FlurlHttpClient.Wechat.Api.Models
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// <para>表示 [POST] /customservice/work/get 接口的请求。</para>
|
||||||
|
/// </summary>
|
||||||
|
public class CustomServiceWorkGetRequest : WechatApiRequest, IInferable<CustomServiceWorkGetRequest, CustomServiceWorkGetResponse>
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
+29
@@ -0,0 +1,29 @@
|
|||||||
|
namespace SKIT.FlurlHttpClient.Wechat.Api.Models
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// <para>表示 [POST] /customservice/work/get 接口的响应。</para>
|
||||||
|
/// </summary>
|
||||||
|
public class CustomServiceWorkGetResponse : WechatApiResponse
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 获取或设置主体名称。
|
||||||
|
/// </summary>
|
||||||
|
[Newtonsoft.Json.JsonProperty("entityName")]
|
||||||
|
[System.Text.Json.Serialization.JsonPropertyName("entityName")]
|
||||||
|
public string? EntityName { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 获取或设置企业 ID。
|
||||||
|
/// </summary>
|
||||||
|
[Newtonsoft.Json.JsonProperty("corpid")]
|
||||||
|
[System.Text.Json.Serialization.JsonPropertyName("corpid")]
|
||||||
|
public string? CorpId { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 获取或设置绑定时间戳。
|
||||||
|
/// </summary>
|
||||||
|
[Newtonsoft.Json.JsonProperty("bindTime")]
|
||||||
|
[System.Text.Json.Serialization.JsonPropertyName("bindTime")]
|
||||||
|
public long? BindTimestamp { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
+15
@@ -0,0 +1,15 @@
|
|||||||
|
namespace SKIT.FlurlHttpClient.Wechat.Api.Models
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// <para>表示 [POST] /customservice/work/unbind 接口的请求。</para>
|
||||||
|
/// </summary>
|
||||||
|
public class CustomServiceWorkUnbindRequest : WechatApiRequest, IInferable<CustomServiceWorkUnbindRequest, CustomServiceWorkUnbindResponse>
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 获取或设置企业 ID。
|
||||||
|
/// </summary>
|
||||||
|
[Newtonsoft.Json.JsonProperty("corpid")]
|
||||||
|
[System.Text.Json.Serialization.JsonPropertyName("corpid")]
|
||||||
|
public string CorpId { get; set; } = string.Empty;
|
||||||
|
}
|
||||||
|
}
|
||||||
+9
@@ -0,0 +1,9 @@
|
|||||||
|
namespace SKIT.FlurlHttpClient.Wechat.Api.Models
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// <para>表示 [POST] /customservice/work/unbind 接口的响应。</para>
|
||||||
|
/// </summary>
|
||||||
|
public class CustomServiceWorkUnbindResponse : WechatApiResponse
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
+3
@@ -0,0 +1,3 @@
|
|||||||
|
{
|
||||||
|
"corpid": "wwee11111xxxxxxx"
|
||||||
|
}
|
||||||
+6
@@ -0,0 +1,6 @@
|
|||||||
|
{
|
||||||
|
"errcode": 0,
|
||||||
|
"entityName": "XXXXX有限公司",
|
||||||
|
"corpid": "wwee11111xxxxxxx",
|
||||||
|
"bindTime": 1694611289
|
||||||
|
}
|
||||||
+3
@@ -0,0 +1,3 @@
|
|||||||
|
{
|
||||||
|
"corpid": "wwee11111xxxxxxx"
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user