feat(work): 新增安全管理高级功能账号相关接口

This commit is contained in:
Fu Diwei 2024-03-13 16:23:58 +08:00
parent 8c0ad7d09e
commit 61af80e17a
24 changed files with 400 additions and 3 deletions

View File

@ -129,4 +129,4 @@ bool ret = (bool)eret;
为了统一并规范化各个模块,我们调整了部分方法的命名参数。如果你在调用该方法时使用了命名实参,请注意修改。
涉及此变化的包括 `DeserializeEventFromJson()`、`DeserializeEventFromXml()`、`SerializeEventToJson`、`SerializeEventToXml`、`VerifyEventSignatureForEcho`、`VerifyEventSignatureFromJson`、`VerifyEventSignatureFromXml` 等扩展方法,及 `AESUtility`、`SHA1Utility`、`HMACUtility` 等工具类。
涉及此变化的包括 `DeserializeEventFromJson()`、`DeserializeEventFromXml()`、`SerializeEventToJson()`、`SerializeEventToXml()`、`VerifyEventSignatureForEcho()`、`VerifyEventSignatureFromJson()`、`VerifyEventSignatureFromXml()` 等扩展方法,及 `AESUtility`、`SHA1Utility`、`HMACUtility` 等工具类。

View File

@ -142,7 +142,7 @@ bool ret = (bool)eret;
为了统一并规范化各个模块,我们调整了部分方法的命名参数。如果你在调用该方法时使用了命名实参,请注意修改。
涉及此变化的包括 `DeserializeEvent()`、`DecryptEventResource()`、`VerifyEventSignature`、`VerifyResponseSignature` 等扩展方法,及 `AESUtility`、`RSAUtility`、`SHA256Utility`、`SM2Utility`、`SM3Utility`、`SM4Utility` 等工具类。
涉及此变化的包括 `DeserializeEvent()`、`DecryptEventResource()`、`VerifyEventSignature()`、`VerifyResponseSignature()` 等扩展方法,及 `AESUtility`、`RSAUtility`、`SHA256Utility`、`SM2Utility`、`SM3Utility`、`SM4Utility` 等工具类。
### 遇到报错:"NotSupportedException: Private key format is not supported."

View File

@ -135,4 +135,4 @@ bool ret = (bool)eret;
为了统一并规范化各个模块,我们调整了部分方法的命名参数。如果你在调用该方法时使用了命名实参,请注意修改。
涉及此变化的包括 `DeserializeEventFromJson()`、`DeserializeEventFromXml()`、`SerializeEventToJson`、`SerializeEventToXml`、`VerifyEventSignatureForEcho`、`VerifyEventSignatureFromJson`、`VerifyEventSignatureFromXml` 等扩展方法,及 `AESUtility`、`RSAUtility`、`SHA1Utility` 等工具类。
涉及此变化的包括 `DeserializeEventFromJson()`、`DeserializeEventFromXml()`、`SerializeEventToJson()`、`SerializeEventToXml()`、`VerifyEventSignatureForEcho()`、`VerifyEventSignatureFromJson()`、`VerifyEventSignatureFromXml()` 等扩展方法,及 `AESUtility`、`RSAUtility`、`SHA1Utility` 等工具类。

View File

@ -31,5 +31,122 @@ namespace SKIT.FlurlHttpClient.Wechat.Work
return await client.SendFlurlRequestAsJsonAsync<Models.CgibinSecurityGetFileOperateRecordResponse>(flurlReq, data: request, cancellationToken: cancellationToken).ConfigureAwait(false);
}
#region Vip
/// <summary>
/// <para>异步调用 [POST] /cgi-bin/security/vip/submit_batch_add_job 接口。</para>
/// <para>
/// REF: <br/>
/// <![CDATA[ https://developer.work.weixin.qq.com/document/path/99503 ]]>
/// </para>
/// </summary>
/// <param name="client"></param>
/// <param name="request"></param>
/// <param name="cancellationToken"></param>
/// <returns></returns>
public static async Task<Models.CgibinSecurityVipSubmitBatchAddJobResponse> ExecuteCgibinSecurityVipSubmitBatchAddJobAsync(this WechatWorkClient client, Models.CgibinSecurityVipSubmitBatchAddJobRequest 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", "security", "vip", "submit_batch_add_job")
.SetQueryParam("access_token", request.AccessToken);
return await client.SendFlurlRequestAsJsonAsync<Models.CgibinSecurityVipSubmitBatchAddJobResponse>(flurlReq, data: request, cancellationToken: cancellationToken).ConfigureAwait(false);
}
/// <summary>
/// <para>异步调用 [POST] /cgi-bin/security/vip/batch_add_job_result 接口。</para>
/// <para>
/// REF: <br/>
/// <![CDATA[ https://developer.work.weixin.qq.com/document/path/99503 ]]>
/// </para>
/// </summary>
/// <param name="client"></param>
/// <param name="request"></param>
/// <param name="cancellationToken"></param>
/// <returns></returns>
public static async Task<Models.CgibinSecurityVipBatchAddJobResultResponse> ExecuteCgibinSecurityVipBatchAddJobResultAsync(this WechatWorkClient client, Models.CgibinSecurityVipBatchAddJobResultRequest 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", "security", "vip", "batch_add_job_result")
.SetQueryParam("access_token", request.AccessToken);
return await client.SendFlurlRequestAsJsonAsync<Models.CgibinSecurityVipBatchAddJobResultResponse>(flurlReq, data: request, cancellationToken: cancellationToken).ConfigureAwait(false);
}
/// <summary>
/// <para>异步调用 [POST] /cgi-bin/security/vip/submit_batch_del_job 接口。</para>
/// <para>
/// REF: <br/>
/// <![CDATA[ https://developer.work.weixin.qq.com/document/path/99505 ]]>
/// </para>
/// </summary>
/// <param name="client"></param>
/// <param name="request"></param>
/// <param name="cancellationToken"></param>
/// <returns></returns>
public static async Task<Models.CgibinSecurityVipSubmitBatchDeleteJobResponse> ExecuteCgibinSecurityVipSubmitBatchDeleteJobAsync(this WechatWorkClient client, Models.CgibinSecurityVipSubmitBatchDeleteJobRequest 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", "security", "vip", "submit_batch_del_job")
.SetQueryParam("access_token", request.AccessToken);
return await client.SendFlurlRequestAsJsonAsync<Models.CgibinSecurityVipSubmitBatchDeleteJobResponse>(flurlReq, data: request, cancellationToken: cancellationToken).ConfigureAwait(false);
}
/// <summary>
/// <para>异步调用 [POST] /cgi-bin/security/vip/batch_del_job_result 接口。</para>
/// <para>
/// REF: <br/>
/// <![CDATA[ https://developer.work.weixin.qq.com/document/path/99505 ]]>
/// </para>
/// </summary>
/// <param name="client"></param>
/// <param name="request"></param>
/// <param name="cancellationToken"></param>
/// <returns></returns>
public static async Task<Models.CgibinSecurityVipBatchDeleteJobResultResponse> ExecuteCgibinSecurityVipBatchDeleteJobResultAsync(this WechatWorkClient client, Models.CgibinSecurityVipBatchDeleteJobResultRequest 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", "security", "vip", "batch_del_job_result")
.SetQueryParam("access_token", request.AccessToken);
return await client.SendFlurlRequestAsJsonAsync<Models.CgibinSecurityVipBatchDeleteJobResultResponse>(flurlReq, data: request, cancellationToken: cancellationToken).ConfigureAwait(false);
}
/// <summary>
/// <para>异步调用 [POST] /cgi-bin/security/vip/list 接口。</para>
/// <para>
/// REF: <br/>
/// <![CDATA[ https://developer.work.weixin.qq.com/document/path/99506 ]]>
/// </para>
/// </summary>
/// <param name="client"></param>
/// <param name="request"></param>
/// <param name="cancellationToken"></param>
/// <returns></returns>
public static async Task<Models.CgibinSecurityVipListResponse> ExecuteCgibinSecurityVipListAsync(this WechatWorkClient client, Models.CgibinSecurityVipListRequest 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", "security", "vip", "list")
.SetQueryParam("access_token", request.AccessToken);
return await client.SendFlurlRequestAsJsonAsync<Models.CgibinSecurityVipListResponse>(flurlReq, data: request, cancellationToken: cancellationToken).ConfigureAwait(false);
}
#endregion
}
}

View File

@ -0,0 +1,15 @@
namespace SKIT.FlurlHttpClient.Wechat.Work.Models
{
/// <summary>
/// <para>表示 [POST] /cgi-bin/security/vip/batch_add_job_result 接口的请求。</para>
/// </summary>
public class CgibinSecurityVipBatchAddJobResultRequest : WechatWorkRequest
{
/// <summary>
/// 获取或设置任务 ID。
/// </summary>
[Newtonsoft.Json.JsonProperty("jobid")]
[System.Text.Json.Serialization.JsonPropertyName("jobid")]
public string JobId { get; set; } = string.Empty;
}
}

View File

@ -0,0 +1,35 @@
namespace SKIT.FlurlHttpClient.Wechat.Work.Models
{
/// <summary>
/// <para>表示 [POST] /cgi-bin/security/vip/batch_add_job_result 接口的响应。</para>
/// </summary>
public class CgibinSecurityVipBatchAddJobResultResponse : WechatWorkResponse
{
public static class Types
{
public class JobResult
{
/// <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; }
}
}
/// <summary>
/// 获取或设置任务结果信息。
/// </summary>
[Newtonsoft.Json.JsonProperty("job_result")]
[System.Text.Json.Serialization.JsonPropertyName("job_result")]
public Types.JobResult JobResult { get; set; } = default!;
}
}

View File

@ -0,0 +1,15 @@
namespace SKIT.FlurlHttpClient.Wechat.Work.Models
{
/// <summary>
/// <para>表示 [POST] /cgi-bin/security/vip/batch_del_job_result 接口的请求。</para>
/// </summary>
public class CgibinSecurityVipBatchDeleteJobResultRequest : WechatWorkRequest
{
/// <summary>
/// 获取或设置任务 ID。
/// </summary>
[Newtonsoft.Json.JsonProperty("jobid")]
[System.Text.Json.Serialization.JsonPropertyName("jobid")]
public string JobId { get; set; } = string.Empty;
}
}

View File

@ -0,0 +1,35 @@
namespace SKIT.FlurlHttpClient.Wechat.Work.Models
{
/// <summary>
/// <para>表示 [POST] /cgi-bin/security/vip/batch_del_job_result 接口的响应。</para>
/// </summary>
public class CgibinSecurityVipBatchDeleteJobResultResponse : WechatWorkResponse
{
public static class Types
{
public class JobResult
{
/// <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; }
}
}
/// <summary>
/// 获取或设置任务结果信息。
/// </summary>
[Newtonsoft.Json.JsonProperty("job_result")]
[System.Text.Json.Serialization.JsonPropertyName("job_result")]
public Types.JobResult JobResult { get; set; } = default!;
}
}

View File

@ -0,0 +1,22 @@
namespace SKIT.FlurlHttpClient.Wechat.Work.Models
{
/// <summary>
/// <para>表示 [POST] /cgi-bin/security/vip/list 接口的请求。</para>
/// </summary>
public class CgibinSecurityVipListRequest : 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/security/vip/list 接口的响应。</para>
/// </summary>
public class CgibinSecurityVipListResponse : 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,17 @@
using System.Collections.Generic;
namespace SKIT.FlurlHttpClient.Wechat.Work.Models
{
/// <summary>
/// <para>表示 [POST] /cgi-bin/security/vip/submit_batch_add_job 接口的请求。</para>
/// </summary>
public class CgibinSecurityVipSubmitBatchAddJobRequest : WechatWorkRequest
{
/// <summary>
/// 获取或设置成员账号列表。
/// </summary>
[Newtonsoft.Json.JsonProperty("userid_list")]
[System.Text.Json.Serialization.JsonPropertyName("userid_list")]
public IList<string>? UserIdList { get; set; }
}
}

View File

@ -0,0 +1,22 @@
namespace SKIT.FlurlHttpClient.Wechat.Work.Models
{
/// <summary>
/// <para>表示 [POST] /cgi-bin/security/vip/submit_batch_add_job 接口的响应。</para>
/// </summary>
public class CgibinSecurityVipSubmitBatchAddJobResponse : WechatWorkResponse
{
/// <summary>
/// 获取或设置任务 ID。
/// </summary>
[Newtonsoft.Json.JsonProperty("jobid")]
[System.Text.Json.Serialization.JsonPropertyName("jobid")]
public string JobId { get; set; } = default!;
/// <summary>
/// 获取或设置无效的成员账号列表。
/// </summary>
[Newtonsoft.Json.JsonProperty("invalid_userid_list")]
[System.Text.Json.Serialization.JsonPropertyName("invalid_userid_list")]
public string[]? InvalidUserIdList { get; set; }
}
}

View File

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

View File

@ -0,0 +1,22 @@
namespace SKIT.FlurlHttpClient.Wechat.Work.Models
{
/// <summary>
/// <para>表示 [POST] /cgi-bin/security/vip/submit_batch_del_job 接口的响应。</para>
/// </summary>
public class CgibinSecurityVipSubmitBatchDeleteJobResponse : WechatWorkResponse
{
/// <summary>
/// 获取或设置任务 ID。
/// </summary>
[Newtonsoft.Json.JsonProperty("jobid")]
[System.Text.Json.Serialization.JsonPropertyName("jobid")]
public string JobId { get; set; } = default!;
/// <summary>
/// 获取或设置成员账号列表。
/// </summary>
[Newtonsoft.Json.JsonProperty("invalid_userid_list")]
[System.Text.Json.Serialization.JsonPropertyName("invalid_userid_list")]
public string[]? InvalidUserIdList { get; set; }
}
}

View File

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

View File

@ -0,0 +1,8 @@
{
"errcode": 0,
"errmsg": "ok",
"job_result": {
"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" ]
}

View File

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

View File

@ -0,0 +1,6 @@
{
"errcode": 0,
"errmsg": "ok",
"jobid": "xxx",
"invalid_userid_list": [ "zhaoliu" ]
}

View File

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

View File

@ -0,0 +1,6 @@
{
"errcode": 0,
"errmsg": "ok",
"jobid": "xxx",
"invalid_userid_list": [ "zhaoliu" ]
}