mirror of
https://gitee.com/fudiwei/DotNetCore.SKIT.FlurlHttpClient.Wechat.git
synced 2025-09-19 01:58:14 +08:00
feat(wxapi): 新增小程序企业微信客服相关接口
This commit is contained in:
@@ -85,9 +85,10 @@
|
||||
| √ | 物流助手 | 行业能力 | |
|
||||
| √ | 微信服务市场 | | |
|
||||
| √ | 生物认证 | | |
|
||||
| × | <del>广告</del> | | 异构协议,需独立模块 |
|
||||
| √ | 购物订单 | 商业能力 | |
|
||||
| √ | 交易保障 | 商业能力 | |
|
||||
| √ | 购物订单 | 商业能力 | |
|
||||
| √ | 微信客服 | 商业能力 | |
|
||||
| × | <del>广告</del> | | 异构协议,需独立模块 |
|
||||
| √ | 交易组件 | 商业能力 | |
|
||||
| √ | 小程序联盟 | 商业能力 | |
|
||||
| √ | 小程序支付管理服务 | 商业能力 | |
|
||||
|
@@ -1,4 +1,4 @@
|
||||
using System;
|
||||
using System;
|
||||
using System.Net.Http;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
@@ -305,5 +305,67 @@ namespace SKIT.FlurlHttpClient.Wechat.Api
|
||||
return await client.SendRequestWithJsonAsync<Models.CustomServiceMessageRecordGetMessageListResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
|
||||
}
|
||||
#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
|
||||
}
|
||||
}
|
||||
|
@@ -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;
|
||||
}
|
||||
}
|
@@ -0,0 +1,9 @@
|
||||
namespace SKIT.FlurlHttpClient.Wechat.Api.Models
|
||||
{
|
||||
/// <summary>
|
||||
/// <para>表示 [POST] /customservice/work/bind 接口的响应。</para>
|
||||
/// </summary>
|
||||
public class CustomServiceWorkBindResponse : WechatApiResponse
|
||||
{
|
||||
}
|
||||
}
|
@@ -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>
|
||||
{
|
||||
}
|
||||
}
|
@@ -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; }
|
||||
}
|
||||
}
|
@@ -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;
|
||||
}
|
||||
}
|
@@ -0,0 +1,9 @@
|
||||
namespace SKIT.FlurlHttpClient.Wechat.Api.Models
|
||||
{
|
||||
/// <summary>
|
||||
/// <para>表示 [POST] /customservice/work/unbind 接口的响应。</para>
|
||||
/// </summary>
|
||||
public class CustomServiceWorkUnbindResponse : WechatApiResponse
|
||||
{
|
||||
}
|
||||
}
|
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"corpid": "wwee11111xxxxxxx"
|
||||
}
|
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"errcode": 0,
|
||||
"entityName": "XXXXX有限公司",
|
||||
"corpid": "wwee11111xxxxxxx",
|
||||
"bindTime": 1694611289
|
||||
}
|
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"corpid": "wwee11111xxxxxxx"
|
||||
}
|
Reference in New Issue
Block a user