feat(wxapi): 新增小程序连接小店获取小程序的定制文件接口

This commit is contained in:
Fu Diwei
2025-01-31 23:44:42 +08:00
parent a3e8181f74
commit 9d36b2bde3
5 changed files with 79 additions and 0 deletions

View File

@@ -3281,6 +3281,31 @@ namespace SKIT.FlurlHttpClient.Wechat.Api
#endregion
#endregion
#region ECOpen
/// <summary>
/// <para>异步调用 [POST] /channels/ec/open/get_download_url 接口。</para>
/// <para>
/// REF: <br/>
/// <![CDATA[ https://developers.weixin.qq.com/doc/store/API/miniandstore/get_download_url.html ]]>
/// </para>
/// </summary>
/// <param name="client"></param>
/// <param name="request"></param>
/// <param name="cancellationToken"></param>
/// <returns></returns>
public static async Task<Models.ChannelsECOpenGetDownloadUrlResponse> ExecuteChannelsECOpenGetDownloadUrlAsync(this WechatApiClient client, Models.ChannelsECOpenGetDownloadUrlRequest 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
.CreateFlurlRequest(request, HttpMethod.Post, "channels", "ec", "open", "get_download_url")
.SetQueryParam("access_token", request.AccessToken);
return await client.SendFlurlRequestAsJsonAsync<Models.ChannelsECOpenGetDownloadUrlResponse>(flurlReq, data: request, cancellationToken: cancellationToken).ConfigureAwait(false);
}
#endregion
#region ECOrder
/// <summary>
/// <para>异步调用 [POST] /channels/ec/order/search 接口。</para>

View File

@@ -0,0 +1,22 @@
namespace SKIT.FlurlHttpClient.Wechat.Api.Models
{
/// <summary>
/// <para>表示 [POST] /channels/ec/open/get_download_url 接口的请求。</para>
/// </summary>
public class ChannelsECOpenGetDownloadUrlRequest : WechatApiRequest, IInferable<ChannelsECOpenGetDownloadUrlRequest, ChannelsECOpenGetDownloadUrlResponse>
{
/// <summary>
/// 获取或设置用户的 OpenId。
/// </summary>
[Newtonsoft.Json.JsonProperty("openid")]
[System.Text.Json.Serialization.JsonPropertyName("openid")]
public string OpenId { get; set; } = string.Empty;
/// <summary>
/// 获取或设置订单 ID。
/// </summary>
[Newtonsoft.Json.JsonProperty("order_id")]
[System.Text.Json.Serialization.JsonPropertyName("order_id")]
public string OrderId { get; set; } = string.Empty;
}
}

View File

@@ -0,0 +1,22 @@
namespace SKIT.FlurlHttpClient.Wechat.Api.Models
{
/// <summary>
/// <para>表示 [POST] /channels/ec/open/get_download_url 接口的响应。</para>
/// </summary>
public class ChannelsECOpenGetDownloadUrlResponse : WechatApiResponse
{
/// <summary>
/// 获取或设置文件下载链接。
/// </summary>
[Newtonsoft.Json.JsonProperty("download_url")]
[System.Text.Json.Serialization.JsonPropertyName("download_url")]
public string DownloadUrl { get; set; } = default!;
/// <summary>
/// 获取或设置链接到期时间戳。
/// </summary>
[Newtonsoft.Json.JsonProperty("expire_time")]
[System.Text.Json.Serialization.JsonPropertyName("expire_time")]
public long ExpireTimestamp { get; set; }
}
}

View File

@@ -0,0 +1,4 @@
{
"openid": "23982ADD2323",
"order_id": "239829312"
}

View File

@@ -0,0 +1,6 @@
{
"errcode": 0,
"errmsg": "成功",
"download_url": "https://cos.tencent.com/image/test.png",
"expire_time": 17823232312
}