mirror of
https://gitee.com/fudiwei/DotNetCore.SKIT.FlurlHttpClient.Wechat.git
synced 2025-07-15 23:13:32 +08:00
feat(wxapi): 随官方更新 URL Scheme / URL Link 相关接口模型
This commit is contained in:
parent
38f1f4b1ce
commit
ff944a7787
@ -304,6 +304,27 @@ namespace SKIT.FlurlHttpClient.Wechat.Api
|
||||
|
||||
return await client.SendRequestWithJsonAsync<Models.WxaGenerateSchemeResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// <para>异步调用 [POST] /wxa/queryscheme 接口。</para>
|
||||
/// <para>REF: https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/url-scheme/urlscheme.query.html </para>
|
||||
/// <para>REF: https://developers.weixin.qq.com/minigame/dev/api-backend/open-api/url-scheme/urlscheme.query.html </para>
|
||||
/// </summary>
|
||||
/// <param name="client"></param>
|
||||
/// <param name="request"></param>
|
||||
/// <param name="cancellationToken"></param>
|
||||
/// <returns></returns>
|
||||
public static async Task<Models.WxaQuerySchemeResponse> ExecuteWxaQuerySchemeAsync(this WechatApiClient client, Models.WxaQuerySchemeRequest 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", "queryscheme")
|
||||
.SetQueryParam("access_token", request.AccessToken);
|
||||
|
||||
return await client.SendRequestWithJsonAsync<Models.WxaQuerySchemeResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region UrlLink
|
||||
@ -327,6 +348,27 @@ namespace SKIT.FlurlHttpClient.Wechat.Api
|
||||
|
||||
return await client.SendRequestWithJsonAsync<Models.WxaGenerateUrlLinkResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// <para>异步调用 [POST] /wxa/query_urllink 接口。</para>
|
||||
/// <para>REF: https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/url-link/urllink.query.html </para>
|
||||
/// <para>REF: https://developers.weixin.qq.com/minigame/dev/api-backend/open-api/url-link/urllink.query.html </para>
|
||||
/// </summary>
|
||||
/// <param name="client"></param>
|
||||
/// <param name="request"></param>
|
||||
/// <param name="cancellationToken"></param>
|
||||
/// <returns></returns>
|
||||
public static async Task<Models.WxaQueryUrlLinkResponse> ExecuteWxaQueryUrlLinkAsync(this WechatApiClient client, Models.WxaQueryUrlLinkRequest 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", "query_urllink")
|
||||
.SetQueryParam("access_token", request.AccessToken);
|
||||
|
||||
return await client.SendRequestWithJsonAsync<Models.WxaQueryUrlLinkResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Security
|
||||
|
@ -36,6 +36,13 @@
|
||||
[Newtonsoft.Json.JsonProperty("query")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("query")]
|
||||
public string? Query { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置第三方平台的 AppId。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("resource_appid")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("resource_appid")]
|
||||
public string? ResourceAppId { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@ -53,12 +60,19 @@
|
||||
[System.Text.Json.Serialization.JsonPropertyName("query")]
|
||||
public string? Query { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置要打开的小程序版本。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("env_version")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("env_version")]
|
||||
public string? EnvironmentVersion { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置是否到期失效。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("is_expire")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("is_expire")]
|
||||
public bool? IsExpire { get; set; }
|
||||
public bool? IsExpirable { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置失效类型。
|
||||
@ -75,7 +89,7 @@
|
||||
public long? ExpireTimestamp { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置到期失效的间隔天数。
|
||||
/// 获取或设置到期失效的时间间隔(单位:天)。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("expire_interval")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("expire_interval")]
|
||||
|
@ -0,0 +1,15 @@
|
||||
namespace SKIT.FlurlHttpClient.Wechat.Api.Models
|
||||
{
|
||||
/// <summary>
|
||||
/// <para>表示 [POST] /wxa/query_urllink 接口的请求。</para>
|
||||
/// </summary>
|
||||
public class WxaQueryUrlLinkRequest : WechatApiRequest
|
||||
{
|
||||
/// <summary>
|
||||
/// 获取或设置小程序 URL Link。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("url_link")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("url_link")]
|
||||
public string UrlLink { get; set; } = string.Empty;
|
||||
}
|
||||
}
|
@ -0,0 +1,135 @@
|
||||
namespace SKIT.FlurlHttpClient.Wechat.Api.Models
|
||||
{
|
||||
/// <summary>
|
||||
/// <para>表示 [POST] /wxa/query_urllink 接口的响应。</para>
|
||||
/// </summary>
|
||||
public class WxaQueryUrlLinkResponse : WechatApiResponse
|
||||
{
|
||||
public static class Types
|
||||
{
|
||||
public class UrlLink
|
||||
{
|
||||
public static class Types
|
||||
{
|
||||
public class CloudBase
|
||||
{
|
||||
/// <summary>
|
||||
/// 获取或设置云开发环境 ID。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("env")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("env")]
|
||||
public string EnvironmentId { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置静态网站自定义域名。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("domain")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("domain")]
|
||||
public string? Domain { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置云开发静态网站 H5 页面路径。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("path")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("path")]
|
||||
public string? Path { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置云开发静态网站 H5 页面参数。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("query")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("query")]
|
||||
public string? Query { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置第三方平台的 AppId。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("resource_appid")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("resource_appid")]
|
||||
public string? ResourceAppId { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置小程序 AppId。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("appid")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("appid")]
|
||||
public string AppId { get; set; } = default!;
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置小程序页面路径。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("path")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("path")]
|
||||
public string Path { get; set; } = default!;
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置小程序页面参数。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("query")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("query")]
|
||||
public string? Query { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置要打开的小程序版本。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("env_version")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("env_version")]
|
||||
public string EnvironmentVersion { get; set; } = default!;
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置过期时间戳。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("expire_time")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("expire_time")]
|
||||
public long ExpireTimestamp { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置创建时间戳。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("create_time")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("create_time")]
|
||||
public long CreateTimestamp { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置云开发静态网站自定义 H5 配置参数。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("cloud_base")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("cloud_base")]
|
||||
public Types.CloudBase? CloudBase { get; set; }
|
||||
}
|
||||
|
||||
public class Quota
|
||||
{
|
||||
/// <summary>
|
||||
/// 获取或设置长期有效的已生成次数。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("long_time_used")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("long_time_used")]
|
||||
public int LongTimeUsed { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置长期有效的次数上限。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("long_time_limit")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("long_time_limit")]
|
||||
public int LongTimeLimit { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置 URL Link 信息。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("url_link_info")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("url_link_info")]
|
||||
public Types.UrlLink UrlLink { get; set; } = default!;
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置配额信息。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("url_link_quota")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("url_link_quota")]
|
||||
public Types.Quota Quota { get; set; } = default!;
|
||||
}
|
||||
}
|
@ -22,6 +22,13 @@
|
||||
[Newtonsoft.Json.JsonProperty("query")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("query")]
|
||||
public string? Query { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置要打开的小程序版本。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("env_version")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("env_version")]
|
||||
public string? EnvironmentVersion { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@ -37,7 +44,14 @@
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("is_expire")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("is_expire")]
|
||||
public bool? IsExpire { get; set; }
|
||||
public bool? IsExpirable { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置到期失效类型。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("expire_type")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("expire_type")]
|
||||
public int ExpireType { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置到期失效的时间戳。
|
||||
@ -45,5 +59,12 @@
|
||||
[Newtonsoft.Json.JsonProperty("expire_time")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("expire_time")]
|
||||
public long? ExpireTimestamp { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置到期失效的时间间隔(单位:天)。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("expire_interval")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("expire_interval")]
|
||||
public int? ExpireInterval { get; set; }
|
||||
}
|
||||
}
|
||||
|
@ -10,6 +10,6 @@
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("openlink")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("openlink")]
|
||||
public string OpenLink { get; set; } = default!;
|
||||
public string UrlScheme { get; set; } = default!;
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,15 @@
|
||||
namespace SKIT.FlurlHttpClient.Wechat.Api.Models
|
||||
{
|
||||
/// <summary>
|
||||
/// <para>表示 [POST] /wxa/queryscheme 接口的请求。</para>
|
||||
/// </summary>
|
||||
public class WxaQuerySchemeRequest : WechatApiRequest
|
||||
{
|
||||
/// <summary>
|
||||
/// 获取或设置小程序 URL Scheme。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("scheme")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("scheme")]
|
||||
public string UrlScheme { get; set; } = string.Empty;
|
||||
}
|
||||
}
|
@ -0,0 +1,87 @@
|
||||
namespace SKIT.FlurlHttpClient.Wechat.Api.Models
|
||||
{
|
||||
/// <summary>
|
||||
/// <para>表示 [POST] /wxa/queryscheme 接口的响应。</para>
|
||||
/// </summary>
|
||||
public class WxaQuerySchemeResponse : WechatApiResponse
|
||||
{
|
||||
public static class Types
|
||||
{
|
||||
public class UrlScheme
|
||||
{
|
||||
/// <summary>
|
||||
/// 获取或设置小程序 AppId。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("appid")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("appid")]
|
||||
public string AppId { get; set; } = default!;
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置小程序页面路径。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("path")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("path")]
|
||||
public string Path { get; set; } = default!;
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置小程序页面参数。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("query")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("query")]
|
||||
public string? Query { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置要打开的小程序版本。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("env_version")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("env_version")]
|
||||
public string EnvironmentVersion { get; set; } = default!;
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置过期时间戳。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("expire_time")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("expire_time")]
|
||||
public long ExpireTimestamp { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置创建时间戳。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("create_time")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("create_time")]
|
||||
public long CreateTimestamp { get; set; }
|
||||
}
|
||||
|
||||
public class Quota
|
||||
{
|
||||
/// <summary>
|
||||
/// 获取或设置长期有效的已生成次数。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("long_time_used")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("long_time_used")]
|
||||
public int LongTimeUsed { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置长期有效的次数上限。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("long_time_limit")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("long_time_limit")]
|
||||
public int LongTimeLimit { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置 URL Scheme 信息。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("scheme_info")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("scheme_info")]
|
||||
public Types.UrlScheme UrlScheme { get; set; } = default!;
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置配额信息。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("scheme_quota")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("scheme_quota")]
|
||||
public Types.Quota Quota { get; set; } = default!;
|
||||
}
|
||||
}
|
@ -59,7 +59,7 @@
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("check_path")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("check_path")]
|
||||
public bool? RequireCheckPagePath { get; set; }
|
||||
public bool? RequireCheckPath { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置要打开的小程序版本。
|
||||
|
@ -0,0 +1,3 @@
|
||||
{
|
||||
"url_link": "https://wxaurl.cn/BQZRrcFCPvg"
|
||||
}
|
@ -0,0 +1,23 @@
|
||||
{
|
||||
"errcode": 0,
|
||||
"errmsg": "ok",
|
||||
"url_link_info": {
|
||||
"appid": "appid",
|
||||
"path": "",
|
||||
"query": "",
|
||||
"create_time": 611928113,
|
||||
"expire_time": 0,
|
||||
"env_version": "release",
|
||||
"cloud_base": {
|
||||
"env": "",
|
||||
"doamin": "",
|
||||
"path": "",
|
||||
"query": "",
|
||||
"resource_appid": ""
|
||||
}
|
||||
},
|
||||
"url_link_quota": {
|
||||
"long_time_used": 100,
|
||||
"long_time_limit": 100000
|
||||
}
|
||||
}
|
@ -0,0 +1,3 @@
|
||||
{
|
||||
"scheme": "weixin://dl/business/?t=XTSkBZlzqmn"
|
||||
}
|
@ -0,0 +1,16 @@
|
||||
{
|
||||
"errcode": 0,
|
||||
"errmsg": "ok",
|
||||
"scheme_info": {
|
||||
"appid": "appid",
|
||||
"path": "",
|
||||
"query": "",
|
||||
"create_time": 611928113,
|
||||
"expire_time": 0,
|
||||
"env_version": "release"
|
||||
},
|
||||
"scheme_quota": {
|
||||
"long_time_used": 100,
|
||||
"long_time_limit": 100000
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user