feat(work): 新增第三方应用获取应用管理员列表接口

This commit is contained in:
Fu Diwei 2024-07-29 12:45:26 +08:00
parent 37e91dad17
commit 46dc783164
4 changed files with 81 additions and 0 deletions

View File

@ -162,6 +162,29 @@ namespace SKIT.FlurlHttpClient.Wechat.Work
return await client.SendFlurlRequestAsJsonAsync<Models.CgibinAgentGetPermissionsResponse>(flurlReq, data: request, cancellationToken: cancellationToken).ConfigureAwait(false);
}
/// <summary>
/// <para>异步调用 [POST] /cgi-bin/agent/get_admin_list 接口。</para>
/// <para>
/// REF: <br/>
/// <![CDATA[ https://developer.work.weixin.qq.com/document/path/100073 ]]>
/// </para>
/// </summary>
/// <param name="client"></param>
/// <param name="request"></param>
/// <param name="cancellationToken"></param>
/// <returns></returns>
public static async Task<Models.CgibinAgentGetAdminListResponse> ExecuteCgibinAgentGetAdminListAsync(this WechatWorkClient client, Models.CgibinAgentGetAdminListRequest 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
.CreateFlurlRequest(request, HttpMethod.Post, "cgi-bin", "agent", "get_admin_list")
.SetQueryParam("access_token", request.AccessToken);
return await client.SendFlurlRequestAsJsonAsync<Models.CgibinAgentGetAdminListResponse>(flurlReq, data: request, cancellationToken: cancellationToken).ConfigureAwait(false);
}
#region Workbench
/// <summary>
/// <para>异步调用 [POST] /cgi-bin/agent/set_workbench_template 接口。</para>

View File

@ -0,0 +1,9 @@
namespace SKIT.FlurlHttpClient.Wechat.Work.Models
{
/// <summary>
/// <para>表示 [POST] /cgi-bin/agent/get_admin_list 接口的请求。</para>
/// </summary>
public class CgibinAgentGetAdminListRequest : WechatWorkRequest
{
}
}

View File

@ -0,0 +1,35 @@
namespace SKIT.FlurlHttpClient.Wechat.Work.Models
{
/// <summary>
/// <para>表示 [POST] /cgi-bin/agent/get_admin_list 接口的响应。</para>
/// </summary>
public class CgibinAgentGetAdminListResponse : WechatWorkResponse
{
public static class Types
{
public class Administrator
{
/// <summary>
/// 获取或设置成员账号。
/// </summary>
[Newtonsoft.Json.JsonProperty("userid")]
[System.Text.Json.Serialization.JsonPropertyName("userid")]
public string UserId { get; set; } = default!;
/// <summary>
/// 获取或设置管理权限。
/// </summary>
[Newtonsoft.Json.JsonProperty("auth_type")]
[System.Text.Json.Serialization.JsonPropertyName("auth_type")]
public int AuthType { get; set; }
}
}
/// <summary>
/// 获取或设置管理员列表。
/// </summary>
[Newtonsoft.Json.JsonProperty("admin")]
[System.Text.Json.Serialization.JsonPropertyName("admin")]
public Types.Administrator[]? AdministratorList { get; set; }
}
}

View File

@ -0,0 +1,14 @@
{
"errcode": 0,
"errmsg": "ok",
"admin": [
{
"userid": "woxxxx",
"auth_type": 1
},
{
"userid": "woxxxx",
"auth_type": 0
}
]
}