From ff251444e2fb1ac75ab63661d597ab386d68a9a2 Mon Sep 17 00:00:00 2001 From: Fu Diwei Date: Fri, 20 Jun 2025 10:57:29 +0800 Subject: [PATCH] =?UTF-8?q?feat(work):=20=E9=9A=8F=E5=AE=98=E6=96=B9?= =?UTF-8?q?=E6=9B=B4=E6=96=B0=E6=96=87=E6=A1=A3=E6=99=BA=E8=83=BD=E8=A1=A8?= =?UTF-8?q?=E6=A0=BC=E7=9B=B8=E5=85=B3=E6=8E=A5=E5=8F=A3=E6=A8=A1=E5=9E=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Events/Wedoc/SmartSheetChangeEvent.cs | 57 +++++++ .../CgibinWedocSmartSheetAddFieldsRequest.cs | 17 ++ .../CgibinWedocSmartSheetGetFieldsResponse.cs | 17 ++ .../CgibinWedocSmartSheetGetRecordsRequest.cs | 159 ++++++++++++++++++ ...gibinWedocSmartSheetUpdateFieldsRequest.cs | 11 ++ .../CgibinWedocSmartSheetUpdateViewRequest.cs | 123 +------------- .../Wedoc/SmartSheetChangeEvent.xml | 14 ++ ...gibinWedocSmartSheetGetRecordsRequest.json | 2 + 8 files changed, 278 insertions(+), 122 deletions(-) create mode 100644 src/SKIT.FlurlHttpClient.Wechat.Work/Events/Wedoc/SmartSheetChangeEvent.cs create mode 100644 test/SKIT.FlurlHttpClient.Wechat.Work.UnitTests/EventSamples/Wedoc/SmartSheetChangeEvent.xml diff --git a/src/SKIT.FlurlHttpClient.Wechat.Work/Events/Wedoc/SmartSheetChangeEvent.cs b/src/SKIT.FlurlHttpClient.Wechat.Work/Events/Wedoc/SmartSheetChangeEvent.cs new file mode 100644 index 00000000..1e4ea800 --- /dev/null +++ b/src/SKIT.FlurlHttpClient.Wechat.Work/Events/Wedoc/SmartSheetChangeEvent.cs @@ -0,0 +1,57 @@ +namespace SKIT.FlurlHttpClient.Wechat.Work.Events +{ + /// + /// 表示 EVENT.doc_change 事件的数据。 + /// + /// REF:
+ ///
+ ///
+ ///
+ ///
+ ///
+ /// + ///
+ ///
+ public class SmartSheetChangeEvent : WechatWorkEvent + { + /// + /// 获取或设置变更类型。 + /// + [Newtonsoft.Json.JsonProperty("ChangeType")] + [System.Text.Json.Serialization.JsonPropertyName("ChangeType")] + [System.Xml.Serialization.XmlElement("ChangeType")] + public string ChangeType { get; set; } = default!; + + /// + /// 获取或设置文档 ID。 + /// + [Newtonsoft.Json.JsonProperty("DocId")] + [System.Text.Json.Serialization.JsonPropertyName("DocId")] + [System.Xml.Serialization.XmlElement("DocId", IsNullable = true)] + public string? DocumentId { get; set; } + + /// + /// 获取或设置子表 ID。 + /// + [Newtonsoft.Json.JsonProperty("SheetId")] + [System.Text.Json.Serialization.JsonPropertyName("SheetId")] + [System.Xml.Serialization.XmlElement("SheetId", IsNullable = true)] + public string? SheetId { get; set; } + + /// + /// 获取或设置字段 ID 列表。 + /// + [Newtonsoft.Json.JsonProperty("FieldId")] + [System.Text.Json.Serialization.JsonPropertyName("FieldId")] + [System.Xml.Serialization.XmlElement("FieldId", Type = typeof(string), IsNullable = true)] + public string[]? FieldIdList { get; set; } + + /// + /// 获取或设置记录 ID 列表。 + /// + [Newtonsoft.Json.JsonProperty("RecordId")] + [System.Text.Json.Serialization.JsonPropertyName("RecordId")] + [System.Xml.Serialization.XmlElement("RecordId", Type = typeof(string), IsNullable = true)] + public string[]? RecordIdList { get; set; } + } +} diff --git a/src/SKIT.FlurlHttpClient.Wechat.Work/Models/CgibinWedoc/SmartSheet/CgibinWedocSmartSheetAddFieldsRequest.cs b/src/SKIT.FlurlHttpClient.Wechat.Work/Models/CgibinWedoc/SmartSheet/CgibinWedocSmartSheetAddFieldsRequest.cs index 24e67be0..d293d5c3 100644 --- a/src/SKIT.FlurlHttpClient.Wechat.Work/Models/CgibinWedoc/SmartSheet/CgibinWedocSmartSheetAddFieldsRequest.cs +++ b/src/SKIT.FlurlHttpClient.Wechat.Work/Models/CgibinWedoc/SmartSheet/CgibinWedocSmartSheetAddFieldsRequest.cs @@ -331,6 +331,16 @@ namespace SKIT.FlurlHttpClient.Wechat.Work.Models [System.Text.Json.Serialization.JsonPropertyName("use_separate")] public bool IsUseSeparate { get; set; } } + + public class BarcodeFieldProperty + { + /// + /// 获取或设置是否仅限手机扫描录入。 + /// + [Newtonsoft.Json.JsonProperty("mobile_scan_only")] + [System.Text.Json.Serialization.JsonPropertyName("mobile_scan_only")] + public bool IsMobileScanOnly { get; set; } + } } /// @@ -472,6 +482,13 @@ namespace SKIT.FlurlHttpClient.Wechat.Work.Models [Newtonsoft.Json.JsonProperty("property_percentage")] [System.Text.Json.Serialization.JsonPropertyName("property_percentage")] public Types.PercentageFieldProperty? PropertyAsPercentage { get; set; } + + /// + /// 获取或设置条码的字段属性。 + /// + [Newtonsoft.Json.JsonProperty("property_barcode")] + [System.Text.Json.Serialization.JsonPropertyName("property_barcode")] + public Types.BarcodeFieldProperty? PropertyAsBarcode { get; set; } } } diff --git a/src/SKIT.FlurlHttpClient.Wechat.Work/Models/CgibinWedoc/SmartSheet/CgibinWedocSmartSheetGetFieldsResponse.cs b/src/SKIT.FlurlHttpClient.Wechat.Work/Models/CgibinWedoc/SmartSheet/CgibinWedocSmartSheetGetFieldsResponse.cs index 52354636..bb631564 100644 --- a/src/SKIT.FlurlHttpClient.Wechat.Work/Models/CgibinWedoc/SmartSheet/CgibinWedocSmartSheetGetFieldsResponse.cs +++ b/src/SKIT.FlurlHttpClient.Wechat.Work/Models/CgibinWedoc/SmartSheet/CgibinWedocSmartSheetGetFieldsResponse.cs @@ -329,6 +329,16 @@ namespace SKIT.FlurlHttpClient.Wechat.Work.Models [System.Text.Json.Serialization.JsonPropertyName("use_separate")] public bool IsUseSeparate { get; set; } } + + public class BarcodeFieldProperty + { + /// + /// 获取或设置是否仅限手机扫描录入。 + /// + [Newtonsoft.Json.JsonProperty("mobile_scan_only")] + [System.Text.Json.Serialization.JsonPropertyName("mobile_scan_only")] + public bool IsMobileScanOnly { get; set; } + } } /// @@ -477,6 +487,13 @@ namespace SKIT.FlurlHttpClient.Wechat.Work.Models [Newtonsoft.Json.JsonProperty("property_percentage")] [System.Text.Json.Serialization.JsonPropertyName("property_percentage")] public Types.PercentageFieldProperty? PropertyAsPercentage { get; set; } + + /// + /// 获取或设置条码的字段属性。 + /// + [Newtonsoft.Json.JsonProperty("property_barcode")] + [System.Text.Json.Serialization.JsonPropertyName("property_barcode")] + public Types.BarcodeFieldProperty? PropertyAsBarcode { get; set; } } } diff --git a/src/SKIT.FlurlHttpClient.Wechat.Work/Models/CgibinWedoc/SmartSheet/CgibinWedocSmartSheetGetRecordsRequest.cs b/src/SKIT.FlurlHttpClient.Wechat.Work/Models/CgibinWedoc/SmartSheet/CgibinWedocSmartSheetGetRecordsRequest.cs index 0b690078..fe6ba6d6 100644 --- a/src/SKIT.FlurlHttpClient.Wechat.Work/Models/CgibinWedoc/SmartSheet/CgibinWedocSmartSheetGetRecordsRequest.cs +++ b/src/SKIT.FlurlHttpClient.Wechat.Work/Models/CgibinWedoc/SmartSheet/CgibinWedocSmartSheetGetRecordsRequest.cs @@ -25,6 +25,158 @@ namespace SKIT.FlurlHttpClient.Wechat.Work.Models [System.Text.Json.Serialization.JsonPropertyName("desc")] public bool IsDescend { get; set; } } + + public class FilterSpec + { + public static class Types + { + public class Condition + { + public static class Types + { + public class StringValue + { + /// + /// 获取或设置值。 + /// + [Newtonsoft.Json.JsonProperty("value")] + [System.Text.Json.Serialization.JsonPropertyName("value")] + public IList Value { get; set; } = new List(); + } + + public class NumberValue + { + /// + /// 获取或设置值。 + /// + [Newtonsoft.Json.JsonProperty("value")] + [System.Text.Json.Serialization.JsonPropertyName("value")] + public decimal Value { get; set; } + } + + public class BoolValue + { + /// + /// 获取或设置值。 + /// + [Newtonsoft.Json.JsonProperty("value")] + [System.Text.Json.Serialization.JsonPropertyName("value")] + public bool Value { get; set; } + } + + public class UserValue + { + /// + /// 获取或设置值。 + /// + [Newtonsoft.Json.JsonProperty("value")] + [System.Text.Json.Serialization.JsonPropertyName("value")] + public IList Value { get; set; } = new List(); + } + + public class DateTimeValue + { + public static class Types + { + public class Value + { + /// + /// 获取或设置日期类型。 + /// + [Newtonsoft.Json.JsonProperty("type")] + [System.Text.Json.Serialization.JsonPropertyName("type")] + public string Type { get; set; } = string.Empty; + + /// + /// 获取或设置日期时间值。 + /// + [Newtonsoft.Json.JsonProperty("value")] + [System.Text.Json.Serialization.JsonPropertyName("value")] + public IList? DateTimes { get; set; } + } + } + + /// + /// 获取或设置值。 + /// + [Newtonsoft.Json.JsonProperty("value")] + [System.Text.Json.Serialization.JsonPropertyName("value")] + public Types.Value Value { get; set; } = new Types.Value(); + } + } + + /// + /// 获取或设置字段 ID。 + /// + [Newtonsoft.Json.JsonProperty("field_id")] + [System.Text.Json.Serialization.JsonPropertyName("field_id")] + public string FieldId { get; set; } = string.Empty; + + /// + /// 获取或设置字段类型。 + /// + [Newtonsoft.Json.JsonProperty("field_type")] + [System.Text.Json.Serialization.JsonPropertyName("field_type")] + public string? FieldType { get; set; } + + /// + /// 获取或设置判断类型。 + /// + [Newtonsoft.Json.JsonProperty("operator")] + [System.Text.Json.Serialization.JsonPropertyName("operator")] + public string Operator { get; set; } = string.Empty; + + /// + /// 获取或设置文本值。 + /// + [Newtonsoft.Json.JsonProperty("string_value")] + [System.Text.Json.Serialization.JsonPropertyName("string_value")] + public Types.StringValue? StringValue { get; set; } + + /// + /// 获取或设置数字值。 + /// + [Newtonsoft.Json.JsonProperty("number_value")] + [System.Text.Json.Serialization.JsonPropertyName("number_value")] + public Types.NumberValue? NumberValue { get; set; } + + /// + /// 获取或设置布尔值。 + /// + [Newtonsoft.Json.JsonProperty("bool_value")] + [System.Text.Json.Serialization.JsonPropertyName("bool_value")] + public Types.BoolValue? BoolValue { get; set; } + + /// + /// 获取或设置人员值。 + /// + [Newtonsoft.Json.JsonProperty("user_value")] + [System.Text.Json.Serialization.JsonPropertyName("user_value")] + public Types.UserValue? UserValue { get; set; } + + /// + /// 获取或设置日期时间值。 + /// + [Newtonsoft.Json.JsonProperty("date_time_value")] + [System.Text.Json.Serialization.JsonPropertyName("date_time_value")] + public Types.DateTimeValue? DateTimeValue { get; set; } + } + } + + /// + /// 获取或设置条件连词。 + /// + [Newtonsoft.Json.JsonProperty("conjunction")] + [System.Text.Json.Serialization.JsonPropertyName("conjunction")] + public string Conjunction { get; set; } = string.Empty; + + /// + /// 获取或设置条件列表。 + /// + [Newtonsoft.Json.JsonProperty("conditions")] + [System.Text.Json.Serialization.JsonPropertyName("conditions")] + public IList ConditionList { get; set; } = new List(); + } } /// @@ -83,6 +235,13 @@ namespace SKIT.FlurlHttpClient.Wechat.Work.Models [System.Text.Json.Serialization.JsonPropertyName("sort")] public IList? SortFieldList { get; set; } + /// + /// 获取或设置过滤设置。 + /// + [Newtonsoft.Json.JsonProperty("filter_spec")] + [System.Text.Json.Serialization.JsonPropertyName("filter_spec")] + public Types.FilterSpec? FilterSpec { get; set; } + /// /// 获取或设置分页起始位置。 /// diff --git a/src/SKIT.FlurlHttpClient.Wechat.Work/Models/CgibinWedoc/SmartSheet/CgibinWedocSmartSheetUpdateFieldsRequest.cs b/src/SKIT.FlurlHttpClient.Wechat.Work/Models/CgibinWedoc/SmartSheet/CgibinWedocSmartSheetUpdateFieldsRequest.cs index a4e20a0d..239d78e8 100644 --- a/src/SKIT.FlurlHttpClient.Wechat.Work/Models/CgibinWedoc/SmartSheet/CgibinWedocSmartSheetUpdateFieldsRequest.cs +++ b/src/SKIT.FlurlHttpClient.Wechat.Work/Models/CgibinWedoc/SmartSheet/CgibinWedocSmartSheetUpdateFieldsRequest.cs @@ -102,6 +102,10 @@ namespace SKIT.FlurlHttpClient.Wechat.Work.Models public class PercentageFieldProperty : CgibinWedocSmartSheetAddFieldsRequest.Types.Field.Types.PercentageFieldProperty { } + + public class BarcodeFieldProperty : CgibinWedocSmartSheetAddFieldsRequest.Types.Field.Types.BarcodeFieldProperty + { + } } /// @@ -250,6 +254,13 @@ namespace SKIT.FlurlHttpClient.Wechat.Work.Models [Newtonsoft.Json.JsonProperty("property_percentage")] [System.Text.Json.Serialization.JsonPropertyName("property_percentage")] public Types.PercentageFieldProperty? PropertyAsPercentage { get; set; } + + /// + /// 获取或设置条码的字段属性。 + /// + [Newtonsoft.Json.JsonProperty("property_barcode")] + [System.Text.Json.Serialization.JsonPropertyName("property_barcode")] + public Types.BarcodeFieldProperty? PropertyAsBarcode { get; set; } } } diff --git a/src/SKIT.FlurlHttpClient.Wechat.Work/Models/CgibinWedoc/SmartSheet/CgibinWedocSmartSheetUpdateViewRequest.cs b/src/SKIT.FlurlHttpClient.Wechat.Work/Models/CgibinWedoc/SmartSheet/CgibinWedocSmartSheetUpdateViewRequest.cs index 54ec0d08..e3fbfe19 100644 --- a/src/SKIT.FlurlHttpClient.Wechat.Work/Models/CgibinWedoc/SmartSheet/CgibinWedocSmartSheetUpdateViewRequest.cs +++ b/src/SKIT.FlurlHttpClient.Wechat.Work/Models/CgibinWedoc/SmartSheet/CgibinWedocSmartSheetUpdateViewRequest.cs @@ -77,129 +77,8 @@ namespace SKIT.FlurlHttpClient.Wechat.Work.Models { public static class Types { - public class Condition + public class Condition : CgibinWedocSmartSheetGetRecordsRequest.Types.FilterSpec.Types.Condition { - public static class Types - { - public class StringValue - { - /// - /// 获取或设置值。 - /// - [Newtonsoft.Json.JsonProperty("value")] - [System.Text.Json.Serialization.JsonPropertyName("value")] - public IList Value { get; set; } = new List(); - } - - public class NumberValue - { - /// - /// 获取或设置值。 - /// - [Newtonsoft.Json.JsonProperty("value")] - [System.Text.Json.Serialization.JsonPropertyName("value")] - public decimal Value { get; set; } - } - - public class BoolValue - { - /// - /// 获取或设置值。 - /// - [Newtonsoft.Json.JsonProperty("value")] - [System.Text.Json.Serialization.JsonPropertyName("value")] - public bool Value { get; set; } - } - - public class UserValue - { - /// - /// 获取或设置值。 - /// - [Newtonsoft.Json.JsonProperty("value")] - [System.Text.Json.Serialization.JsonPropertyName("value")] - public IList Value { get; set; } = new List(); - } - - public class DateTimeValue - { - public static class Types - { - public class Value - { - /// - /// 获取或设置日期类型。 - /// - [Newtonsoft.Json.JsonProperty("type")] - [System.Text.Json.Serialization.JsonPropertyName("type")] - public string Type { get; set; } = string.Empty; - - /// - /// 获取或设置日期时间值。 - /// - [Newtonsoft.Json.JsonProperty("value")] - [System.Text.Json.Serialization.JsonPropertyName("value")] - public IList? DateTimes { get; set; } - } - } - - /// - /// 获取或设置值。 - /// - [Newtonsoft.Json.JsonProperty("value")] - [System.Text.Json.Serialization.JsonPropertyName("value")] - public Types.Value Value { get; set; } = new Types.Value(); - } - } - - /// - /// 获取或设置字段 ID。 - /// - [Newtonsoft.Json.JsonProperty("field_id")] - [System.Text.Json.Serialization.JsonPropertyName("field_id")] - public string FieldId { get; set; } = string.Empty; - - /// - /// 获取或设置判断类型。 - /// - [Newtonsoft.Json.JsonProperty("operator")] - [System.Text.Json.Serialization.JsonPropertyName("operator")] - public string Operator { get; set; } = string.Empty; - - /// - /// 获取或设置文本值。 - /// - [Newtonsoft.Json.JsonProperty("string_value")] - [System.Text.Json.Serialization.JsonPropertyName("string_value")] - public Types.StringValue? StringValue { get; set; } - - /// - /// 获取或设置数字值。 - /// - [Newtonsoft.Json.JsonProperty("number_value")] - [System.Text.Json.Serialization.JsonPropertyName("number_value")] - public Types.NumberValue? NumberValue { get; set; } - - /// - /// 获取或设置布尔值。 - /// - [Newtonsoft.Json.JsonProperty("bool_value")] - [System.Text.Json.Serialization.JsonPropertyName("bool_value")] - public Types.BoolValue? BoolValue { get; set; } - - /// - /// 获取或设置人员值。 - /// - [Newtonsoft.Json.JsonProperty("user_value")] - [System.Text.Json.Serialization.JsonPropertyName("user_value")] - public Types.UserValue? UserValue { get; set; } - - /// - /// 获取或设置日期时间值。 - /// - [Newtonsoft.Json.JsonProperty("date_time_value")] - [System.Text.Json.Serialization.JsonPropertyName("date_time_value")] - public Types.DateTimeValue? DateTimeValue { get; set; } } } diff --git a/test/SKIT.FlurlHttpClient.Wechat.Work.UnitTests/EventSamples/Wedoc/SmartSheetChangeEvent.xml b/test/SKIT.FlurlHttpClient.Wechat.Work.UnitTests/EventSamples/Wedoc/SmartSheetChangeEvent.xml new file mode 100644 index 00000000..abb29e9c --- /dev/null +++ b/test/SKIT.FlurlHttpClient.Wechat.Work.UnitTests/EventSamples/Wedoc/SmartSheetChangeEvent.xml @@ -0,0 +1,14 @@ + + + + 1348831860 + + + + + + + + + + diff --git a/test/SKIT.FlurlHttpClient.Wechat.Work.UnitTests/ModelSamples/CgibinWedoc/SmartSheet/CgibinWedocSmartSheetGetRecordsRequest.json b/test/SKIT.FlurlHttpClient.Wechat.Work.UnitTests/ModelSamples/CgibinWedoc/SmartSheet/CgibinWedocSmartSheetGetRecordsRequest.json index a1ca34be..17768c7c 100644 --- a/test/SKIT.FlurlHttpClient.Wechat.Work.UnitTests/ModelSamples/CgibinWedoc/SmartSheet/CgibinWedocSmartSheetGetRecordsRequest.json +++ b/test/SKIT.FlurlHttpClient.Wechat.Work.UnitTests/ModelSamples/CgibinWedoc/SmartSheet/CgibinWedocSmartSheetGetRecordsRequest.json @@ -16,6 +16,8 @@ "desc": false } ], + "filter_spec": { + }, "offset": 0, "limit": 100 }