diff --git a/src/SKIT.FlurlHttpClient.Wechat.Work/Extensions/WechatWorkClientExecuteCgibinWedriveExtensions.cs b/src/SKIT.FlurlHttpClient.Wechat.Work/Extensions/WechatWorkClientExecuteCgibinWedriveExtensions.cs index bc7ebd54..15b693cc 100644 --- a/src/SKIT.FlurlHttpClient.Wechat.Work/Extensions/WechatWorkClientExecuteCgibinWedriveExtensions.cs +++ b/src/SKIT.FlurlHttpClient.Wechat.Work/Extensions/WechatWorkClientExecuteCgibinWedriveExtensions.cs @@ -578,5 +578,67 @@ namespace SKIT.FlurlHttpClient.Wechat.Work return await client.SendRequestWithJsonAsync(flurlReq, data: request, cancellationToken: cancellationToken); } #endregion + + #region Vip + /// + /// 异步调用 [POST] /cgi-bin/wedrive/vip/batch_add 接口。 + /// REF: https://developer.work.weixin.qq.com/document/path/99512 + /// + /// + /// + /// + /// + public static async Task 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(flurlReq, data: request, cancellationToken: cancellationToken); + } + + /// + /// 异步调用 [POST] /cgi-bin/wedrive/vip/batch_del 接口。 + /// REF: https://developer.work.weixin.qq.com/document/path/99513 + /// + /// + /// + /// + /// + public static async Task 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(flurlReq, data: request, cancellationToken: cancellationToken); + } + + /// + /// 异步调用 [POST] /cgi-bin/wedrive/vip/list 接口。 + /// REF: https://developer.work.weixin.qq.com/document/path/99514 + /// + /// + /// + /// + /// + public static async Task 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(flurlReq, data: request, cancellationToken: cancellationToken); + } + #endregion } } diff --git a/src/SKIT.FlurlHttpClient.Wechat.Work/Models/CgibinWedrive/Vip/CgibinWedriveVipBatchAddRequest.cs b/src/SKIT.FlurlHttpClient.Wechat.Work/Models/CgibinWedrive/Vip/CgibinWedriveVipBatchAddRequest.cs new file mode 100644 index 00000000..603e4278 --- /dev/null +++ b/src/SKIT.FlurlHttpClient.Wechat.Work/Models/CgibinWedrive/Vip/CgibinWedriveVipBatchAddRequest.cs @@ -0,0 +1,17 @@ +using System.Collections.Generic; + +namespace SKIT.FlurlHttpClient.Wechat.Work.Models +{ + /// + /// 表示 [POST] /cgi-bin/wedrive/vip/batch_add 接口的请求。 + /// + public class CgibinWedriveVipBatchAddRequest : WechatWorkRequest + { + /// + /// 获取或设置成员账号列表。 + /// + [Newtonsoft.Json.JsonProperty("userid_list")] + [System.Text.Json.Serialization.JsonPropertyName("userid_list")] + public IList UserIdList { get; set; } = new List(); + } +} diff --git a/src/SKIT.FlurlHttpClient.Wechat.Work/Models/CgibinWedrive/Vip/CgibinWedriveVipBatchAddResponse.cs b/src/SKIT.FlurlHttpClient.Wechat.Work/Models/CgibinWedrive/Vip/CgibinWedriveVipBatchAddResponse.cs new file mode 100644 index 00000000..ac680533 --- /dev/null +++ b/src/SKIT.FlurlHttpClient.Wechat.Work/Models/CgibinWedrive/Vip/CgibinWedriveVipBatchAddResponse.cs @@ -0,0 +1,22 @@ +namespace SKIT.FlurlHttpClient.Wechat.Work.Models +{ + /// + /// 表示 [POST] /cgi-bin/wedrive/vip/batch_add 接口的响应。 + /// + public class CgibinWedriveVipBatchAddResponse : WechatWorkResponse + { + /// + /// 获取或设置分配成功的成员账号列表。 + /// + [Newtonsoft.Json.JsonProperty("succ_userid_list")] + [System.Text.Json.Serialization.JsonPropertyName("succ_userid_list")] + public string[]? SuccessfulUserIdList { get; set; } + + /// + /// 获取或设置分配失败的成员账号列表。 + /// + [Newtonsoft.Json.JsonProperty("fail_userid_list")] + [System.Text.Json.Serialization.JsonPropertyName("fail_userid_list")] + public string[]? FailedUserIdList { get; set; } + } +} diff --git a/src/SKIT.FlurlHttpClient.Wechat.Work/Models/CgibinWedrive/Vip/CgibinWedriveVipBatchDeleteRequest.cs b/src/SKIT.FlurlHttpClient.Wechat.Work/Models/CgibinWedrive/Vip/CgibinWedriveVipBatchDeleteRequest.cs new file mode 100644 index 00000000..efe90a2e --- /dev/null +++ b/src/SKIT.FlurlHttpClient.Wechat.Work/Models/CgibinWedrive/Vip/CgibinWedriveVipBatchDeleteRequest.cs @@ -0,0 +1,17 @@ +using System.Collections.Generic; + +namespace SKIT.FlurlHttpClient.Wechat.Work.Models +{ + /// + /// 表示 [POST] /cgi-bin/wedrive/vip/batch_del 接口的请求。 + /// + public class CgibinWedriveVipBatchDeleteRequest : WechatWorkRequest + { + /// + /// 获取或设置成员账号列表。 + /// + [Newtonsoft.Json.JsonProperty("userid_list")] + [System.Text.Json.Serialization.JsonPropertyName("userid_list")] + public IList UserIdList { get; set; } = new List(); + } +} diff --git a/src/SKIT.FlurlHttpClient.Wechat.Work/Models/CgibinWedrive/Vip/CgibinWedriveVipBatchDeleteResponse.cs b/src/SKIT.FlurlHttpClient.Wechat.Work/Models/CgibinWedrive/Vip/CgibinWedriveVipBatchDeleteResponse.cs new file mode 100644 index 00000000..595ab561 --- /dev/null +++ b/src/SKIT.FlurlHttpClient.Wechat.Work/Models/CgibinWedrive/Vip/CgibinWedriveVipBatchDeleteResponse.cs @@ -0,0 +1,22 @@ +namespace SKIT.FlurlHttpClient.Wechat.Work.Models +{ + /// + /// 表示 [POST] /cgi-bin/wedrive/vip/batch_del 接口的响应。 + /// + public class CgibinWedriveVipBatchDeleteResponse : WechatWorkResponse + { + /// + /// 获取或设置撤销分配成功的成员账号列表。 + /// + [Newtonsoft.Json.JsonProperty("succ_userid_list")] + [System.Text.Json.Serialization.JsonPropertyName("succ_userid_list")] + public string[]? SuccessfulUserIdList { get; set; } + + /// + /// 获取或设置撤销分配失败的成员账号列表。 + /// + [Newtonsoft.Json.JsonProperty("fail_userid_list")] + [System.Text.Json.Serialization.JsonPropertyName("fail_userid_list")] + public string[]? FailedUserIdList { get; set; } + } +} diff --git a/src/SKIT.FlurlHttpClient.Wechat.Work/Models/CgibinWedrive/Vip/CgibinWedriveVipListRequest.cs b/src/SKIT.FlurlHttpClient.Wechat.Work/Models/CgibinWedrive/Vip/CgibinWedriveVipListRequest.cs new file mode 100644 index 00000000..dbc9a487 --- /dev/null +++ b/src/SKIT.FlurlHttpClient.Wechat.Work/Models/CgibinWedrive/Vip/CgibinWedriveVipListRequest.cs @@ -0,0 +1,22 @@ +namespace SKIT.FlurlHttpClient.Wechat.Work.Models +{ + /// + /// 表示 [POST] /cgi-bin/wedrive/vip/list 接口的请求。 + /// + public class CgibinWedriveVipListRequest : WechatWorkRequest + { + /// + /// 获取或设置分页每页数量。 + /// + [Newtonsoft.Json.JsonProperty("limit")] + [System.Text.Json.Serialization.JsonPropertyName("limit")] + public int? Limit { get; set; } + + /// + /// 获取或设置翻页标记。 + /// + [Newtonsoft.Json.JsonProperty("cursor")] + [System.Text.Json.Serialization.JsonPropertyName("cursor")] + public string? Cursor { get; set; } + } +} diff --git a/src/SKIT.FlurlHttpClient.Wechat.Work/Models/CgibinWedrive/Vip/CgibinWedriveVipListResponse.cs b/src/SKIT.FlurlHttpClient.Wechat.Work/Models/CgibinWedrive/Vip/CgibinWedriveVipListResponse.cs new file mode 100644 index 00000000..0d1e6b6b --- /dev/null +++ b/src/SKIT.FlurlHttpClient.Wechat.Work/Models/CgibinWedrive/Vip/CgibinWedriveVipListResponse.cs @@ -0,0 +1,29 @@ +namespace SKIT.FlurlHttpClient.Wechat.Work.Models +{ + /// + /// 表示 [POST] /cgi-bin/wedrive/vip/list 接口的响应。 + /// + public class CgibinWedriveVipListResponse : WechatWorkResponse + { + /// + /// 获取或设置成员账号列表。 + /// + [Newtonsoft.Json.JsonProperty("userid_list")] + [System.Text.Json.Serialization.JsonPropertyName("userid_list")] + public string[] UserIdList { get; set; } = default!; + + /// + /// 获取或设置是否还有更多数据。 + /// + [Newtonsoft.Json.JsonProperty("has_more")] + [System.Text.Json.Serialization.JsonPropertyName("has_more")] + public bool HasMore { get; set; } + + /// + /// 获取或设置翻页标记。 + /// + [Newtonsoft.Json.JsonProperty("next_cursor")] + [System.Text.Json.Serialization.JsonPropertyName("next_cursor")] + public string? NextCursor { get; set; } + } +} diff --git a/test/SKIT.FlurlHttpClient.Wechat.Work.UnitTests/ModelSamples/CgibinWedrive/Vip/CgibinWedriveVipBatchAddRequest.json b/test/SKIT.FlurlHttpClient.Wechat.Work.UnitTests/ModelSamples/CgibinWedrive/Vip/CgibinWedriveVipBatchAddRequest.json new file mode 100644 index 00000000..52aeeaf6 --- /dev/null +++ b/test/SKIT.FlurlHttpClient.Wechat.Work.UnitTests/ModelSamples/CgibinWedrive/Vip/CgibinWedriveVipBatchAddRequest.json @@ -0,0 +1,3 @@ +{ + "userid_list": [ "zhangsan", "lisi", "wangwu" ] +} diff --git a/test/SKIT.FlurlHttpClient.Wechat.Work.UnitTests/ModelSamples/CgibinWedrive/Vip/CgibinWedriveVipBatchAddResponse.json b/test/SKIT.FlurlHttpClient.Wechat.Work.UnitTests/ModelSamples/CgibinWedrive/Vip/CgibinWedriveVipBatchAddResponse.json new file mode 100644 index 00000000..e57127d7 --- /dev/null +++ b/test/SKIT.FlurlHttpClient.Wechat.Work.UnitTests/ModelSamples/CgibinWedrive/Vip/CgibinWedriveVipBatchAddResponse.json @@ -0,0 +1,6 @@ +{ + "errcode": 0, + "errmsg": "ok", + "succ_userid_list": [ "zhangsan", "lisi" ], + "fail_userid_list": [ "wangwu" ] +} diff --git a/test/SKIT.FlurlHttpClient.Wechat.Work.UnitTests/ModelSamples/CgibinWedrive/Vip/CgibinWedriveVipBatchDeleteRequest.json b/test/SKIT.FlurlHttpClient.Wechat.Work.UnitTests/ModelSamples/CgibinWedrive/Vip/CgibinWedriveVipBatchDeleteRequest.json new file mode 100644 index 00000000..52aeeaf6 --- /dev/null +++ b/test/SKIT.FlurlHttpClient.Wechat.Work.UnitTests/ModelSamples/CgibinWedrive/Vip/CgibinWedriveVipBatchDeleteRequest.json @@ -0,0 +1,3 @@ +{ + "userid_list": [ "zhangsan", "lisi", "wangwu" ] +} diff --git a/test/SKIT.FlurlHttpClient.Wechat.Work.UnitTests/ModelSamples/CgibinWedrive/Vip/CgibinWedriveVipBatchDeleteResponse.json b/test/SKIT.FlurlHttpClient.Wechat.Work.UnitTests/ModelSamples/CgibinWedrive/Vip/CgibinWedriveVipBatchDeleteResponse.json new file mode 100644 index 00000000..e57127d7 --- /dev/null +++ b/test/SKIT.FlurlHttpClient.Wechat.Work.UnitTests/ModelSamples/CgibinWedrive/Vip/CgibinWedriveVipBatchDeleteResponse.json @@ -0,0 +1,6 @@ +{ + "errcode": 0, + "errmsg": "ok", + "succ_userid_list": [ "zhangsan", "lisi" ], + "fail_userid_list": [ "wangwu" ] +} diff --git a/test/SKIT.FlurlHttpClient.Wechat.Work.UnitTests/ModelSamples/CgibinWedrive/Vip/CgibinWedriveVipListRequest.json b/test/SKIT.FlurlHttpClient.Wechat.Work.UnitTests/ModelSamples/CgibinWedrive/Vip/CgibinWedriveVipListRequest.json new file mode 100644 index 00000000..36e6e636 --- /dev/null +++ b/test/SKIT.FlurlHttpClient.Wechat.Work.UnitTests/ModelSamples/CgibinWedrive/Vip/CgibinWedriveVipListRequest.json @@ -0,0 +1,4 @@ +{ + "cursor": "CURSOR", + "limit": 2 +} diff --git a/test/SKIT.FlurlHttpClient.Wechat.Work.UnitTests/ModelSamples/CgibinWedrive/Vip/CgibinWedriveVipListResponse.json b/test/SKIT.FlurlHttpClient.Wechat.Work.UnitTests/ModelSamples/CgibinWedrive/Vip/CgibinWedriveVipListResponse.json new file mode 100644 index 00000000..61cade4d --- /dev/null +++ b/test/SKIT.FlurlHttpClient.Wechat.Work.UnitTests/ModelSamples/CgibinWedrive/Vip/CgibinWedriveVipListResponse.json @@ -0,0 +1,7 @@ +{ + "errcode": 0, + "errmsg": "ok", + "has_more": true, + "next_cursor": "GNIJIGEO", + "userid_list": [ "zhangsan", "lisi" ] +}