mirror of
https://gitee.com/fudiwei/DotNetCore.SKIT.FlurlHttpClient.Wechat.git
synced 2025-04-05 17:37:54 +08:00
feat(wxapi): 新增小程序硬件框架推送消息接口
This commit is contained in:
parent
439bf0872f
commit
d839ee8f94
@ -263,7 +263,7 @@ namespace SKIT.FlurlHttpClient.Wechat.Api
|
||||
#region Runtime
|
||||
/// <summary>
|
||||
/// <para>异步调用 [POST] /wxa/business/runtime/adddevice 接口。</para>
|
||||
/// <para>REF: https://developers.weixin.qq.com/doc/oplatform/Miniprogram_Frame/deviceId.html </para>
|
||||
/// <para>REF: https://developers.weixin.qq.com/doc/oplatform/Miniprogram_Frame/api/backend/addDevice.html </para>
|
||||
/// </summary>
|
||||
/// <param name="client"></param>
|
||||
/// <param name="request"></param>
|
||||
@ -280,6 +280,26 @@ namespace SKIT.FlurlHttpClient.Wechat.Api
|
||||
|
||||
return await client.SendRequestWithJsonAsync<Models.WxaBusinessRuntimeAddDeviceResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// <para>异步调用 [POST] /wxa/business/runtime/pushappmsg 接口。</para>
|
||||
/// <para>REF: https://developers.weixin.qq.com/doc/oplatform/Miniprogram_Frame/api/backend/pushAppMsg.html </para>
|
||||
/// </summary>
|
||||
/// <param name="client"></param>
|
||||
/// <param name="request"></param>
|
||||
/// <param name="cancellationToken"></param>
|
||||
/// <returns></returns>
|
||||
public static async Task<Models.WxaBusinessRuntimePushAppMessageResponse> ExecuteWxaBusinessRuntimePushAppMessageAsync(this WechatApiClient client, Models.WxaBusinessRuntimePushAppMessageRequest 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", "business", "runtime", "pushappmsg")
|
||||
.SetQueryParam("access_token", request.AccessToken);
|
||||
|
||||
return await client.SendRequestWithJsonAsync<Models.WxaBusinessRuntimePushAppMessageResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Internet
|
||||
|
@ -0,0 +1,24 @@
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace SKIT.FlurlHttpClient.Wechat.Api.Models
|
||||
{
|
||||
/// <summary>
|
||||
/// <para>表示 [POST] /wxa/business/runtime/pushappmsg 接口的请求。</para>
|
||||
/// </summary>
|
||||
public class WxaBusinessRuntimePushAppMessageRequest : WechatApiRequest, IInferable<WxaBusinessRuntimePushAppMessageRequest, WxaBusinessRuntimeAddDeviceResponse>
|
||||
{
|
||||
/// <summary>
|
||||
/// 获取或设置消息内容。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("msg")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("msg")]
|
||||
public string Message { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置产品中文名称。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("push_token")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("push_token")]
|
||||
public string PushToken { get; set; } = string.Empty;
|
||||
}
|
||||
}
|
@ -0,0 +1,9 @@
|
||||
namespace SKIT.FlurlHttpClient.Wechat.Api.Models
|
||||
{
|
||||
/// <summary>
|
||||
/// <para>表示 [POST] /wxa/business/runtime/pushappmsg 接口的响应。</para>
|
||||
/// </summary>
|
||||
public class WxaBusinessRuntimePushAppMessageResponse : WechatApiResponse
|
||||
{
|
||||
}
|
||||
}
|
@ -0,0 +1,4 @@
|
||||
{
|
||||
"msg": "your msg",
|
||||
"push_token": "your push token"
|
||||
}
|
Loading…
Reference in New Issue
Block a user