using System; using System.Collections.Generic; using System.Linq; namespace SKIT.FlurlHttpClient.Wechat.Api.Models { /// /// 表示 [POST] /wxa/submit_audit 接口的请求。 /// public class WxaSubmitAuditRequest : WechatApiRequest { public static class Types { public class Page { /// /// 获取或设置页面路径。 /// [Newtonsoft.Json.JsonProperty("address")] [System.Text.Json.Serialization.JsonPropertyName("address")] public string PagePath { get; set; } = string.Empty; /// /// 获取或设置页面标题。 /// [Newtonsoft.Json.JsonProperty("title")] [System.Text.Json.Serialization.JsonPropertyName("title")] public string? Title { get; set; } /// /// 获取或设置标签,使用空格分隔。 /// [Newtonsoft.Json.JsonProperty("tag")] [System.Text.Json.Serialization.JsonPropertyName("tag")] public string? Tag { get; set; } /// /// 获取或设置一级类目 ID。 /// [Newtonsoft.Json.JsonProperty("first_id")] [System.Text.Json.Serialization.JsonPropertyName("first_id")] public int? FirstCategoryId { get; set; } /// /// 获取或设置一级类目名称。 /// [Newtonsoft.Json.JsonProperty("first_class")] [System.Text.Json.Serialization.JsonPropertyName("first_class")] public string? FirstCategoryName { get; set; } /// /// 获取或设置二级类目 ID。 /// [Newtonsoft.Json.JsonProperty("second_id")] [System.Text.Json.Serialization.JsonPropertyName("second_id")] public int? SecondCategoryId { get; set; } /// /// 获取或设置二级类目名称。 /// [Newtonsoft.Json.JsonProperty("second_class")] [System.Text.Json.Serialization.JsonPropertyName("second_class")] public string? SecondCategoryName { get; set; } /// /// 获取或设置三级类目 ID。 /// [Newtonsoft.Json.JsonProperty("third_id")] [System.Text.Json.Serialization.JsonPropertyName("third_id")] public int? ThirdCategoryId { get; set; } /// /// 获取或设置三级类目名称。 /// [Newtonsoft.Json.JsonProperty("third_class")] [System.Text.Json.Serialization.JsonPropertyName("third_class")] public string? ThirdCategoryName { get; set; } } public class Preview { /// /// 获取或设置录屏视频 MediaId 列表。 /// [Newtonsoft.Json.JsonProperty("video_id_list")] [System.Text.Json.Serialization.JsonPropertyName("video_id_list")] public IList? VideoMediaIdList { get; set; } /// /// 获取或设置屏幕截图 MediaId 列表。 /// [Newtonsoft.Json.JsonProperty("pic_id_list")] [System.Text.Json.Serialization.JsonPropertyName("pic_id_list")] public IList? PictureMediaIdList { get; set; } } public class UGCDeclaration { /// /// 获取或设置场景值列表。 /// [Newtonsoft.Json.JsonProperty("scene")] [System.Text.Json.Serialization.JsonPropertyName("scene")] public IList? SceneLsit { get; set; } /// /// 获取或设置其他场景说明。 /// [Newtonsoft.Json.JsonProperty("other_scene_desc")] [System.Text.Json.Serialization.JsonPropertyName("other_scene_desc")] public string? OtherSceneDescription { get; set; } /// /// 获取或设置审核机制列表。 /// [Newtonsoft.Json.JsonProperty("method")] [System.Text.Json.Serialization.JsonPropertyName("method")] public IList? AuditMethodList { get; set; } /// /// 获取或设置是否有审核团队。 /// [Newtonsoft.Json.JsonProperty("has_audit_team")] [Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.NumericalNullableBooleanConverter))] [System.Text.Json.Serialization.JsonPropertyName("has_audit_team")] [System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Converters.NumericalNullableBooleanConverter))] public bool? HasAuditTeam { get; set; } /// /// 获取或设置审核机制说明。 /// [Newtonsoft.Json.JsonProperty("audit_desc")] [System.Text.Json.Serialization.JsonPropertyName("audit_desc")] public string? AuditDescription { get; set; } } } internal static class Converters { internal class NewtonsoftJsonMediaIdListConverter : Newtonsoft.Json.JsonConverter?> { public override bool CanRead { get { return true; } } public override bool CanWrite { get { return true; } } public override IList? ReadJson(Newtonsoft.Json.JsonReader reader, Type objectType, IList? existingValue, bool hasExistingValue, Newtonsoft.Json.JsonSerializer serializer) { if (reader.TokenType == Newtonsoft.Json.JsonToken.Null) { return existingValue; } else if (reader.TokenType == Newtonsoft.Json.JsonToken.String) { string? value = serializer.Deserialize(reader); if (value == null) return existingValue; return value.Split(new char[] { '|' }, StringSplitOptions.RemoveEmptyEntries).ToList(); } throw new Newtonsoft.Json.JsonReaderException(); } public override void WriteJson(Newtonsoft.Json.JsonWriter writer, IList? value, Newtonsoft.Json.JsonSerializer serializer) { if (value != null) writer.WriteValue(string.Join("|", value)); else writer.WriteNull(); } } internal class SystemTextJsonMediaIdListConverter : System.Text.Json.Serialization.JsonConverter?> { public override IList? Read(ref System.Text.Json.Utf8JsonReader reader, Type typeToConvert, System.Text.Json.JsonSerializerOptions options) { if (reader.TokenType == System.Text.Json.JsonTokenType.Null) { return null; } else if (reader.TokenType == System.Text.Json.JsonTokenType.String) { string? value = reader.GetString(); if (value == null) return null; return value.Split(new char[] { '|' }, StringSplitOptions.RemoveEmptyEntries).ToList(); } throw new System.Text.Json.JsonException(); } public override void Write(System.Text.Json.Utf8JsonWriter writer, IList? value, System.Text.Json.JsonSerializerOptions options) { if (value != null) writer.WriteStringValue(string.Join("|", value)); else writer.WriteNullValue(); } } } /// /// 获取或设置审核页面列表。 /// [Newtonsoft.Json.JsonProperty("item_list")] [System.Text.Json.Serialization.JsonPropertyName("item_list")] public IList PageList { get; set; } = new List(); /// /// 获取或设置预览信息。 /// [Newtonsoft.Json.JsonProperty("preview_info")] [System.Text.Json.Serialization.JsonPropertyName("preview_info")] public Types.Preview? Preview { get; set; } /// /// 获取或设置版本说明。 /// [Newtonsoft.Json.JsonProperty("version_desc")] [System.Text.Json.Serialization.JsonPropertyName("version_desc")] public string? VersionDescription { get; set; } /// /// 获取或设置反馈内容。 /// [Newtonsoft.Json.JsonProperty("feedback_info")] [System.Text.Json.Serialization.JsonPropertyName("feedback_info")] public string? Feedback { get; set; } /// /// 获取或设置反馈附件 MediaId 列表。 /// [Newtonsoft.Json.JsonProperty("feedback_stuff")] [Newtonsoft.Json.JsonConverter(typeof(Converters.NewtonsoftJsonMediaIdListConverter))] [System.Text.Json.Serialization.JsonPropertyName("feedback_stuff")] [System.Text.Json.Serialization.JsonConverter(typeof(Converters.SystemTextJsonMediaIdListConverter))] public IList? FeedbackStuffMediaIdList { get; set; } /// /// 获取或设置 UGC 声明信息。 /// [Newtonsoft.Json.JsonProperty("ugc_declare")] [System.Text.Json.Serialization.JsonPropertyName("ugc_declare")] public Types.UGCDeclaration? UGCDeclaration { get; set; } } }