mirror of
https://gitee.com/fudiwei/DotNetCore.SKIT.FlurlHttpClient.Wechat.git
synced 2025-07-16 16:50:43 +08:00
feat(work): 新增获取带参的应用二维码相关接口
This commit is contained in:
parent
590d1e010d
commit
abd7265a47
@ -199,11 +199,31 @@ namespace SKIT.FlurlHttpClient.Wechat.Work
|
||||
|
||||
IFlurlRequest flurlReq = client
|
||||
.CreateRequest(request, HttpMethod.Post, "cgi-bin", "service", "get_customized_auth_url")
|
||||
.SetQueryParam("provider_access_token", request.AccessToken);
|
||||
.SetQueryParam("provider_access_token", request.ProviderAccessToken);
|
||||
|
||||
return await client.SendRequestWithJsonAsync<Models.CgibinServiceGetCustomizedAuthUrlResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// <para>异步调用 [POST] /cgi-bin/service/get_app_qrcode 接口。</para>
|
||||
/// <para>REF: https://developer.work.weixin.qq.com/document/path/95430 </para>
|
||||
/// </summary>
|
||||
/// <param name="client"></param>
|
||||
/// <param name="request"></param>
|
||||
/// <param name="cancellationToken"></param>
|
||||
/// <returns></returns>
|
||||
public static async Task<Models.CgibinServiceGetAppQrcodeResponse> ExecuteCgibinServiceGetAppQrcodeAsync(this WechatWorkClient client, Models.CgibinServiceGetAppQrcodeRequest 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_app_qrcode")
|
||||
.SetQueryParam("suite_access_token", request.AccessToken);
|
||||
|
||||
return await client.SendRequestWithJsonAsync<Models.CgibinServiceGetAppQrcodeResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
|
||||
}
|
||||
|
||||
#region Register
|
||||
/// <summary>
|
||||
/// <para>异步调用 [POST] /cgi-bin/service/get_register_code 接口。</para>
|
||||
|
@ -0,0 +1,36 @@
|
||||
namespace SKIT.FlurlHttpClient.Wechat.Work.Models
|
||||
{
|
||||
/// <summary>
|
||||
/// <para>表示 [POST] /cgi-bin/service/get_app_qrcode 接口的请求。</para>
|
||||
/// </summary>
|
||||
public class CgibinServiceGetAppQrcodeRequest : WechatWorkRequest
|
||||
{
|
||||
/// <summary>
|
||||
/// 获取或设置第三方应用 ID。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("appid")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("appid")]
|
||||
public string? AppId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置安装渠道。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("state")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("state")]
|
||||
public string? State { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置二维码样式选项。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("style")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("style")]
|
||||
public int? Style { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置结果返回方式。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("result_type")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("result_type")]
|
||||
public int? ResultType { get; set; }
|
||||
}
|
||||
}
|
@ -0,0 +1,20 @@
|
||||
namespace SKIT.FlurlHttpClient.Wechat.Work.Models
|
||||
{
|
||||
/// <summary>
|
||||
/// <para>表示 [POST] /cgi-bin/service/get_app_qrcode 接口的响应。</para>
|
||||
/// </summary>
|
||||
public class CgibinServiceGetAppQrcodeResponse : WechatWorkResponse
|
||||
{
|
||||
/// <summary>
|
||||
/// 获取或设置二维码 URL。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("qrcode")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("qrcode")]
|
||||
public string? QrcodeUrl { get; set; }
|
||||
|
||||
public override bool IsSuccessful()
|
||||
{
|
||||
return base.IsSuccessful() && RawBytes?.Length > 0;
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,6 @@
|
||||
{
|
||||
"appid": 1,
|
||||
"state": "test",
|
||||
"style": 0,
|
||||
"result_type": 1
|
||||
}
|
@ -0,0 +1,5 @@
|
||||
{
|
||||
"errcode": 0,
|
||||
"errmsg": "ok",
|
||||
"qrcode": "xxxxx"
|
||||
}
|
Loading…
Reference in New Issue
Block a user