feat(work): 新增获取学校应用可使用的家长范围相关接口

This commit is contained in:
Fu Diwei
2021-08-20 12:57:17 +08:00
parent 86147075b3
commit 59fb93b4ae
3 changed files with 85 additions and 0 deletions

View File

@@ -680,5 +680,27 @@ namespace SKIT.FlurlHttpClient.Wechat.Work
return await client.SendRequestWithJsonAsync<Models.CgibinSchoolGetTradeResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
}
#endregion
#region Agent
/// <summary>
/// <para>异步调用 [GET] /cgi-bin/school/agent/get_allow_scope 接口。</para>
/// <para>REF: https://open.work.weixin.qq.com/api/doc/90000/90135/94895 </para>
/// </summary>
/// <param name="client"></param>
/// <param name="request"></param>
/// <param name="cancellationToken"></param>
/// <returns></returns>
public static async Task<Models.CgibinSchoolAgentGetAllowScopeResponse> 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<Models.CgibinSchoolAgentGetAllowScopeResponse>(flurlReq, cancellationToken: cancellationToken);
}
#endregion
}
}

View File

@@ -0,0 +1,12 @@
using System;
using System.Collections.Generic;
namespace SKIT.FlurlHttpClient.Wechat.Work.Models
{
/// <summary>
/// <para>表示 [GET] /cgi-bin/school/agent/get_allow_scope 接口的请求。</para>
/// </summary>
public class CgibinSchoolAgentGetAllowScopeRequest : WechatWorkRequest
{
}
}

View File

@@ -0,0 +1,51 @@
using System;
using System.Collections.Generic;
namespace SKIT.FlurlHttpClient.Wechat.Work.Models
{
/// <summary>
/// <para>表示 [GET] /cgi-bin/school/agent/get_allow_scope 接口的响应。</para>
/// </summary>
public class CgibinSchoolAgentGetAllowScopeResponse : WechatWorkResponse
{
public static class Types
{
public class Scope
{
public static class Types
{
public class Student
{
/// <summary>
/// 获取或设置学生的 UserId。
/// </summary>
[Newtonsoft.Json.JsonProperty("userid")]
[System.Text.Json.Serialization.JsonPropertyName("userid")]
public string UserId { get; set; } = default!;
}
}
/// <summary>
/// 获取或设置可使用的学生列表。
/// </summary>
[Newtonsoft.Json.JsonProperty("students")]
[System.Text.Json.Serialization.JsonPropertyName("students")]
public Types.Student[] StudentList { get; set; } = default!;
/// <summary>
/// 获取或设置可使用的部门 ID 列表。
/// </summary>
[Newtonsoft.Json.JsonProperty("departments")]
[System.Text.Json.Serialization.JsonPropertyName("departments")]
public int[] DepartmentIdList { get; set; } = default!;
}
}
/// <summary>
/// 获取或设置可使用的家长范围信息。
/// </summary>
[Newtonsoft.Json.JsonProperty("allow_scope")]
[System.Text.Json.Serialization.JsonPropertyName("allow_scope")]
public Types.Scope AllowScope { get; set; } = default!;
}
}