mirror of
https://gitee.com/fudiwei/DotNetCore.SKIT.FlurlHttpClient.Wechat.git
synced 2025-07-15 23:13:32 +08:00
feat(wxapi): 新增获取 NFC 的小程序 scheme 接口
This commit is contained in:
parent
227ff321b7
commit
067cae1618
@ -1,4 +1,4 @@
|
||||
using System;
|
||||
using System;
|
||||
using System.Net.Http;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
@ -324,6 +324,27 @@ namespace SKIT.FlurlHttpClient.Wechat.Api
|
||||
|
||||
return await client.SendRequestWithJsonAsync<Models.WxaQuerySchemeResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// <para>异步调用 [POST] /wxa/generatenfcscheme 接口。</para>
|
||||
/// <para>REF: https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/url-scheme/urlscheme.generateNFC.html </para>
|
||||
/// <para>REF: https://developers.weixin.qq.com/minigame/dev/api-backend/open-api/url-scheme/urlscheme.generateNFC.html </para>
|
||||
/// </summary>
|
||||
/// <param name="client"></param>
|
||||
/// <param name="request"></param>
|
||||
/// <param name="cancellationToken"></param>
|
||||
/// <returns></returns>
|
||||
public static async Task<Models.WxaGenerateNFCSchemeResponse> ExecuteWxaGenerateNFCSchemeAsync(this WechatApiClient client, Models.WxaGenerateNFCSchemeRequest 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, "wxa", "generatenfcscheme")
|
||||
.SetQueryParam("access_token", request.AccessToken);
|
||||
|
||||
return await client.SendRequestWithJsonAsync<Models.WxaGenerateNFCSchemeResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region UrlLink
|
||||
|
@ -0,0 +1,36 @@
|
||||
namespace SKIT.FlurlHttpClient.Wechat.Api.Models
|
||||
{
|
||||
/// <summary>
|
||||
/// <para>表示 [POST] /wxa/generatenfcscheme 接口的请求。</para>
|
||||
/// </summary>
|
||||
public class WxaGenerateNFCSchemeRequest : WechatApiRequest, IInferable<WxaGenerateNFCSchemeRequest, WxaGenerateNFCSchemeResponse>
|
||||
{
|
||||
public static class Types
|
||||
{
|
||||
public class MiniProgram : WxaGenerateSchemeRequest.Types.MiniProgram
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置跳转到的目标小程序信息。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("jump_wxa")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("jump_wxa")]
|
||||
public Types.MiniProgram MiniProgram { get; set; } = new Types.MiniProgram();
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置设备 ID。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("model_id")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("model_id")]
|
||||
public string ModelId { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置设备序列号。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("sn")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("sn")]
|
||||
public string? SerialNumber { get; set; }
|
||||
}
|
||||
}
|
@ -0,0 +1,15 @@
|
||||
namespace SKIT.FlurlHttpClient.Wechat.Api.Models
|
||||
{
|
||||
/// <summary>
|
||||
/// <para>表示 [POST] /wxa/generatenfcscheme 接口的响应。</para>
|
||||
/// </summary>
|
||||
public class WxaGenerateNFCSchemeResponse : WechatApiResponse
|
||||
{
|
||||
/// <summary>
|
||||
/// 获取或设置生成的小程序 URL Scheme。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("openlink")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("openlink")]
|
||||
public string UrlScheme { get; set; } = default!;
|
||||
}
|
||||
}
|
@ -0,0 +1,8 @@
|
||||
{
|
||||
"jump_wxa": {
|
||||
"path": "/pages/publishHomework/publishHomework",
|
||||
"query": ""
|
||||
},
|
||||
"sn": "xxx",
|
||||
"model_id": "xxx"
|
||||
}
|
@ -0,0 +1,5 @@
|
||||
{
|
||||
"errcode": 0,
|
||||
"errmsg": "ok",
|
||||
"openlink": "Scheme"
|
||||
}
|
Loading…
Reference in New Issue
Block a user