Skip to content

Commit

Permalink
feat(microapp): 新增小程序二维码 v2 接口
Browse files Browse the repository at this point in the history
  • Loading branch information
fudiwei committed Mar 5, 2024
1 parent 37cdef7 commit 696ebbe
Show file tree
Hide file tree
Showing 9 changed files with 148 additions and 5 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
namespace SKIT.FlurlHttpClient.ByteDance.MicroApp.Models
{
/// <summary>
/// <para>表示 [POST] /apps/v1/qrcode/create 接口的请求。</para>
/// </summary>
public class AppsQrcodeCreateV1Request : DouyinMicroAppRequest
{
public static class Types
{
public class Color
{
/// <summary>
/// 获取或设置 RGB 红色色值。
/// </summary>
[Newtonsoft.Json.JsonProperty("r")]
[System.Text.Json.Serialization.JsonPropertyName("r")]
public byte Red { get; set; }

/// <summary>
/// 获取或设置 RGB 绿色色值。
/// </summary>
[Newtonsoft.Json.JsonProperty("g")]
[System.Text.Json.Serialization.JsonPropertyName("g")]
public byte Green { get; set; }

/// <summary>
/// 获取或设置 RGB 蓝色色值。
/// </summary>
[Newtonsoft.Json.JsonProperty("b")]
[System.Text.Json.Serialization.JsonPropertyName("b")]
public byte Blue { get; set; }
}
}

/// <summary>
/// 获取或设置小程序 AppId。如果不指定将使用构造 <see cref="DouyinMicroAppClient"/> 时的 <see cref="DouyinMicroAppClientOptions.AppId"/> 参数。
/// </summary>
[Newtonsoft.Json.JsonProperty("appid")]
[System.Text.Json.Serialization.JsonPropertyName("appid")]
public string? AppId { get; set; }

/// <summary>
/// 获取或设置宿主名称。
/// </summary>
[Newtonsoft.Json.JsonProperty("app_name")]
[System.Text.Json.Serialization.JsonPropertyName("app_name")]
public string? AppName { get; set; }

/// <summary>
/// 获取或设置 URL 编码后的小程序启动路径。
/// </summary>
[Newtonsoft.Json.JsonProperty("path")]
[System.Text.Json.Serialization.JsonPropertyName("path")]
public string? EncodedPath { get; set; }

/// <summary>
/// 获取或设置二维码宽度(单位:像素)。
/// </summary>
[Newtonsoft.Json.JsonProperty("width")]
[System.Text.Json.Serialization.JsonPropertyName("width")]
public int? Width { get; set; }

/// <summary>
/// 获取或设置二维码线条颜色信息。
/// </summary>
[Newtonsoft.Json.JsonProperty("line_color")]
[System.Text.Json.Serialization.JsonPropertyName("line_color")]
public Types.Color? LineColor { get; set; }

/// <summary>
/// 获取或设置二维码背景颜色信息。
/// </summary>
[Newtonsoft.Json.JsonProperty("background")]
[System.Text.Json.Serialization.JsonPropertyName("background")]
public Types.Color? BackgroundColor { get; set; }

/// <summary>
/// 获取或设置是否展示小程序 Icon。
/// </summary>
[Newtonsoft.Json.JsonProperty("set_icon")]
[System.Text.Json.Serialization.JsonPropertyName("set_icon")]
public bool? RequireSetIcon { get; set; }

/// <summary>
/// 获取或设置是否生成抖音码。
/// </summary>
[Newtonsoft.Json.JsonProperty("is_circle_code")]
[System.Text.Json.Serialization.JsonPropertyName("is_circle_code")]
public bool? IsCircleCode { 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/qrcode/create 接口的响应。</para>
/// </summary>
public class AppsQrcodeCreateV1Response : DouyinMicroAppResponse
{
public static class Types
{
public class Data
{
/// <summary>
/// 获取或设置经过 Base64 编码的二维码图片数据。
/// </summary>
[Newtonsoft.Json.JsonProperty("img")]
[System.Text.Json.Serialization.JsonPropertyName("img")]
public string EncodingImageData { 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
Expand Up @@ -6,7 +6,7 @@ namespace SKIT.FlurlHttpClient.ByteDance.MicroApp.Models
public class AppsUrlLinkGenerateV1Request : DouyinMicroAppRequest
{
/// <summary>
/// 获取或设置小程序的 AppId。如果不指定将使用构造 <see cref="DouyinMicroAppClient"/> 时的 <see cref="DouyinMicroAppClientOptions.AppId"/> 参数。
/// 获取或设置小程序 AppId。如果不指定将使用构造 <see cref="DouyinMicroAppClient"/> 时的 <see cref="DouyinMicroAppClientOptions.AppId"/> 参数。
/// </summary>
[Newtonsoft.Json.JsonProperty("app_id")]
[System.Text.Json.Serialization.JsonPropertyName("app_id")]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ namespace SKIT.FlurlHttpClient.ByteDance.MicroApp.Models
public class AppsUrlLinkQueryInfoV1Request : DouyinMicroAppRequest
{
/// <summary>
/// 获取或设置小程序的 AppId。如果不指定将使用构造 <see cref="DouyinMicroAppClient"/> 时的 <see cref="DouyinMicroAppClientOptions.AppId"/> 参数。
/// 获取或设置小程序 AppId。如果不指定将使用构造 <see cref="DouyinMicroAppClient"/> 时的 <see cref="DouyinMicroAppClientOptions.AppId"/> 参数。
/// </summary>
[Newtonsoft.Json.JsonProperty("app_id")]
[System.Text.Json.Serialization.JsonPropertyName("app_id")]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ namespace SKIT.FlurlHttpClient.ByteDance.MicroApp.Models
public class AppsUrlLinkQueryQuotaV1Request : DouyinMicroAppRequest
{
/// <summary>
/// 获取或设置小程序的 AppId。如果不指定将使用构造 <see cref="DouyinMicroAppClient"/> 时的 <see cref="DouyinMicroAppClientOptions.AppId"/> 参数。
/// 获取或设置小程序 AppId。如果不指定将使用构造 <see cref="DouyinMicroAppClient"/> 时的 <see cref="DouyinMicroAppClientOptions.AppId"/> 参数。
/// </summary>
[Newtonsoft.Json.JsonProperty("app_id")]
[System.Text.Json.Serialization.JsonPropertyName("app_id")]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ namespace SKIT.FlurlHttpClient.ByteDance.MicroApp.Models
public class AppsUrlQuerySchemaQuotaV1Request : DouyinMicroAppRequest
{
/// <summary>
/// 获取或设置小程序的 AppId。如果不指定将使用构造 <see cref="DouyinMicroAppClient"/> 时的 <see cref="DouyinMicroAppClientOptions.AppId"/> 参数。
/// 获取或设置小程序 AppId。如果不指定将使用构造 <see cref="DouyinMicroAppClient"/> 时的 <see cref="DouyinMicroAppClientOptions.AppId"/> 参数。
/// </summary>
[Newtonsoft.Json.JsonProperty("app_id")]
[System.Text.Json.Serialization.JsonPropertyName("app_id")]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ namespace SKIT.FlurlHttpClient.ByteDance.MicroApp.Models
public class AppsUrlQuerySchemaV1Request : DouyinMicroAppRequest
{
/// <summary>
/// 获取或设置小程序的 AppId。如果不指定将使用构造 <see cref="DouyinMicroAppClient"/> 时的 <see cref="DouyinMicroAppClientOptions.AppId"/> 参数。
/// 获取或设置小程序 AppId。如果不指定将使用构造 <see cref="DouyinMicroAppClient"/> 时的 <see cref="DouyinMicroAppClientOptions.AppId"/> 参数。
/// </summary>
[Newtonsoft.Json.JsonProperty("app_id")]
[System.Text.Json.Serialization.JsonPropertyName("app_id")]
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"app_name": "douyin",
"appid": "tt**********",
"path": "{}",
"width": 1000,
"line_color": {
"r": 0,
"g": 0,
"b": 0
},
"background": {
"r": 0,
"g": 0,
"b": 0
},
"set_icon": false
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"err_no": 0,
"err_msg": "",
"data": {
"img": "#######"
}
}

0 comments on commit 696ebbe

Please sign in to comment.