mirror of
https://gitee.com/fudiwei/DotNetCore.SKIT.FlurlHttpClient.Wechat.git
synced 2025-07-16 16:50:43 +08:00
feat(wxapi): 新增小程序生成 ShortLink 相关接口
This commit is contained in:
parent
cbd1b8a935
commit
5fd533f1fb
@ -813,6 +813,28 @@ namespace SKIT.FlurlHttpClient.Wechat.Api
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region ShortLink
|
||||
/// <summary>
|
||||
/// <para>异步调用 [POST] /wxa/genwxashortlink 接口。</para>
|
||||
/// <para>REF: https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/short-link/shortlink.generate.html </para>
|
||||
/// </summary>
|
||||
/// <param name="client"></param>
|
||||
/// <param name="request"></param>
|
||||
/// <param name="cancellationToken"></param>
|
||||
/// <returns></returns>
|
||||
public static async Task<Models.WxaGenerateWxaShortLinkResponse> ExecuteWxaGenerateWxaShortLinkAsync(this WechatApiClient client, Models.WxaGenerateWxaShortLinkRequest 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", "genwxashortlink")
|
||||
.SetQueryParam("access_token", request.AccessToken);
|
||||
|
||||
return await client.SendRequestWithJsonAsync<Models.WxaGenerateWxaShortLinkResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region WxaStore
|
||||
/// <summary>
|
||||
/// <para>异步调用 [GET] /wxa/get_merchant_category 接口。</para>
|
||||
|
@ -0,0 +1,32 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace SKIT.FlurlHttpClient.Wechat.Api.Models
|
||||
{
|
||||
/// <summary>
|
||||
/// <para>表示 [POST] /wxa/genwxashortlink 接口的请求。</para>
|
||||
/// </summary>
|
||||
public class WxaGenerateWxaShortLinkRequest : WechatApiRequest
|
||||
{
|
||||
/// <summary>
|
||||
/// 获取或设置小程序页面路径。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("page_url")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("page_url")]
|
||||
public string PagePath { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置小程序页面标题。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("page_title")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("page_title")]
|
||||
public string PageTitle { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置是否永久有效。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("is_permanent")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("is_permanent")]
|
||||
public bool? IsPermanent { get; set; }
|
||||
}
|
||||
}
|
@ -0,0 +1,18 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace SKIT.FlurlHttpClient.Wechat.Api.Models
|
||||
{
|
||||
/// <summary>
|
||||
/// <para>表示 [POST] /wxa/genwxashortlink 接口的响应。</para>
|
||||
/// </summary>
|
||||
public class WxaGenerateWxaShortLinkResponse : WechatApiResponse
|
||||
{
|
||||
/// <summary>
|
||||
/// 获取或设置生成的小程序 Short Link。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("link")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("link")]
|
||||
public string ShortLink { get; set; } = default!;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user