From 59fb93b4ae2510626a3611f0dc78b26ff5c288d3 Mon Sep 17 00:00:00 2001 From: Fu Diwei Date: Fri, 20 Aug 2021 12:57:17 +0800 Subject: [PATCH] =?UTF-8?q?feat(work):=20=E6=96=B0=E5=A2=9E=E8=8E=B7?= =?UTF-8?q?=E5=8F=96=E5=AD=A6=E6=A0=A1=E5=BA=94=E7=94=A8=E5=8F=AF=E4=BD=BF?= =?UTF-8?q?=E7=94=A8=E7=9A=84=E5=AE=B6=E9=95=BF=E8=8C=83=E5=9B=B4=E7=9B=B8?= =?UTF-8?q?=E5=85=B3=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...WorkClientExecuteCgibinSchoolExtensions.cs | 22 ++++++++ .../CgibinSchoolAgentGetAllowScopeRequest.cs | 12 +++++ .../CgibinSchoolAgentGetAllowScopeResponse.cs | 51 +++++++++++++++++++ 3 files changed, 85 insertions(+) create mode 100644 src/SKIT.FlurlHttpClient.Wechat.Work/Models/CgibinSchool/Agent/CgibinSchoolAgentGetAllowScopeRequest.cs create mode 100644 src/SKIT.FlurlHttpClient.Wechat.Work/Models/CgibinSchool/Agent/CgibinSchoolAgentGetAllowScopeResponse.cs 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!; + } +}