mirror of
https://gitee.com/fudiwei/DotNetCore.SKIT.FlurlHttpClient.Wechat.git
synced 2025-04-05 17:37:54 +08:00
feat(wxapi): 新增代商家管理小程序获取或设置 DNS 预解析域名接口
This commit is contained in:
parent
0bb1e9bda6
commit
c83fdcadf6
@ -251,6 +251,46 @@ namespace SKIT.FlurlHttpClient.Wechat.Api
|
||||
|
||||
return await client.SendRequestWithJsonAsync<Models.WxaGetEffectiveWebviewDomainResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// <para>异步调用 [GET] /wxa/get_prefetchdnsdomain 接口。</para>
|
||||
/// <para>REF: https://developers.weixin.qq.com/doc/oplatform/openApi/OpenApiDoc/miniprogram-management/domain-management/getPrefetchDomain.html </para>
|
||||
/// </summary>
|
||||
/// <param name="client"></param>
|
||||
/// <param name="request"></param>
|
||||
/// <param name="cancellationToken"></param>
|
||||
/// <returns></returns>
|
||||
public static async Task<Models.WxaGetPrefetchDNSDomainResponse> ExecuteWxaGetPrefetchDNSDomainAsync(this WechatApiClient client, Models.WxaGetPrefetchDNSDomainRequest 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, "wxa", "get_prefetchdnsdomain")
|
||||
.SetQueryParam("access_token", request.AccessToken);
|
||||
|
||||
return await client.SendRequestWithJsonAsync<Models.WxaGetPrefetchDNSDomainResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// <para>异步调用 [POST] /wxa/set_prefetchdnsdomain 接口。</para>
|
||||
/// <para>REF: https://developers.weixin.qq.com/doc/oplatform/openApi/OpenApiDoc/miniprogram-management/domain-management/setPrefetchDomain.html </para>
|
||||
/// </summary>
|
||||
/// <param name="client"></param>
|
||||
/// <param name="request"></param>
|
||||
/// <param name="cancellationToken"></param>
|
||||
/// <returns></returns>
|
||||
public static async Task<Models.WxaSetPrefetchDNSDomainResponse> ExecuteWxaSetPrefetchDNSDomainAsync(this WechatApiClient client, Models.WxaSetPrefetchDNSDomainRequest 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", "set_prefetchdnsdomain")
|
||||
.SetQueryParam("access_token", request.AccessToken);
|
||||
|
||||
return await client.SendRequestWithJsonAsync<Models.WxaSetPrefetchDNSDomainResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Register
|
||||
|
@ -0,0 +1,9 @@
|
||||
namespace SKIT.FlurlHttpClient.Wechat.Api.Models
|
||||
{
|
||||
/// <summary>
|
||||
/// <para>表示 [GET] /wxa/get_prefetchdnsdomain 接口的请求。</para>
|
||||
/// </summary>
|
||||
public class WxaGetPrefetchDNSDomainRequest : WechatApiRequest, IInferable<WxaGetPrefetchDNSDomainRequest, WxaGetPrefetchDNSDomainResponse>
|
||||
{
|
||||
}
|
||||
}
|
@ -0,0 +1,42 @@
|
||||
namespace SKIT.FlurlHttpClient.Wechat.Api.Models
|
||||
{
|
||||
/// <summary>
|
||||
/// <para>表示 [GET] /wxa/get_prefetchdnsdomain 接口的响应。</para>
|
||||
/// </summary>
|
||||
public class WxaGetPrefetchDNSDomainResponse : WechatApiResponse
|
||||
{
|
||||
public static class Types
|
||||
{
|
||||
public class PrefetchDNSDomain
|
||||
{
|
||||
/// <summary>
|
||||
/// 获取或设置地址。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("url")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("url")]
|
||||
public string Url { get; set; } = default!;
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置状态。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("status")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("status")]
|
||||
public int Status { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置预解析 DNS 域名列表。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("prefetch_dns_domain")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("prefetch_dns_domain")]
|
||||
public Types.PrefetchDNSDomain[] PrefetchDNSDomainList { get; set; } = default!;
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置总共可配置域名个数。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("size_limit")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("size_limit")]
|
||||
public int SizeLimit { get; set; }
|
||||
}
|
||||
}
|
@ -0,0 +1,30 @@
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace SKIT.FlurlHttpClient.Wechat.Api.Models
|
||||
{
|
||||
/// <summary>
|
||||
/// <para>表示 [POST] /wxa/set_prefetchdnsdomain 接口的请求。</para>
|
||||
/// </summary>
|
||||
public class WxaSetPrefetchDNSDomainRequest : WechatApiRequest, IInferable<WxaSetPrefetchDNSDomainRequest, WxaSetPrefetchDNSDomainResponse>
|
||||
{
|
||||
public static class Types
|
||||
{
|
||||
public class PrefetchDNSDomain
|
||||
{
|
||||
/// <summary>
|
||||
/// 获取或设置地址。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("url")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("url")]
|
||||
public string Url { get; set; } = string.Empty;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置预解析 DNS 域名列表。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("prefetch_dns_domain")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("prefetch_dns_domain")]
|
||||
public IList<Types.PrefetchDNSDomain> PrefetchDNSDomainList { get; set; } = new List<Types.PrefetchDNSDomain>();
|
||||
}
|
||||
}
|
@ -0,0 +1,9 @@
|
||||
namespace SKIT.FlurlHttpClient.Wechat.Api.Models
|
||||
{
|
||||
/// <summary>
|
||||
/// <para>表示 [POST] /wxa/set_prefetchdnsdomain 接口的响应。</para>
|
||||
/// </summary>
|
||||
public class WxaSetPrefetchDNSDomainResponse : WechatApiResponse
|
||||
{
|
||||
}
|
||||
}
|
@ -0,0 +1,15 @@
|
||||
{
|
||||
"errcode": 0,
|
||||
"errmsg": "ok",
|
||||
"prefetch_dns_domain": [
|
||||
{
|
||||
"url": "d1.com",
|
||||
"status": 0
|
||||
},
|
||||
{
|
||||
"url": "d2.com",
|
||||
"status": 0
|
||||
}
|
||||
],
|
||||
"size_limit": 5
|
||||
}
|
@ -0,0 +1,10 @@
|
||||
{
|
||||
"prefetch_dns_domain": [
|
||||
{
|
||||
"url": "d1.com"
|
||||
},
|
||||
{
|
||||
"url": "d2.com"
|
||||
}
|
||||
]
|
||||
}
|
Loading…
Reference in New Issue
Block a user