diff --git a/src/SKIT.FlurlHttpClient.Wechat.Work/Extensions/WechatWorkClientExecuteCgibinSchoolExtensions.cs b/src/SKIT.FlurlHttpClient.Wechat.Work/Extensions/WechatWorkClientExecuteCgibinSchoolExtensions.cs index 315b50ec..1b00a622 100644 --- a/src/SKIT.FlurlHttpClient.Wechat.Work/Extensions/WechatWorkClientExecuteCgibinSchoolExtensions.cs +++ b/src/SKIT.FlurlHttpClient.Wechat.Work/Extensions/WechatWorkClientExecuteCgibinSchoolExtensions.cs @@ -680,5 +680,27 @@ namespace SKIT.FlurlHttpClient.Wechat.Work return await client.SendRequestWithJsonAsync(flurlReq, data: request, cancellationToken: cancellationToken); } #endregion + + #region Agent + /// + /// 异步调用 [GET] /cgi-bin/school/agent/get_allow_scope 接口。 + /// REF: https://open.work.weixin.qq.com/api/doc/90000/90135/94895 + /// + /// + /// + /// + /// + public static async Task ExecuteCgibinSchoolAgentGetAllowScopeAsync(this WechatWorkClient client, Models.CgibinSchoolAgentGetAllowScopeRequest 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.Get, "cgi-bin", "school", "agent", "get_allow_scope") + .SetQueryParam("access_token", request.AccessToken); + + return await client.SendRequestWithJsonAsync(flurlReq, cancellationToken: cancellationToken); + } + #endregion } } diff --git a/src/SKIT.FlurlHttpClient.Wechat.Work/Models/CgibinSchool/Agent/CgibinSchoolAgentGetAllowScopeRequest.cs b/src/SKIT.FlurlHttpClient.Wechat.Work/Models/CgibinSchool/Agent/CgibinSchoolAgentGetAllowScopeRequest.cs new file mode 100644 index 00000000..3a8c31aa --- /dev/null +++ b/src/SKIT.FlurlHttpClient.Wechat.Work/Models/CgibinSchool/Agent/CgibinSchoolAgentGetAllowScopeRequest.cs @@ -0,0 +1,12 @@ +using System; +using System.Collections.Generic; + +namespace SKIT.FlurlHttpClient.Wechat.Work.Models +{ + /// + /// 表示 [GET] /cgi-bin/school/agent/get_allow_scope 接口的请求。 + /// + public class CgibinSchoolAgentGetAllowScopeRequest : WechatWorkRequest + { + } +} diff --git a/src/SKIT.FlurlHttpClient.Wechat.Work/Models/CgibinSchool/Agent/CgibinSchoolAgentGetAllowScopeResponse.cs b/src/SKIT.FlurlHttpClient.Wechat.Work/Models/CgibinSchool/Agent/CgibinSchoolAgentGetAllowScopeResponse.cs new file mode 100644 index 00000000..bb86223f --- /dev/null +++ b/src/SKIT.FlurlHttpClient.Wechat.Work/Models/CgibinSchool/Agent/CgibinSchoolAgentGetAllowScopeResponse.cs @@ -0,0 +1,51 @@ +using System; +using System.Collections.Generic; + +namespace SKIT.FlurlHttpClient.Wechat.Work.Models +{ + /// + /// 表示 [GET] /cgi-bin/school/agent/get_allow_scope 接口的响应。 + /// + public class CgibinSchoolAgentGetAllowScopeResponse : WechatWorkResponse + { + public static class Types + { + public class Scope + { + public static class Types + { + public class Student + { + /// + /// 获取或设置学生的 UserId。 + /// + [Newtonsoft.Json.JsonProperty("userid")] + [System.Text.Json.Serialization.JsonPropertyName("userid")] + public string UserId { get; set; } = default!; + } + } + + /// + /// 获取或设置可使用的学生列表。 + /// + [Newtonsoft.Json.JsonProperty("students")] + [System.Text.Json.Serialization.JsonPropertyName("students")] + public Types.Student[] StudentList { get; set; } = default!; + + /// + /// 获取或设置可使用的部门 ID 列表。 + /// + [Newtonsoft.Json.JsonProperty("departments")] + [System.Text.Json.Serialization.JsonPropertyName("departments")] + public int[] DepartmentIdList { get; set; } = default!; + } + } + + /// + /// 获取或设置可使用的家长范围信息。 + /// + [Newtonsoft.Json.JsonProperty("allow_scope")] + [System.Text.Json.Serialization.JsonPropertyName("allow_scope")] + public Types.Scope AllowScope { get; set; } = default!; + } +}