Skip to content

Commit

Permalink
feat(microapp): 新增小程序 URL Schema 相关接口
Browse files Browse the repository at this point in the history
  • Loading branch information
fudiwei committed Mar 5, 2024
1 parent 84ff5a6 commit 37cdef7
Show file tree
Hide file tree
Showing 14 changed files with 270 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ public static class Types
public class Data
{
/// <summary>
/// 获取或设置分享链接
/// 获取或设置链接
/// </summary>
[Newtonsoft.Json.JsonProperty("url_link")]
[System.Text.Json.Serialization.JsonPropertyName("url_link")]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public class AppsUrlLinkQueryInfoV1Request : DouyinMicroAppRequest
public string? AppId { get; set; }

/// <summary>
/// 获取或设置分享链接
/// 获取或设置链接
/// </summary>
[Newtonsoft.Json.JsonProperty("url_link")]
[System.Text.Json.Serialization.JsonPropertyName("url_link")]
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
namespace SKIT.FlurlHttpClient.ByteDance.MicroApp.Models
{
/// <summary>
/// <para>表示 [POST] /apps/v1/url/generate_schema 接口的请求。</para>
/// </summary>
public class AppsUrlGenerateSchemaV1Request : DouyinMicroAppRequest
{
/// <summary>
/// 获取或设置小程序的 AppId。如果不指定将使用构造 <see cref="DouyinMicroAppClient"/> 时的 <see cref="DouyinMicroAppClientOptions.AppId"/> 参数。
/// </summary>
[Newtonsoft.Json.JsonProperty("app_id")]
[System.Text.Json.Serialization.JsonPropertyName("app_id")]
public string? AppId { get; set; }

/// <summary>
/// 获取或设置页面路径。
/// </summary>
[Newtonsoft.Json.JsonProperty("path")]
[System.Text.Json.Serialization.JsonPropertyName("path")]
public string? PagePath { get; set; }

/// <summary>
/// 获取或设置页面查询参数。
/// </summary>
[Newtonsoft.Json.JsonProperty("query")]
[System.Text.Json.Serialization.JsonPropertyName("query")]
public string? QueryString { get; set; }

/// <summary>
/// 获取或设置是否永不失效。
/// </summary>
[Newtonsoft.Json.JsonProperty("no_expire")]
[System.Text.Json.Serialization.JsonPropertyName("no_expire")]
public bool IsNoExpire { get; set; }

/// <summary>
/// 获取或设置失效时间戳。
/// </summary>
[Newtonsoft.Json.JsonProperty("expire_time")]
[System.Text.Json.Serialization.JsonPropertyName("expire_time")]
public long? ExpireTimestamp { get; set; }
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
namespace SKIT.FlurlHttpClient.ByteDance.MicroApp.Models
{
/// <summary>
/// <para>表示 [POST] /apps/v1/url/generate_schema 接口的响应。</para>
/// </summary>
public class AppsUrlGenerateSchemaV1Response : DouyinMicroAppResponse
{
public static class Types
{
public class Data
{
/// <summary>
/// 获取或设置链接。
/// </summary>
[Newtonsoft.Json.JsonProperty("schema")]
[System.Text.Json.Serialization.JsonPropertyName("schema")]
public string UrlSchema { get; set; } = default!;
}
}

/// <summary>
/// 获取或设置返回数据。
/// </summary>
[Newtonsoft.Json.JsonProperty("data")]
[System.Text.Json.Serialization.JsonPropertyName("data")]
public Types.Data Data { get; set; } = default!;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
namespace SKIT.FlurlHttpClient.ByteDance.MicroApp.Models
{
/// <summary>
/// <para>表示 [POST] /apps/v1/url/query_schema_quota 接口的请求。</para>
/// </summary>
public class AppsUrlQuerySchemaQuotaV1Request : DouyinMicroAppRequest
{
/// <summary>
/// 获取或设置小程序的 AppId。如果不指定将使用构造 <see cref="DouyinMicroAppClient"/> 时的 <see cref="DouyinMicroAppClientOptions.AppId"/> 参数。
/// </summary>
[Newtonsoft.Json.JsonProperty("app_id")]
[System.Text.Json.Serialization.JsonPropertyName("app_id")]
public string? AppId { get; set; }
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
namespace SKIT.FlurlHttpClient.ByteDance.MicroApp.Models
{
/// <summary>
/// <para>表示 [POST] /apps/v1/url/query_schema_quota 接口的响应。</para>
/// </summary>
public class AppsUrlQuerySchemaQuotaV1Response : DouyinMicroAppResponse
{
public static class Types
{
public class Data
{
public static class Types
{
public class Quota
{
/// <summary>
/// 获取或设置已生成次数。
/// </summary>
[Newtonsoft.Json.JsonProperty("schema_used")]
[System.Text.Json.Serialization.JsonPropertyName("schema_used")]
public int UsedCount { get; set; }

/// <summary>
/// 获取或设置次数上限。
/// </summary>
[Newtonsoft.Json.JsonProperty("schema_limit")]
[System.Text.Json.Serialization.JsonPropertyName("schema_limit")]
public int LimitCount { get; set; }
}
}

/// <summary>
/// 获取或设置长期有效的配额信息。
/// </summary>
[Newtonsoft.Json.JsonProperty("long_term_schema_quota")]
[System.Text.Json.Serialization.JsonPropertyName("long_term_schema_quota")]
public Types.Quota LongTermQuota { get; set; } = default!;

/// <summary>
/// 获取或设置短期有效的配额信息。
/// </summary>
[Newtonsoft.Json.JsonProperty("short_term_schema_quota")]
[System.Text.Json.Serialization.JsonPropertyName("short_term_schema_quota")]
public Types.Quota ShortTermQuota { get; set; } = default!;
}
}

/// <summary>
/// 获取或设置返回数据。
/// </summary>
[Newtonsoft.Json.JsonProperty("data")]
[System.Text.Json.Serialization.JsonPropertyName("data")]
public Types.Data Data { get; set; } = default!;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
namespace SKIT.FlurlHttpClient.ByteDance.MicroApp.Models
{
/// <summary>
/// <para>表示 [POST] /apps/v1/url/query_schema 接口的请求。</para>
/// </summary>
public class AppsUrlQuerySchemaV1Request : DouyinMicroAppRequest
{
/// <summary>
/// 获取或设置小程序的 AppId。如果不指定将使用构造 <see cref="DouyinMicroAppClient"/> 时的 <see cref="DouyinMicroAppClientOptions.AppId"/> 参数。
/// </summary>
[Newtonsoft.Json.JsonProperty("app_id")]
[System.Text.Json.Serialization.JsonPropertyName("app_id")]
public string? AppId { get; set; }

/// <summary>
/// 获取或设置链接。
/// </summary>
[Newtonsoft.Json.JsonProperty("schema")]
[System.Text.Json.Serialization.JsonPropertyName("schema")]
public string UrlSchema { get; set; } = string.Empty;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
namespace SKIT.FlurlHttpClient.ByteDance.MicroApp.Models
{
/// <summary>
/// <para>表示 [POST] /apps/v1/url/query_schema 接口的响应。</para>
/// </summary>
public class AppsUrlQuerySchemaV1Response : DouyinMicroAppResponse
{
public static class Types
{
public class Data
{
/// <summary>
/// 获取或设置小程序的 AppId。
/// </summary>
[Newtonsoft.Json.JsonProperty("app_id")]
[System.Text.Json.Serialization.JsonPropertyName("app_id")]
public string AppId { get; set; } = default!;

/// <summary>
/// 获取或设置页面路径。
/// </summary>
[Newtonsoft.Json.JsonProperty("path")]
[System.Text.Json.Serialization.JsonPropertyName("path")]
public string? PagePath { get; set; }

/// <summary>
/// 获取或设置页面查询参数。
/// </summary>
[Newtonsoft.Json.JsonProperty("query")]
[System.Text.Json.Serialization.JsonPropertyName("query")]
public string? QueryString { 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("expire_time")]
[System.Text.Json.Serialization.JsonPropertyName("expire_time")]
public long ExpireTimestamp { get; set; }
}
}

/// <summary>
/// 获取或设置返回数据。
/// </summary>
[Newtonsoft.Json.JsonProperty("data")]
[System.Text.Json.Serialization.JsonPropertyName("data")]
public Types.Data Data { get; set; } = default!;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"app_id": "tt5da*****",
"query": "{\"key1\":\"val1\",\"key2\":\"val2\"}",
"path": "test_miniapp",
"no_expire": false,
"expire_time": 1685090014
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"data": {
"schema": "sslocal://miniapp?ticket=v1_*****"
},
"err_msg": "",
"err_no": 0,
"log_id": "20230828105040791DAA4F7CABB43F2E0D"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"app_id": "tt********"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"err_no": 0,
"log_id": "20230828114955870A641D59241500963C",
"data": {
"long_term_schema_quota": {
"schema_used": 6,
"schema_limit": 0
},
"short_term_schema_quota": {
"schema_limit": 0,
"schema_used": 0
}
},
"err_msg": ""
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"schema": "sslocal://miniapp?ticket=v1_*****",
"app_id": "tt*****"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"data": {
"app_id": "tt******",
"path": "page/index",
"query": "{}",
"create_time": 1682075227,
"expire_time": 0
},
"err_msg": "",
"err_no": 0,
"log_id": "2023********7AB1"
}

0 comments on commit 37cdef7

Please sign in to comment.