mirror of
https://gitee.com/fudiwei/DotNetCore.SKIT.FlurlHttpClient.Wechat.git
synced 2025-07-17 01:46:20 +08:00
feat(work): 新增客服会话分配相关接口
This commit is contained in:
parent
836aef598b
commit
c5d9874248
@ -181,5 +181,49 @@ namespace SKIT.FlurlHttpClient.Wechat.Work
|
|||||||
return await client.SendRequestWithJsonAsync<Models.CgibinKfServicerListResponse>(flurlReq, cancellationToken: cancellationToken);
|
return await client.SendRequestWithJsonAsync<Models.CgibinKfServicerListResponse>(flurlReq, cancellationToken: cancellationToken);
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
#region ServiceState
|
||||||
|
/// <summary>
|
||||||
|
/// <para>异步调用 [POST] /cgi-bin/kf/service_state/get 接口。</para>
|
||||||
|
/// <para>REF: https://open.work.weixin.qq.com/api/doc/90000/90135/94669 </para>
|
||||||
|
/// <para>REF: https://open.work.weixin.qq.com/api/doc/90001/90143/94698 </para>
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="client"></param>
|
||||||
|
/// <param name="request"></param>
|
||||||
|
/// <param name="cancellationToken"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public static async Task<Models.CgibinKfServiceStateGetResponse> ExecuteCgibinKfServiceStateGetAsync(this WechatWorkClient client, Models.CgibinKfServiceStateGetRequest 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, "cgi-bin", "kf", "service_state", "get")
|
||||||
|
.SetQueryParam("access_token", request.AccessToken);
|
||||||
|
|
||||||
|
return await client.SendRequestWithJsonAsync<Models.CgibinKfServiceStateGetResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// <para>异步调用 [POST] /cgi-bin/kf/service_state/trans 接口。</para>
|
||||||
|
/// <para>REF: https://open.work.weixin.qq.com/api/doc/90000/90135/94669 </para>
|
||||||
|
/// <para>REF: https://open.work.weixin.qq.com/api/doc/90001/90143/94698 </para>
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="client"></param>
|
||||||
|
/// <param name="request"></param>
|
||||||
|
/// <param name="cancellationToken"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public static async Task<Models.CgibinKfServiceStateTransferResponse> ExecuteCgibinKfServiceStateTransferAsync(this WechatWorkClient client, Models.CgibinKfServiceStateTransferRequest 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, "cgi-bin", "kf", "service_state", "trans")
|
||||||
|
.SetQueryParam("access_token", request.AccessToken);
|
||||||
|
|
||||||
|
return await client.SendRequestWithJsonAsync<Models.CgibinKfServiceStateTransferResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,22 @@
|
|||||||
|
namespace SKIT.FlurlHttpClient.Wechat.Work.Models
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// <para>表示 [POST] /cgi-bin/kf/service_state/get 接口的请求。</para>
|
||||||
|
/// </summary>
|
||||||
|
public class CgibinKfServiceStateGetRequest : WechatWorkRequest
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 获取或设置客服账号 ID。
|
||||||
|
/// </summary>
|
||||||
|
[Newtonsoft.Json.JsonProperty("open_kfid")]
|
||||||
|
[System.Text.Json.Serialization.JsonPropertyName("open_kfid")]
|
||||||
|
public string OpenKfId { get; set; } = string.Empty;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 获取或设置外部联系人账号。
|
||||||
|
/// </summary>
|
||||||
|
[Newtonsoft.Json.JsonProperty("external_userid")]
|
||||||
|
[System.Text.Json.Serialization.JsonPropertyName("external_userid")]
|
||||||
|
public string ExternalUserId { get; set; } = string.Empty;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,22 @@
|
|||||||
|
namespace SKIT.FlurlHttpClient.Wechat.Work.Models
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// <para>表示 [POST] /cgi-bin/kf/service_state/get 接口的响应。</para>
|
||||||
|
/// </summary>
|
||||||
|
public class CgibinKfServiceStateGetResponse : WechatWorkResponse
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 获取或设置会话状态。
|
||||||
|
/// </summary>
|
||||||
|
[Newtonsoft.Json.JsonProperty("service_state")]
|
||||||
|
[System.Text.Json.Serialization.JsonPropertyName("service_state")]
|
||||||
|
public int ServiceState { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 获取或设置接待人员的 UserId。
|
||||||
|
/// </summary>
|
||||||
|
[Newtonsoft.Json.JsonProperty("servicer_userid")]
|
||||||
|
[System.Text.Json.Serialization.JsonPropertyName("servicer_userid")]
|
||||||
|
public string? ServicerUserId { get; set; }
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,36 @@
|
|||||||
|
namespace SKIT.FlurlHttpClient.Wechat.Work.Models
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// <para>表示 [POST] /cgi-bin/kf/service_state/trans 接口的请求。</para>
|
||||||
|
/// </summary>
|
||||||
|
public class CgibinKfServiceStateTransferRequest : WechatWorkRequest
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 获取或设置客服账号 ID。
|
||||||
|
/// </summary>
|
||||||
|
[Newtonsoft.Json.JsonProperty("open_kfid")]
|
||||||
|
[System.Text.Json.Serialization.JsonPropertyName("open_kfid")]
|
||||||
|
public string OpenKfId { get; set; } = string.Empty;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 获取或设置外部联系人账号。
|
||||||
|
/// </summary>
|
||||||
|
[Newtonsoft.Json.JsonProperty("external_userid")]
|
||||||
|
[System.Text.Json.Serialization.JsonPropertyName("external_userid")]
|
||||||
|
public string ExternalUserId { get; set; } = string.Empty;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 获取或设置会话状态。
|
||||||
|
/// </summary>
|
||||||
|
[Newtonsoft.Json.JsonProperty("service_state")]
|
||||||
|
[System.Text.Json.Serialization.JsonPropertyName("service_state")]
|
||||||
|
public int ServiceState { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 获取或设置接待人员的 UserId。
|
||||||
|
/// </summary>
|
||||||
|
[Newtonsoft.Json.JsonProperty("servicer_userid")]
|
||||||
|
[System.Text.Json.Serialization.JsonPropertyName("servicer_userid")]
|
||||||
|
public string? ServicerUserId { get; set; }
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,15 @@
|
|||||||
|
namespace SKIT.FlurlHttpClient.Wechat.Work.Models
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// <para>表示 [POST] /cgi-bin/kf/service_state/trans 接口的响应。</para>
|
||||||
|
/// </summary>
|
||||||
|
public class CgibinKfServiceStateTransferResponse : WechatWorkResponse
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 获取或设置用于发送响应事件消息的 Code。
|
||||||
|
/// </summary>
|
||||||
|
[Newtonsoft.Json.JsonProperty("msg_code")]
|
||||||
|
[System.Text.Json.Serialization.JsonPropertyName("msg_code")]
|
||||||
|
public string MessageCode { get; set; } = default!;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,4 @@
|
|||||||
|
{
|
||||||
|
"open_kfid": "wkxxxxxxxxxxxxxxxxxx",
|
||||||
|
"external_userid": "wmxxxxxxxxxxxxxxxxxx"
|
||||||
|
}
|
@ -0,0 +1,6 @@
|
|||||||
|
{
|
||||||
|
"errcode": 0,
|
||||||
|
"errmsg": "ok",
|
||||||
|
"service_state": 3,
|
||||||
|
"servicer_userid": "zhangsan"
|
||||||
|
}
|
@ -0,0 +1,6 @@
|
|||||||
|
{
|
||||||
|
"open_kfid": "wkxxxxxxxxxxxxxxxxxx",
|
||||||
|
"external_userid": "wmxxxxxxxxxxxxxxxxxx",
|
||||||
|
"service_state": 3,
|
||||||
|
"servicer_userid": "zhangsan"
|
||||||
|
}
|
@ -0,0 +1,5 @@
|
|||||||
|
{
|
||||||
|
"errcode": 0,
|
||||||
|
"errmsg": "ok",
|
||||||
|
"msg_code": "MSG_CODE"
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user