feat(work): 新增分配在职成员的客户群接口

This commit is contained in:
Fu Diwei
2022-06-22 22:14:32 +08:00
parent f0c0245de1
commit 42b869747c
5 changed files with 84 additions and 0 deletions

View File

@@ -583,6 +583,26 @@ namespace SKIT.FlurlHttpClient.Wechat.Work
return await client.SendRequestWithJsonAsync<Models.CgibinExternalContactGroupChatTransferResponse>(flurlReq, data: request, cancellationToken: cancellationToken); return await client.SendRequestWithJsonAsync<Models.CgibinExternalContactGroupChatTransferResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
} }
/// <summary>
/// <para>异步调用 [POST] /cgi-bin/externalcontact/groupchat/onjob_transfer 接口。</para>
/// <para>REF: https://developer.work.weixin.qq.com/document/path/95703 </para>
/// </summary>
/// <param name="client"></param>
/// <param name="request"></param>
/// <param name="cancellationToken"></param>
/// <returns></returns>
public static async Task<Models.CgibinExternalContactGroupChatOnJobTransferResponse> ExecuteCgibinExternalContactGroupChatOnJobTransferAsync(this WechatWorkClient client, Models.CgibinExternalContactGroupChatOnJobTransferRequest 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", "externalcontact", "groupchat", "onjob_transfer")
.SetQueryParam("access_token", request.AccessToken);
return await client.SendRequestWithJsonAsync<Models.CgibinExternalContactGroupChatOnJobTransferResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
}
/// <summary> /// <summary>
/// <para>异步调用 [POST] /cgi-bin/externalcontact/groupchat/list 接口。</para> /// <para>异步调用 [POST] /cgi-bin/externalcontact/groupchat/list 接口。</para>
/// <para>REF: https://developer.work.weixin.qq.com/document/path/92120 </para> /// <para>REF: https://developer.work.weixin.qq.com/document/path/92120 </para>

View File

@@ -0,0 +1,24 @@
using System.Collections.Generic;
namespace SKIT.FlurlHttpClient.Wechat.Work.Models
{
/// <summary>
/// <para>表示 [POST] /cgi-bin/externalcontact/groupchat/onjob_transfer 接口的请求。</para>
/// </summary>
public class CgibinExternalContactGroupChatOnJobTransferRequest : WechatWorkRequest
{
/// <summary>
/// 获取或设置客户群 ID 列表。
/// </summary>
[Newtonsoft.Json.JsonProperty("chat_id_list")]
[System.Text.Json.Serialization.JsonPropertyName("chat_id_list")]
public IList<string> GroupChatIdList { get; set; } = new List<string>();
/// <summary>
/// 获取或设置新群主成员账号。
/// </summary>
[Newtonsoft.Json.JsonProperty("new_owner")]
[System.Text.Json.Serialization.JsonPropertyName("new_owner")]
public string NewOwnerUserId { get; set; } = string.Empty;
}
}

View File

@@ -0,0 +1,22 @@
namespace SKIT.FlurlHttpClient.Wechat.Work.Models
{
/// <summary>
/// <para>表示 [POST] /cgi-bin/externalcontact/groupchat/onjob_transfer 接口的响应。</para>
/// </summary>
public class CgibinExternalContactGroupChatOnJobTransferResponse : WechatWorkResponse
{
public static class Types
{
public class GroupChat : CgibinExternalContactGroupChatTransferResponse.Types.GroupChat
{
}
}
/// <summary>
/// 获取或设置转交失败的客户群列表。
/// </summary>
[Newtonsoft.Json.JsonProperty("failed_chat_list")]
[System.Text.Json.Serialization.JsonPropertyName("failed_chat_list")]
public Types.GroupChat[]? FailedGroupChatList { get; set; }
}
}

View File

@@ -0,0 +1,7 @@
{
"chat_id_list": [
"wrOgQhDgAAcwMTB7YmDkbeBsgT_AAAA",
"wrOgQhDgAAMYQiS5ol9G7gK9JVQUAAAA"
],
"new_owner": "zhangsan"
}

View File

@@ -0,0 +1,11 @@
{
"errcode": 0,
"errmsg": "ok",
"failed_chat_list": [
{
"chat_id": "wrOgQhDgAAcwMTB7YmDkbeBsgT_KAAAA",
"errcode": 90501,
"errmsg": "chat is not external group chat"
}
]
}