mirror of
https://gitee.com/fudiwei/DotNetCore.SKIT.FlurlHttpClient.Wechat.git
synced 2026-03-10 00:13:36 +08:00
feat(wxapi): 新增第三方平台半屏小程序管理相关接口
This commit is contained in:
@@ -1088,5 +1088,139 @@ namespace SKIT.FlurlHttpClient.Wechat.Api
|
||||
return await client.SendRequestWithJsonAsync<Models.WxaApiMiniShopBusinessSupplyRefundResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region WxaEmbedded
|
||||
/// <summary>
|
||||
/// <para>异步调用 [GET] /wxaapi/wxaembedded/get_list 接口。</para>
|
||||
/// <para>REF: https://developers.weixin.qq.com/doc/oplatform/Third-party_Platforms/2.0/api/EmbeddedMiniProgram/get_list.html </para>
|
||||
/// </summary>
|
||||
/// <param name="client"></param>
|
||||
/// <param name="request"></param>
|
||||
/// <param name="cancellationToken"></param>
|
||||
/// <returns></returns>
|
||||
public static async Task<Models.WxaApiWxaEmbeddedGetListResponse> ExecuteWxaApiWxaEmbeddedGetListAsync(this WechatApiClient client, Models.WxaApiWxaEmbeddedGetListRequest 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.Get, "wxaapi", "wxaembedded", "get_list")
|
||||
.SetQueryParam("access_token", request.AccessToken);
|
||||
|
||||
if (request.Offset != null)
|
||||
flurlReq.SetQueryParam("start", request.Offset);
|
||||
|
||||
if (request.Limit != null)
|
||||
flurlReq.SetQueryParam("num", request.Limit);
|
||||
|
||||
return await client.SendRequestWithJsonAsync<Models.WxaApiWxaEmbeddedGetListResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// <para>异步调用 [GET] /wxaapi/wxaembedded/get_own_list 接口。</para>
|
||||
/// <para>REF: https://developers.weixin.qq.com/doc/oplatform/Third-party_Platforms/2.0/api/EmbeddedMiniProgram/get_own_list.html </para>
|
||||
/// </summary>
|
||||
/// <param name="client"></param>
|
||||
/// <param name="request"></param>
|
||||
/// <param name="cancellationToken"></param>
|
||||
/// <returns></returns>
|
||||
public static async Task<Models.WxaApiWxaEmbeddedGetOwnListResponse> ExecuteWxaApiWxaEmbeddedGetOwnListAsync(this WechatApiClient client, Models.WxaApiWxaEmbeddedGetOwnListRequest 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.Get, "wxaapi", "wxaembedded", "get_own_list")
|
||||
.SetQueryParam("access_token", request.AccessToken);
|
||||
|
||||
if (request.Offset != null)
|
||||
flurlReq.SetQueryParam("start", request.Offset);
|
||||
|
||||
if (request.Limit != null)
|
||||
flurlReq.SetQueryParam("num", request.Limit);
|
||||
|
||||
return await client.SendRequestWithJsonAsync<Models.WxaApiWxaEmbeddedGetOwnListResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// <para>异步调用 [POST] /wxaapi/wxaembedded/add_embedded 接口。</para>
|
||||
/// <para>REF: https://developers.weixin.qq.com/doc/oplatform/Third-party_Platforms/2.0/api/EmbeddedMiniProgram/add_embedded.html </para>
|
||||
/// </summary>
|
||||
/// <param name="client"></param>
|
||||
/// <param name="request"></param>
|
||||
/// <param name="cancellationToken"></param>
|
||||
/// <returns></returns>
|
||||
public static async Task<Models.WxaApiWxaEmbeddedAddEmbeddedResponse> ExecuteWxaApiWxaEmbeddedAddEmbeddedAsync(this WechatApiClient client, Models.WxaApiWxaEmbeddedAddEmbeddedRequest 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, "wxaapi", "wxaembedded", "add_embedded")
|
||||
.SetQueryParam("access_token", request.AccessToken);
|
||||
|
||||
return await client.SendRequestWithJsonAsync<Models.WxaApiWxaEmbeddedAddEmbeddedResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// <para>异步调用 [POST] /wxaapi/wxaembedded/del_embedded 接口。</para>
|
||||
/// <para>REF: https://developers.weixin.qq.com/doc/oplatform/Third-party_Platforms/2.0/api/EmbeddedMiniProgram/del_embedded.html </para>
|
||||
/// </summary>
|
||||
/// <param name="client"></param>
|
||||
/// <param name="request"></param>
|
||||
/// <param name="cancellationToken"></param>
|
||||
/// <returns></returns>
|
||||
public static async Task<Models.WxaApiWxaEmbeddedDeleteEmbeddedResponse> ExecuteWxaApiWxaEmbeddedDeleteEmbeddedAsync(this WechatApiClient client, Models.WxaApiWxaEmbeddedDeleteEmbeddedRequest 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, "wxaapi", "wxaembedded", "del_embedded")
|
||||
.SetQueryParam("access_token", request.AccessToken);
|
||||
|
||||
return await client.SendRequestWithJsonAsync<Models.WxaApiWxaEmbeddedDeleteEmbeddedResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// <para>异步调用 [POST] /wxaapi/wxaembedded/del_authorize 接口。</para>
|
||||
/// <para>REF: https://developers.weixin.qq.com/doc/oplatform/Third-party_Platforms/2.0/api/EmbeddedMiniProgram/del_authorize.html </para>
|
||||
/// </summary>
|
||||
/// <param name="client"></param>
|
||||
/// <param name="request"></param>
|
||||
/// <param name="cancellationToken"></param>
|
||||
/// <returns></returns>
|
||||
public static async Task<Models.WxaApiWxaEmbeddedDeleteAuthorizeResponse> ExecuteWxaApiWxaEmbeddedDeleteAuthorizeAsync(this WechatApiClient client, Models.WxaApiWxaEmbeddedDeleteAuthorizeRequest 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, "wxaapi", "wxaembedded", "del_authorize")
|
||||
.SetQueryParam("access_token", request.AccessToken);
|
||||
|
||||
return await client.SendRequestWithJsonAsync<Models.WxaApiWxaEmbeddedDeleteAuthorizeResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// <para>异步调用 [POST] /wxaapi/wxaembedded/set_authorize 接口。</para>
|
||||
/// <para>REF: https://developers.weixin.qq.com/doc/oplatform/Third-party_Platforms/2.0/api/EmbeddedMiniProgram/set_authorize.html </para>
|
||||
/// </summary>
|
||||
/// <param name="client"></param>
|
||||
/// <param name="request"></param>
|
||||
/// <param name="cancellationToken"></param>
|
||||
/// <returns></returns>
|
||||
public static async Task<Models.WxaApiWxaEmbeddedSetAuthorizeResponse> ExecuteWxaApiWxaEmbeddedSetAuthorizeAsync(this WechatApiClient client, Models.WxaApiWxaEmbeddedSetAuthorizeRequest 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, "wxaapi", "wxaembedded", "set_authorize")
|
||||
.SetQueryParam("access_token", request.AccessToken);
|
||||
|
||||
return await client.SendRequestWithJsonAsync<Models.WxaApiWxaEmbeddedSetAuthorizeResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
namespace SKIT.FlurlHttpClient.Wechat.Api.Models
|
||||
{
|
||||
/// <summary>
|
||||
/// <para>表示 [POST] /wxaapi/wxaembedded/add_embedded 接口的请求。</para>
|
||||
/// </summary>
|
||||
public class WxaApiWxaEmbeddedAddEmbeddedRequest : WechatApiRequest, IInferable<WxaApiWxaEmbeddedAddEmbeddedRequest, WxaApiWxaEmbeddedAddEmbeddedResponse>
|
||||
{
|
||||
/// <summary>
|
||||
/// 获取或设置小程序 AppId。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("appid")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("appid")]
|
||||
public string AppId { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置申请理由。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("apply_reason")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("apply_reason")]
|
||||
public string? ApplyReason { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
namespace SKIT.FlurlHttpClient.Wechat.Api.Models
|
||||
{
|
||||
/// <summary>
|
||||
/// <para>表示 [POST] /wxaapi/wxaembedded/add_embedded 接口的响应。</para>
|
||||
/// </summary>
|
||||
public class WxaApiWxaEmbeddedAddEmbeddedResponse : WechatApiResponse
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
namespace SKIT.FlurlHttpClient.Wechat.Api.Models
|
||||
{
|
||||
/// <summary>
|
||||
/// <para>表示 [POST] /wxaapi/wxaembedded/del_authorize 接口的请求。</para>
|
||||
/// </summary>
|
||||
public class WxaApiWxaEmbeddedDeleteAuthorizeRequest : WechatApiRequest, IInferable<WxaApiWxaEmbeddedDeleteAuthorizeRequest, WxaApiWxaEmbeddedDeleteAuthorizeResponse>
|
||||
{
|
||||
/// <summary>
|
||||
/// 获取或设置小程序 AppId。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("appid")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("appid")]
|
||||
public string AppId { get; set; } = string.Empty;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
namespace SKIT.FlurlHttpClient.Wechat.Api.Models
|
||||
{
|
||||
/// <summary>
|
||||
/// <para>表示 [POST] /wxaapi/wxaembedded/del_authorize 接口的响应。</para>
|
||||
/// </summary>
|
||||
public class WxaApiWxaEmbeddedDeleteAuthorizeResponse : WechatApiResponse
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
namespace SKIT.FlurlHttpClient.Wechat.Api.Models
|
||||
{
|
||||
/// <summary>
|
||||
/// <para>表示 [POST] /wxaapi/wxaembedded/del_embedded 接口的请求。</para>
|
||||
/// </summary>
|
||||
public class WxaApiWxaEmbeddedDeleteEmbeddedRequest : WechatApiRequest, IInferable<WxaApiWxaEmbeddedDeleteEmbeddedRequest, WxaApiWxaEmbeddedDeleteEmbeddedResponse>
|
||||
{
|
||||
/// <summary>
|
||||
/// 获取或设置小程序 AppId。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("appid")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("appid")]
|
||||
public string AppId { get; set; } = string.Empty;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
namespace SKIT.FlurlHttpClient.Wechat.Api.Models
|
||||
{
|
||||
/// <summary>
|
||||
/// <para>表示 [POST] /wxaapi/wxaembedded/del_embedded 接口的响应。</para>
|
||||
/// </summary>
|
||||
public class WxaApiWxaEmbeddedDeleteEmbeddedResponse : WechatApiResponse
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
namespace SKIT.FlurlHttpClient.Wechat.Api.Models
|
||||
{
|
||||
/// <summary>
|
||||
/// <para>表示 [GET] /wxaapi/wxaembedded/get_list 接口的请求。</para>
|
||||
/// </summary>
|
||||
public class WxaApiWxaEmbeddedGetListRequest : WechatApiRequest, IInferable<WxaApiWxaEmbeddedGetListRequest, WxaApiWxaEmbeddedGetListResponse>
|
||||
{
|
||||
/// <summary>
|
||||
/// 获取或设置分页起始位置。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonIgnore]
|
||||
[System.Text.Json.Serialization.JsonIgnore]
|
||||
public int? Offset { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置分页每页数量。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonIgnore]
|
||||
[System.Text.Json.Serialization.JsonIgnore]
|
||||
public int? Limit { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,63 @@
|
||||
namespace SKIT.FlurlHttpClient.Wechat.Api.Models
|
||||
{
|
||||
/// <summary>
|
||||
/// <para>表示 [GET] /wxaapi/wxaembedded/get_list 接口的响应。</para>
|
||||
/// </summary>
|
||||
public class WxaApiWxaEmbeddedGetListResponse : WechatApiResponse
|
||||
{
|
||||
public static class Types
|
||||
{
|
||||
public class WxaEmbedded
|
||||
{
|
||||
/// <summary>
|
||||
/// 获取或设置小程序 AppId。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("appid")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("appid")]
|
||||
public string AppId { get; set; } = default!;
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置小程序昵称。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("nickname")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("nickname")]
|
||||
public string Nickname { get; set; } = default!;
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置小程序头像 URL。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("headimg")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("headimg")]
|
||||
public string HeadImageUrl { get; set; } = default!;
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置申请理由。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("reason")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("reason")]
|
||||
public string Reason { get; set; } = default!;
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置申请状态。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("status")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("status")]
|
||||
public int Status { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置添加时间戳。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("create_time")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("create_time")]
|
||||
public long CreateTimestamp { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置半屏小程序列表。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("wxa_embedded_list")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("wxa_embedded_list")]
|
||||
public Types.WxaEmbedded[] WxaEmbeddedList { get; set; } = default!;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
namespace SKIT.FlurlHttpClient.Wechat.Api.Models
|
||||
{
|
||||
/// <summary>
|
||||
/// <para>表示 [GET] /wxaapi/wxaembedded/get_own_list 接口的请求。</para>
|
||||
/// </summary>
|
||||
public class WxaApiWxaEmbeddedGetOwnListRequest : WechatApiRequest, IInferable<WxaApiWxaEmbeddedGetOwnListRequest, WxaApiWxaEmbeddedGetOwnListResponse>
|
||||
{
|
||||
/// <summary>
|
||||
/// 获取或设置分页起始位置。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonIgnore]
|
||||
[System.Text.Json.Serialization.JsonIgnore]
|
||||
public int? Offset { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置分页每页数量。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonIgnore]
|
||||
[System.Text.Json.Serialization.JsonIgnore]
|
||||
public int? Limit { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
namespace SKIT.FlurlHttpClient.Wechat.Api.Models
|
||||
{
|
||||
/// <summary>
|
||||
/// <para>表示 [GET] /wxaapi/wxaembedded/get_own_list 接口的响应。</para>
|
||||
/// </summary>
|
||||
public class WxaApiWxaEmbeddedGetOwnListResponse : WechatApiResponse
|
||||
{
|
||||
public static class Types
|
||||
{
|
||||
public class WxaEmbedded : WxaApiWxaEmbeddedGetListResponse.Types.WxaEmbedded
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置授权方式。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("embedded_flag")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("embedded_flag")]
|
||||
public int AuthFlag { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置半屏小程序列表。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("wxa_embedded_list")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("wxa_embedded_list")]
|
||||
public Types.WxaEmbedded[] WxaEmbeddedList { get; set; } = default!;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
namespace SKIT.FlurlHttpClient.Wechat.Api.Models
|
||||
{
|
||||
/// <summary>
|
||||
/// <para>表示 [POST] /wxaapi/wxaembedded/set_authorize 接口的请求。</para>
|
||||
/// </summary>
|
||||
public class WxaApiWxaEmbeddedSetAuthorizeRequest : WechatApiRequest, IInferable<WxaApiWxaEmbeddedSetAuthorizeRequest, WxaApiWxaEmbeddedSetAuthorizeResponse>
|
||||
{
|
||||
/// <summary>
|
||||
/// 获取或设置授权方式。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("flag")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("flag")]
|
||||
public int AuthFlag { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
namespace SKIT.FlurlHttpClient.Wechat.Api.Models
|
||||
{
|
||||
/// <summary>
|
||||
/// <para>表示 [POST] /wxaapi/wxaembedded/set_authorize 接口的响应。</para>
|
||||
/// </summary>
|
||||
public class WxaApiWxaEmbeddedSetAuthorizeResponse : WechatApiResponse
|
||||
{
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user