1 files changed, 11 insertions, 1 deletions
diff --git a/LibMatrix.EventTypes/EventContent.cs b/LibMatrix.EventTypes/EventContent.cs
index d65a47f..a837252 100644
--- a/LibMatrix.EventTypes/EventContent.cs
+++ b/LibMatrix.EventTypes/EventContent.cs
@@ -1,10 +1,20 @@
+using System.Reflection;
using System.Text.Json;
using System.Text.Json.Nodes;
using System.Text.Json.Serialization;
namespace LibMatrix.EventTypes;
-public abstract class EventContent;
+public abstract class EventContent {
+ public static List<string> GetMatchingEventTypes<T>() where T : EventContent {
+ var type = typeof(T);
+ var eventTypes = new List<string>();
+ foreach (var attr in type.GetCustomAttributes<MatrixEventAttribute>(true)) {
+ eventTypes.Add(attr.EventName);
+ }
+ return eventTypes;
+ }
+}
public class UnknownEventContent : TimelineEventContent;
|