feat(work): 新增微盘高级功能账号相关接口

This commit is contained in:
Fu Diwei 2024-01-03 14:46:06 +08:00
parent 867d552eec
commit 57fba8f55a
13 changed files with 220 additions and 0 deletions

View File

@ -578,5 +578,67 @@ namespace SKIT.FlurlHttpClient.Wechat.Work
return await client.SendRequestWithJsonAsync<Models.CgibinWedriveManageCapacityResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
}
#endregion
#region Vip
/// <summary>
/// <para>异步调用 [POST] /cgi-bin/wedrive/vip/batch_add 接口。</para>
/// <para>REF: https://developer.work.weixin.qq.com/document/path/99512 </para>
/// </summary>
/// <param name="client"></param>
/// <param name="request"></param>
/// <param name="cancellationToken"></param>
/// <returns></returns>
public static async Task<Models.CgibinWedriveVipBatchAddResponse> ExecuteCgibinWedriveVipBatchAddAsync(this WechatWorkClient client, Models.CgibinWedriveVipBatchAddRequest 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", "wedrive", "vip", "batch_add")
.SetQueryParam("access_token", request.AccessToken);
return await client.SendRequestWithJsonAsync<Models.CgibinWedriveVipBatchAddResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
}
/// <summary>
/// <para>异步调用 [POST] /cgi-bin/wedrive/vip/batch_del 接口。</para>
/// <para>REF: https://developer.work.weixin.qq.com/document/path/99513 </para>
/// </summary>
/// <param name="client"></param>
/// <param name="request"></param>
/// <param name="cancellationToken"></param>
/// <returns></returns>
public static async Task<Models.CgibinWedriveVipBatchDeleteResponse> ExecuteCgibinWedriveVipBatchDeleteAsync(this WechatWorkClient client, Models.CgibinWedriveVipBatchDeleteRequest 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", "wedrive", "vip", "batch_del")
.SetQueryParam("access_token", request.AccessToken);
return await client.SendRequestWithJsonAsync<Models.CgibinWedriveVipBatchDeleteResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
}
/// <summary>
/// <para>异步调用 [POST] /cgi-bin/wedrive/vip/list 接口。</para>
/// <para>REF: https://developer.work.weixin.qq.com/document/path/99514 </para>
/// </summary>
/// <param name="client"></param>
/// <param name="request"></param>
/// <param name="cancellationToken"></param>
/// <returns></returns>
public static async Task<Models.CgibinWedriveVipListResponse> ExecuteCgibinWedriveVipListAsync(this WechatWorkClient client, Models.CgibinWedriveVipListRequest 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", "wedrive", "vip", "list")
.SetQueryParam("access_token", request.AccessToken);
return await client.SendRequestWithJsonAsync<Models.CgibinWedriveVipListResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
}
#endregion
}
}

View File

@ -0,0 +1,17 @@
using System.Collections.Generic;
namespace SKIT.FlurlHttpClient.Wechat.Work.Models
{
/// <summary>
/// <para>表示 [POST] /cgi-bin/wedrive/vip/batch_add 接口的请求。</para>
/// </summary>
public class CgibinWedriveVipBatchAddRequest : WechatWorkRequest
{
/// <summary>
/// 获取或设置成员账号列表。
/// </summary>
[Newtonsoft.Json.JsonProperty("userid_list")]
[System.Text.Json.Serialization.JsonPropertyName("userid_list")]
public IList<string> UserIdList { get; set; } = new List<string>();
}
}

View File

@ -0,0 +1,22 @@
namespace SKIT.FlurlHttpClient.Wechat.Work.Models
{
/// <summary>
/// <para>表示 [POST] /cgi-bin/wedrive/vip/batch_add 接口的响应。</para>
/// </summary>
public class CgibinWedriveVipBatchAddResponse : WechatWorkResponse
{
/// <summary>
/// 获取或设置分配成功的成员账号列表。
/// </summary>
[Newtonsoft.Json.JsonProperty("succ_userid_list")]
[System.Text.Json.Serialization.JsonPropertyName("succ_userid_list")]
public string[]? SuccessfulUserIdList { get; set; }
/// <summary>
/// 获取或设置分配失败的成员账号列表。
/// </summary>
[Newtonsoft.Json.JsonProperty("fail_userid_list")]
[System.Text.Json.Serialization.JsonPropertyName("fail_userid_list")]
public string[]? FailedUserIdList { get; set; }
}
}

View File

@ -0,0 +1,17 @@
using System.Collections.Generic;
namespace SKIT.FlurlHttpClient.Wechat.Work.Models
{
/// <summary>
/// <para>表示 [POST] /cgi-bin/wedrive/vip/batch_del 接口的请求。</para>
/// </summary>
public class CgibinWedriveVipBatchDeleteRequest : WechatWorkRequest
{
/// <summary>
/// 获取或设置成员账号列表。
/// </summary>
[Newtonsoft.Json.JsonProperty("userid_list")]
[System.Text.Json.Serialization.JsonPropertyName("userid_list")]
public IList<string> UserIdList { get; set; } = new List<string>();
}
}

View File

@ -0,0 +1,22 @@
namespace SKIT.FlurlHttpClient.Wechat.Work.Models
{
/// <summary>
/// <para>表示 [POST] /cgi-bin/wedrive/vip/batch_del 接口的响应。</para>
/// </summary>
public class CgibinWedriveVipBatchDeleteResponse : WechatWorkResponse
{
/// <summary>
/// 获取或设置撤销分配成功的成员账号列表。
/// </summary>
[Newtonsoft.Json.JsonProperty("succ_userid_list")]
[System.Text.Json.Serialization.JsonPropertyName("succ_userid_list")]
public string[]? SuccessfulUserIdList { get; set; }
/// <summary>
/// 获取或设置撤销分配失败的成员账号列表。
/// </summary>
[Newtonsoft.Json.JsonProperty("fail_userid_list")]
[System.Text.Json.Serialization.JsonPropertyName("fail_userid_list")]
public string[]? FailedUserIdList { get; set; }
}
}

View File

@ -0,0 +1,22 @@
namespace SKIT.FlurlHttpClient.Wechat.Work.Models
{
/// <summary>
/// <para>表示 [POST] /cgi-bin/wedrive/vip/list 接口的请求。</para>
/// </summary>
public class CgibinWedriveVipListRequest : WechatWorkRequest
{
/// <summary>
/// 获取或设置分页每页数量。
/// </summary>
[Newtonsoft.Json.JsonProperty("limit")]
[System.Text.Json.Serialization.JsonPropertyName("limit")]
public int? Limit { get; set; }
/// <summary>
/// 获取或设置翻页标记。
/// </summary>
[Newtonsoft.Json.JsonProperty("cursor")]
[System.Text.Json.Serialization.JsonPropertyName("cursor")]
public string? Cursor { get; set; }
}
}

View File

@ -0,0 +1,29 @@
namespace SKIT.FlurlHttpClient.Wechat.Work.Models
{
/// <summary>
/// <para>表示 [POST] /cgi-bin/wedrive/vip/list 接口的响应。</para>
/// </summary>
public class CgibinWedriveVipListResponse : WechatWorkResponse
{
/// <summary>
/// 获取或设置成员账号列表。
/// </summary>
[Newtonsoft.Json.JsonProperty("userid_list")]
[System.Text.Json.Serialization.JsonPropertyName("userid_list")]
public string[] UserIdList { get; set; } = default!;
/// <summary>
/// 获取或设置是否还有更多数据。
/// </summary>
[Newtonsoft.Json.JsonProperty("has_more")]
[System.Text.Json.Serialization.JsonPropertyName("has_more")]
public bool HasMore { get; set; }
/// <summary>
/// 获取或设置翻页标记。
/// </summary>
[Newtonsoft.Json.JsonProperty("next_cursor")]
[System.Text.Json.Serialization.JsonPropertyName("next_cursor")]
public string? NextCursor { get; set; }
}
}

View File

@ -0,0 +1,3 @@
{
"userid_list": [ "zhangsan", "lisi", "wangwu" ]
}

View File

@ -0,0 +1,6 @@
{
"errcode": 0,
"errmsg": "ok",
"succ_userid_list": [ "zhangsan", "lisi" ],
"fail_userid_list": [ "wangwu" ]
}

View File

@ -0,0 +1,3 @@
{
"userid_list": [ "zhangsan", "lisi", "wangwu" ]
}

View File

@ -0,0 +1,6 @@
{
"errcode": 0,
"errmsg": "ok",
"succ_userid_list": [ "zhangsan", "lisi" ],
"fail_userid_list": [ "wangwu" ]
}

View File

@ -0,0 +1,4 @@
{
"cursor": "CURSOR",
"limit": 2
}

View File

@ -0,0 +1,7 @@
{
"errcode": 0,
"errmsg": "ok",
"has_more": true,
"next_cursor": "GNIJIGEO",
"userid_list": [ "zhangsan", "lisi" ]
}