mirror of
https://gitee.com/fudiwei/DotNetCore.SKIT.FlurlHttpClient.Wechat.git
synced 2025-07-15 23:13:32 +08:00
feat(work): 新增获取家校访问用户身份接口
This commit is contained in:
parent
206fce50e5
commit
fea1c8061e
@ -91,6 +91,27 @@ namespace SKIT.FlurlHttpClient.Wechat.Work
|
||||
return await client.SendRequestWithJsonAsync<Models.CgibinSchoolSetUpgradeInfoResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// <para>异步调用 [GET] /cgi-bin/school/getuserinfo 接口。</para>
|
||||
/// <para>REF: https://developer.work.weixin.qq.com/document/path/95791 </para>
|
||||
/// </summary>
|
||||
/// <param name="client"></param>
|
||||
/// <param name="request"></param>
|
||||
/// <param name="cancellationToken"></param>
|
||||
/// <returns></returns>
|
||||
public static async Task<Models.CgibinSchoolGetUserInfoResponse> ExecuteCgibinSchoolGetUserInfoAsync(this WechatWorkClient client, Models.CgibinSchoolGetUserInfoRequest 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", "getuserinfo")
|
||||
.SetQueryParam("access_token", request.AccessToken)
|
||||
.SetQueryParam("code", request.Code);
|
||||
|
||||
return await client.SendRequestWithJsonAsync<Models.CgibinSchoolGetUserInfoResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
|
||||
}
|
||||
|
||||
#region User
|
||||
/// <summary>
|
||||
/// <para>异步调用 [GET] /cgi-bin/school/user/get 接口。</para>
|
||||
|
@ -0,0 +1,15 @@
|
||||
namespace SKIT.FlurlHttpClient.Wechat.Work.Models
|
||||
{
|
||||
/// <summary>
|
||||
/// <para>表示 [GET] /cgi-bin/school/getuserinfo 接口的请求。</para>
|
||||
/// </summary>
|
||||
public class CgibinSchoolGetUserInfoRequest : WechatWorkRequest
|
||||
{
|
||||
/// <summary>
|
||||
/// 获取或设置成员授权码。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonIgnore]
|
||||
[System.Text.Json.Serialization.JsonIgnore]
|
||||
public string Code { get; set; } = string.Empty;
|
||||
}
|
||||
}
|
@ -0,0 +1,29 @@
|
||||
namespace SKIT.FlurlHttpClient.Wechat.Work.Models
|
||||
{
|
||||
/// <summary>
|
||||
/// <para>表示 [GET] /cgi-bin/school/getuserinfo 接口的响应。</para>
|
||||
/// </summary>
|
||||
public class CgibinSchoolGetUserInfoResponse : WechatWorkResponse
|
||||
{
|
||||
/// <summary>
|
||||
/// 获取或设置手机设备号。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("DeviceId")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("DeviceId")]
|
||||
public string? DeviceId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置家长账号。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("parent_userid")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("parent_userid")]
|
||||
public string? ParentUserId{ get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置学生账号。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("student_userid")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("student_userid")]
|
||||
public string? StudentUserId{ get; set; }
|
||||
}
|
||||
}
|
@ -0,0 +1,7 @@
|
||||
{
|
||||
"errcode": 0,
|
||||
"errmsg": "ok",
|
||||
"DeviceId": "DEVICEID",
|
||||
"parent_userid": "parent_userid",
|
||||
"student_userid": "student_userid"
|
||||
}
|
Loading…
Reference in New Issue
Block a user