From 073d9846ba562950c505a1a82a249a287c943496 Mon Sep 17 00:00:00 2001 From: fudiwei Date: Thu, 12 Jan 2023 10:24:16 +0800 Subject: [PATCH] =?UTF-8?q?feat(work):=20=E6=96=B0=E5=A2=9E=E8=8B=A5?= =?UTF-8?q?=E5=B9=B2=E5=9B=9E=E8=B0=83=E9=80=9A=E7=9F=A5=E4=BA=8B=E4=BB=B6?= =?UTF-8?q?=E6=A8=A1=E5=9E=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Events/Push/CloseInactiveAgentEvent.cs | 17 ++++++ .../Events/Push/ReopenInactiveAgentEvent.cs | 17 ++++++ .../Service/EnterRegisterPackageEvent.cs | 58 +++++++++++++++++++ .../Events/Wedoc/DocumentChangeEvent.cs | 14 ++++- .../Push/CloseInactiveAgentEvent.xml | 8 +++ .../Push/ReopenInactiveAgentEvent.xml | 8 +++ .../Service/EnterRegisterPackageEvent.xml | 12 ++++ .../Wedoc/DocumentChangeEvent.xml | 2 + 8 files changed, 133 insertions(+), 3 deletions(-) create mode 100644 src/SKIT.FlurlHttpClient.Wechat.Work/Events/Push/CloseInactiveAgentEvent.cs create mode 100644 src/SKIT.FlurlHttpClient.Wechat.Work/Events/Push/ReopenInactiveAgentEvent.cs create mode 100644 src/SKIT.FlurlHttpClient.Wechat.Work/Events/Service/EnterRegisterPackageEvent.cs create mode 100644 test/SKIT.FlurlHttpClient.Wechat.Work.UnitTests/EventSamples/Push/CloseInactiveAgentEvent.xml create mode 100644 test/SKIT.FlurlHttpClient.Wechat.Work.UnitTests/EventSamples/Push/ReopenInactiveAgentEvent.xml create mode 100644 test/SKIT.FlurlHttpClient.Wechat.Work.UnitTests/EventSamples/Service/EnterRegisterPackageEvent.xml diff --git a/src/SKIT.FlurlHttpClient.Wechat.Work/Events/Push/CloseInactiveAgentEvent.cs b/src/SKIT.FlurlHttpClient.Wechat.Work/Events/Push/CloseInactiveAgentEvent.cs new file mode 100644 index 00000000..820dcfc1 --- /dev/null +++ b/src/SKIT.FlurlHttpClient.Wechat.Work/Events/Push/CloseInactiveAgentEvent.cs @@ -0,0 +1,17 @@ +namespace SKIT.FlurlHttpClient.Wechat.Work.Events +{ + /// + /// 表示 EVENT.close_inactive_agent 事件的数据。 + /// REF: https://developer.work.weixin.qq.com/document/path/90240 + /// REF: https://developer.work.weixin.qq.com/document/path/90376 + /// REF: https://developer.work.weixin.qq.com/document/path/90858 + /// + public class CloseInactiveAgentEvent : WechatWorkEvent, WechatWorkEvent.Serialization.IXmlSerializable + { + /// + /// 获取或设置应用 ID。 + /// + [System.Xml.Serialization.XmlElement("AgentID")] + public int AgentId { get; set; } + } +} diff --git a/src/SKIT.FlurlHttpClient.Wechat.Work/Events/Push/ReopenInactiveAgentEvent.cs b/src/SKIT.FlurlHttpClient.Wechat.Work/Events/Push/ReopenInactiveAgentEvent.cs new file mode 100644 index 00000000..d6f010c4 --- /dev/null +++ b/src/SKIT.FlurlHttpClient.Wechat.Work/Events/Push/ReopenInactiveAgentEvent.cs @@ -0,0 +1,17 @@ +namespace SKIT.FlurlHttpClient.Wechat.Work.Events +{ + /// + /// 表示 EVENT.reopen_inactive_agent 事件的数据。 + /// REF: https://developer.work.weixin.qq.com/document/path/90240 + /// REF: https://developer.work.weixin.qq.com/document/path/90376 + /// REF: https://developer.work.weixin.qq.com/document/path/90858 + /// + public class ReopenInactiveAgentEvent : WechatWorkEvent, WechatWorkEvent.Serialization.IXmlSerializable + { + /// + /// 获取或设置应用 ID。 + /// + [System.Xml.Serialization.XmlElement("AgentID")] + public int AgentId { get; set; } + } +} diff --git a/src/SKIT.FlurlHttpClient.Wechat.Work/Events/Service/EnterRegisterPackageEvent.cs b/src/SKIT.FlurlHttpClient.Wechat.Work/Events/Service/EnterRegisterPackageEvent.cs new file mode 100644 index 00000000..f901873a --- /dev/null +++ b/src/SKIT.FlurlHttpClient.Wechat.Work/Events/Service/EnterRegisterPackageEvent.cs @@ -0,0 +1,58 @@ +namespace SKIT.FlurlHttpClient.Wechat.Work.Events +{ + /// + /// 表示 INFO.enter_register_package 事件的数据。 + /// REF: https://developer.work.weixin.qq.com/document/path/90585 + /// REF: https://developer.work.weixin.qq.com/document/path/90810 + /// + public class EnterRegisterPackageEvent : WechatWorkEvent, WechatWorkEvent.Serialization.IXmlSerializable + { + public static class Types + { + public class AuthorizerUser + { + /// + /// 获取或设置成员账号。 + /// + [System.Xml.Serialization.XmlElement("UserId")] + public string UserId { get; set; } = default!; + } + } + + /// + /// 获取或设置服务商 CorpId。 + /// + [System.Xml.Serialization.XmlElement("ServiceCorpId")] + public string ServiceCorpId { get; set; } = default!; + + /// + /// 获取或设置授权方的 CorpId。 + /// + [System.Xml.Serialization.XmlElement("AuthCorpId")] + public string AuthorizerCorpId { get; set; } = default!; + + /// + /// 获取或设置注册码。 + /// + [System.Xml.Serialization.XmlElement("RegisterCode")] + public string RegisterCode { get; set; } = default!; + + /// + /// 获取或设置授权管理员信息。 + /// + [System.Xml.Serialization.XmlElement("AuthUserInfo", IsNullable = true)] + public Types.AuthorizerUser? AuthorizerUser { get; set; } + + /// + /// 获取或设置推广包 ID。 + /// + [System.Xml.Serialization.XmlElement("TemplateId")] + public string TemplateId { get; set; } = default!; + + /// + /// 获取或设置自定义渠道参数。 + /// + [System.Xml.Serialization.XmlElement("State", IsNullable = true)] + public string? State { get; set; } + } +} diff --git a/src/SKIT.FlurlHttpClient.Wechat.Work/Events/Wedoc/DocumentChangeEvent.cs b/src/SKIT.FlurlHttpClient.Wechat.Work/Events/Wedoc/DocumentChangeEvent.cs index 1c3f995b..0e93e3ea 100644 --- a/src/SKIT.FlurlHttpClient.Wechat.Work/Events/Wedoc/DocumentChangeEvent.cs +++ b/src/SKIT.FlurlHttpClient.Wechat.Work/Events/Wedoc/DocumentChangeEvent.cs @@ -1,10 +1,12 @@ -namespace SKIT.FlurlHttpClient.Wechat.Work.Events +namespace SKIT.FlurlHttpClient.Wechat.Work.Events { /// /// 表示 EVENT.doc_change 事件的数据。 /// REF: https://developer.work.weixin.qq.com/document/path/97833 /// REF: https://developer.work.weixin.qq.com/document/path/97834 /// REF: https://developer.work.weixin.qq.com/document/path/97835 + /// REF: https://developer.work.weixin.qq.com/document/path/98095 + /// REF: https://developer.work.weixin.qq.com/document/path/98096 /// public class DocumentChangeEvent : WechatWorkEvent, WechatWorkEvent.Serialization.IXmlSerializable { @@ -17,7 +19,13 @@ /// /// 获取或设置文档 ID 列表。 /// - [System.Xml.Serialization.XmlElement("DocId", Type = typeof(string))] - public string[] DocumentIdList { get; set; } = default!; + [System.Xml.Serialization.XmlElement("DocId", Type = typeof(string), IsNullable = true)] + public string[]? DocumentIdList { get; set; } + + /// + /// 获取或设置收集表 ID 列表。 + /// + [System.Xml.Serialization.XmlElement("FormId", Type = typeof(string), IsNullable = true)] + public string[]? FormIdList { get; set; } } } diff --git a/test/SKIT.FlurlHttpClient.Wechat.Work.UnitTests/EventSamples/Push/CloseInactiveAgentEvent.xml b/test/SKIT.FlurlHttpClient.Wechat.Work.UnitTests/EventSamples/Push/CloseInactiveAgentEvent.xml new file mode 100644 index 00000000..c9d51ffe --- /dev/null +++ b/test/SKIT.FlurlHttpClient.Wechat.Work.UnitTests/EventSamples/Push/CloseInactiveAgentEvent.xml @@ -0,0 +1,8 @@ + + + + 123456789 + + + 1 + diff --git a/test/SKIT.FlurlHttpClient.Wechat.Work.UnitTests/EventSamples/Push/ReopenInactiveAgentEvent.xml b/test/SKIT.FlurlHttpClient.Wechat.Work.UnitTests/EventSamples/Push/ReopenInactiveAgentEvent.xml new file mode 100644 index 00000000..e8113f37 --- /dev/null +++ b/test/SKIT.FlurlHttpClient.Wechat.Work.UnitTests/EventSamples/Push/ReopenInactiveAgentEvent.xml @@ -0,0 +1,8 @@ + + + + 123456789 + + + 1 + diff --git a/test/SKIT.FlurlHttpClient.Wechat.Work.UnitTests/EventSamples/Service/EnterRegisterPackageEvent.xml b/test/SKIT.FlurlHttpClient.Wechat.Work.UnitTests/EventSamples/Service/EnterRegisterPackageEvent.xml new file mode 100644 index 00000000..baff19a5 --- /dev/null +++ b/test/SKIT.FlurlHttpClient.Wechat.Work.UnitTests/EventSamples/Service/EnterRegisterPackageEvent.xml @@ -0,0 +1,12 @@ + + + + 1671632600 + + + + + + + + diff --git a/test/SKIT.FlurlHttpClient.Wechat.Work.UnitTests/EventSamples/Wedoc/DocumentChangeEvent.xml b/test/SKIT.FlurlHttpClient.Wechat.Work.UnitTests/EventSamples/Wedoc/DocumentChangeEvent.xml index 4abbd1ed..81d30a5f 100644 --- a/test/SKIT.FlurlHttpClient.Wechat.Work.UnitTests/EventSamples/Wedoc/DocumentChangeEvent.xml +++ b/test/SKIT.FlurlHttpClient.Wechat.Work.UnitTests/EventSamples/Wedoc/DocumentChangeEvent.xml @@ -7,4 +7,6 @@ + +