mirror of
https://gitee.com/fudiwei/DotNetCore.SKIT.FlurlHttpClient.Wechat.git
synced 2025-04-05 17:37:54 +08:00
feat(work): 新增获取带参授权链接相关接口
This commit is contained in:
parent
4e649a7d49
commit
5afc4289fe
@ -184,6 +184,26 @@ namespace SKIT.FlurlHttpClient.Wechat.Work
|
||||
return await client.SendRequestWithJsonAsync<Models.CgibinServiceGetAdminListResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// <para>异步调用 [POST] /cgi-bin/service/get_customized_auth_url 接口。</para>
|
||||
/// <para>REF: https://developer.work.weixin.qq.com/document/path/95436 </para>
|
||||
/// </summary>
|
||||
/// <param name="client"></param>
|
||||
/// <param name="request"></param>
|
||||
/// <param name="cancellationToken"></param>
|
||||
/// <returns></returns>
|
||||
public static async Task<Models.CgibinServiceGetCustomizedAuthUrlResponse> ExecuteCgibinServiceGetCustomizedAuthUrlAsync(this WechatWorkClient client, Models.CgibinServiceGetCustomizedAuthUrlRequest 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.Post, "cgi-bin", "service", "get_customized_auth_url")
|
||||
.SetQueryParam("provider_access_token", request.AccessToken);
|
||||
|
||||
return await client.SendRequestWithJsonAsync<Models.CgibinServiceGetCustomizedAuthUrlResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
|
||||
}
|
||||
|
||||
#region Register
|
||||
/// <summary>
|
||||
/// <para>异步调用 [POST] /cgi-bin/service/get_register_code 接口。</para>
|
||||
|
@ -0,0 +1,31 @@
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace SKIT.FlurlHttpClient.Wechat.Work.Models
|
||||
{
|
||||
/// <summary>
|
||||
/// <para>表示 [POST] /cgi-bin/service/get_customized_auth_url 接口的请求。</para>
|
||||
/// </summary>
|
||||
public class CgibinServiceGetCustomizedAuthUrlRequest : WechatWorkRequest
|
||||
{
|
||||
/// <summary>
|
||||
/// 获取或设置服务商 AccessToken。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonIgnore]
|
||||
[System.Text.Json.Serialization.JsonIgnore]
|
||||
public string ProviderAccessToken { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置自定义参数。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("state")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("state")]
|
||||
public string State { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置代开发自建应用模版 ID 列表。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("templateid_list")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("templateid_list")]
|
||||
public IList<string> PermanentAuthCode { get; set; } = new List<string>();
|
||||
}
|
||||
}
|
@ -0,0 +1,22 @@
|
||||
namespace SKIT.FlurlHttpClient.Wechat.Work.Models
|
||||
{
|
||||
/// <summary>
|
||||
/// <para>表示 [POST] /cgi-bin/service/get_customized_auth_url 接口的响应。</para>
|
||||
/// </summary>
|
||||
public class CgibinServiceGetCustomizedAuthUrlResponse : WechatWorkResponse
|
||||
{
|
||||
/// <summary>
|
||||
/// 获取或设置二维码 URL。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("qrcode_url")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("qrcode_url")]
|
||||
public string QrcodeUrl { get; set; } = default!;
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置二维码有效期(单位:秒)。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("expires_in")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("expires_in")]
|
||||
public int ExpiresIn { get; set; }
|
||||
}
|
||||
}
|
@ -136,5 +136,12 @@
|
||||
[Newtonsoft.Json.JsonProperty("register_code_info")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("register_code_info")]
|
||||
public Types.Register? Register { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置扫码或者授权链接中的自定义参数。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("state")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("state")]
|
||||
public string? State { get; set; }
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,4 @@
|
||||
{
|
||||
"state": "test",
|
||||
"templateid_list": [ "dk1", "dk2" ]
|
||||
}
|
@ -0,0 +1,4 @@
|
||||
{
|
||||
"state": "test",
|
||||
"templateid_list": [ "dk1", "dk2" ]
|
||||
}
|
Loading…
Reference in New Issue
Block a user