about summary refs log tree commit diff
path: root/MatrixRoomUtils.Core
diff options
context:
space:
mode:
Diffstat (limited to 'MatrixRoomUtils.Core')
-rw-r--r--MatrixRoomUtils.Core/AuthenticatedHomeServer.cs1
-rw-r--r--MatrixRoomUtils.Core/CreateEvent.cs20
-rw-r--r--MatrixRoomUtils.Core/Interfaces/IHomeServer.cs18
-rw-r--r--MatrixRoomUtils.Core/Responses/CreateRoomRequest.cs3
-rw-r--r--MatrixRoomUtils.Core/RoomTypes/GenericRoom.cs20
-rw-r--r--MatrixRoomUtils.Core/Services/HomeserverResolverService.cs2
-rw-r--r--MatrixRoomUtils.Core/StateEvent.cs6
-rw-r--r--MatrixRoomUtils.Core/StateEventTypes/Common/MjolnirShortcodeEventData.cs2
-rw-r--r--MatrixRoomUtils.Core/StateEventTypes/Common/RoomEmotesEventData.cs2
-rw-r--r--MatrixRoomUtils.Core/StateEventTypes/Spec/CanonicalAliasEventData.cs2
-rw-r--r--MatrixRoomUtils.Core/StateEventTypes/Spec/GuestAccessEventData.cs (renamed from MatrixRoomUtils.Core/StateEventTypes/Spec/GuestAccessData.cs)4
-rw-r--r--MatrixRoomUtils.Core/StateEventTypes/Spec/HistoryVisibilityEventData.cs (renamed from MatrixRoomUtils.Core/StateEventTypes/Spec/HistoryVisibilityData.cs)4
-rw-r--r--MatrixRoomUtils.Core/StateEventTypes/Spec/JoinRulesEventData.cs2
-rw-r--r--MatrixRoomUtils.Core/StateEventTypes/Spec/PolicyRuleStateEventData.cs2
-rw-r--r--MatrixRoomUtils.Core/StateEventTypes/Spec/PowerLevelEventData.cs (renamed from MatrixRoomUtils.Core/StateEventTypes/Spec/PowerLevelEvent.cs)4
-rw-r--r--MatrixRoomUtils.Core/StateEventTypes/Spec/PresenceStateEventData.cs2
-rw-r--r--MatrixRoomUtils.Core/StateEventTypes/Spec/ProfileResponseEventData.cs (renamed from MatrixRoomUtils.Core/StateEventTypes/Spec/ProfileResponse.cs)5
-rw-r--r--MatrixRoomUtils.Core/StateEventTypes/Spec/RoomAliasEventData.cs2
-rw-r--r--MatrixRoomUtils.Core/StateEventTypes/Spec/RoomAvatarEventData.cs2
-rw-r--r--MatrixRoomUtils.Core/StateEventTypes/Spec/RoomCreateEventData.cs2
-rw-r--r--MatrixRoomUtils.Core/StateEventTypes/Spec/RoomEncryptionEventData.cs2
-rw-r--r--MatrixRoomUtils.Core/StateEventTypes/Spec/RoomMemberEventData.cs2
-rw-r--r--MatrixRoomUtils.Core/StateEventTypes/Spec/RoomMessageEventData.cs (renamed from MatrixRoomUtils.Core/StateEventTypes/Spec/MessageEventData.cs)4
-rw-r--r--MatrixRoomUtils.Core/StateEventTypes/Spec/RoomNameEventData.cs2
-rw-r--r--MatrixRoomUtils.Core/StateEventTypes/Spec/RoomPinnedEventData.cs2
-rw-r--r--MatrixRoomUtils.Core/StateEventTypes/Spec/RoomTopicEventData.cs2
-rw-r--r--MatrixRoomUtils.Core/StateEventTypes/Spec/RoomTypingEventData.cs2
-rw-r--r--MatrixRoomUtils.Core/StateEventTypes/Spec/ServerACLData.cs2
-rw-r--r--MatrixRoomUtils.Core/StateEventTypes/Spec/SpaceChildEventData.cs2
29 files changed, 47 insertions, 78 deletions
diff --git a/MatrixRoomUtils.Core/AuthenticatedHomeServer.cs b/MatrixRoomUtils.Core/AuthenticatedHomeServer.cs
index 09da766..fbbb99f 100644
--- a/MatrixRoomUtils.Core/AuthenticatedHomeServer.cs
+++ b/MatrixRoomUtils.Core/AuthenticatedHomeServer.cs
@@ -9,6 +9,7 @@ using MatrixRoomUtils.Core.Helpers;
 using MatrixRoomUtils.Core.Interfaces;
 using MatrixRoomUtils.Core.Responses;
 using MatrixRoomUtils.Core.Responses.Admin;
+using MatrixRoomUtils.Core.RoomTypes;
 using MatrixRoomUtils.Core.Services;
 
 namespace MatrixRoomUtils.Core;
diff --git a/MatrixRoomUtils.Core/CreateEvent.cs b/MatrixRoomUtils.Core/CreateEvent.cs
deleted file mode 100644
index a7022c5..0000000
--- a/MatrixRoomUtils.Core/CreateEvent.cs
+++ /dev/null
@@ -1,20 +0,0 @@
-using System.Text.Json.Serialization;
-
-namespace MatrixRoomUtils.Core;
-
-public class CreateEvent {
-    [JsonPropertyName("creator")]
-    public string Creator { get; set; }
-
-    [JsonPropertyName("room_version")]
-    public string RoomVersion { get; set; }
-
-    [JsonPropertyName("type")]
-    public string? Type { get; set; }
-
-    [JsonPropertyName("predecessor")]
-    public object? Predecessor { get; set; }
-
-    [JsonPropertyName("m.federate")]
-    public bool Federate { get; set; }
-}
\ No newline at end of file
diff --git a/MatrixRoomUtils.Core/Interfaces/IHomeServer.cs b/MatrixRoomUtils.Core/Interfaces/IHomeServer.cs
index 4ee2a3e..d41a6cd 100644
--- a/MatrixRoomUtils.Core/Interfaces/IHomeServer.cs
+++ b/MatrixRoomUtils.Core/Interfaces/IHomeServer.cs
@@ -2,6 +2,7 @@ using System.Net.Http.Json;
 using System.Text.Json;
 using MatrixRoomUtils.Core.Extensions;
 using MatrixRoomUtils.Core.StateEventTypes;
+using MatrixRoomUtils.Core.StateEventTypes.Spec;
 
 namespace MatrixRoomUtils.Core.Interfaces;
 
@@ -12,27 +13,16 @@ public class IHomeServer {
 
     protected internal MatrixHttpClient _httpClient { get; set; } = new();
 
-    public async Task<ProfileResponse> GetProfile(string mxid, bool debounce = false, bool cache = true) {
-        // if (cache) {
-        //     if (debounce) await Task.Delay(Random.Shared.Next(100, 500));
-        //     if (_profileCache.ContainsKey(mxid)) {
-        //         while (_profileCache[mxid] == null) {
-        //             Console.WriteLine($"Waiting for profile cache for {mxid}, currently {_profileCache[mxid]?.ToJson() ?? "null"} within {_profileCache.Count} profiles...");
-        //             await Task.Delay(Random.Shared.Next(50, 500));
-        //         }
-        //
-        //         return _profileCache[mxid];
-        //     }
-        // }
+    public async Task<ProfileResponseEventData> GetProfile(string mxid) {
         if(mxid is null) throw new ArgumentNullException(nameof(mxid));
         if (_profileCache.ContainsKey(mxid)) {
             if (_profileCache[mxid] is SemaphoreSlim s) await s.WaitAsync();
-            if (_profileCache[mxid] is ProfileResponse p) return p;
+            if (_profileCache[mxid] is ProfileResponseEventData p) return p;
         }
         _profileCache[mxid] = new SemaphoreSlim(1);
         
         var resp = await _httpClient.GetAsync($"/_matrix/client/v3/profile/{mxid}");
-        var data = await resp.Content.ReadFromJsonAsync<ProfileResponse>();
+        var data = await resp.Content.ReadFromJsonAsync<ProfileResponseEventData>();
         if (!resp.IsSuccessStatusCode) Console.WriteLine("Profile: " + data);
         _profileCache[mxid] = data;
         
diff --git a/MatrixRoomUtils.Core/Responses/CreateRoomRequest.cs b/MatrixRoomUtils.Core/Responses/CreateRoomRequest.cs
index 8719b5a..334c05c 100644
--- a/MatrixRoomUtils.Core/Responses/CreateRoomRequest.cs
+++ b/MatrixRoomUtils.Core/Responses/CreateRoomRequest.cs
@@ -3,6 +3,7 @@ using System.Text.Json.Serialization;
 using System.Text.RegularExpressions;
 using MatrixRoomUtils.Core.Interfaces;
 using MatrixRoomUtils.Core.StateEventTypes;
+using MatrixRoomUtils.Core.StateEventTypes.Spec;
 
 namespace MatrixRoomUtils.Core.Responses;
 
@@ -28,7 +29,7 @@ public class CreateRoomRequest {
     public string Visibility { get; set; } = null!;
 
     [JsonPropertyName("power_level_content_override")]
-    public PowerLevelEvent PowerLevelContentOverride { get; set; } = null!;
+    public PowerLevelEventData PowerLevelContentOverride { get; set; } = null!;
 
     [JsonPropertyName("creation_content")]
     public JsonObject CreationContent { get; set; } = new();
diff --git a/MatrixRoomUtils.Core/RoomTypes/GenericRoom.cs b/MatrixRoomUtils.Core/RoomTypes/GenericRoom.cs
index 879ae6b..db4d4ce 100644
--- a/MatrixRoomUtils.Core/RoomTypes/GenericRoom.cs
+++ b/MatrixRoomUtils.Core/RoomTypes/GenericRoom.cs
@@ -3,11 +3,9 @@ using System.Text.Json;
 using System.Web;
 using MatrixRoomUtils.Core.Extensions;
 using MatrixRoomUtils.Core.Responses;
-using MatrixRoomUtils.Core.RoomTypes;
-using MatrixRoomUtils.Core.StateEventTypes;
-using Microsoft.Extensions.Logging;
+using MatrixRoomUtils.Core.StateEventTypes.Spec;
 
-namespace MatrixRoomUtils.Core;
+namespace MatrixRoomUtils.Core.RoomTypes;
 
 public class GenericRoom {
     internal readonly AuthenticatedHomeServer _homeServer;
@@ -111,14 +109,14 @@ public class GenericRoom {
     public async Task<JoinRulesEventData> GetJoinRuleAsync() =>
         await GetStateAsync<JoinRulesEventData>("m.room.join_rules");
 
-    public async Task<HistoryVisibilityData?> GetHistoryVisibilityAsync() =>
-        await GetStateAsync<HistoryVisibilityData>("m.room.history_visibility");
+    public async Task<HistoryVisibilityEventData?> GetHistoryVisibilityAsync() =>
+        await GetStateAsync<HistoryVisibilityEventData>("m.room.history_visibility");
 
-    public async Task<GuestAccessData?> GetGuestAccessAsync() =>
-        await GetStateAsync<GuestAccessData>("m.room.guest_access");
+    public async Task<GuestAccessEventData?> GetGuestAccessAsync() =>
+        await GetStateAsync<GuestAccessEventData>("m.room.guest_access");
 
-    public async Task<CreateEvent> GetCreateEventAsync() =>
-        await GetStateAsync<CreateEvent>("m.room.create");
+    public async Task<RoomCreateEventData> GetCreateEventAsync() =>
+        await GetStateAsync<RoomCreateEventData>("m.room.create");
 
     public async Task<string?> GetRoomType() {
         var res = await GetStateAsync<RoomCreateEventData>("m.room.create");
@@ -149,7 +147,7 @@ public class GenericRoom {
         await (await _httpClient.PostAsJsonAsync($"/_matrix/client/v3/rooms/{RoomId}/state/{eventType}", content))
             .Content.ReadFromJsonAsync<EventIdResponse>();
 
-    public async Task<EventIdResponse> SendMessageEventAsync(string eventType, MessageEventData content) {
+    public async Task<EventIdResponse> SendMessageEventAsync(string eventType, RoomMessageEventData content) {
         var res = await _httpClient.PutAsJsonAsync(
             $"/_matrix/client/v3/rooms/{RoomId}/send/{eventType}/" + Guid.NewGuid(), content);
         var resu = await res.Content.ReadFromJsonAsync<EventIdResponse>();
diff --git a/MatrixRoomUtils.Core/Services/HomeserverResolverService.cs b/MatrixRoomUtils.Core/Services/HomeserverResolverService.cs
index 526a261..e4d8063 100644
--- a/MatrixRoomUtils.Core/Services/HomeserverResolverService.cs
+++ b/MatrixRoomUtils.Core/Services/HomeserverResolverService.cs
@@ -6,7 +6,7 @@ using Microsoft.Extensions.Logging;
 namespace MatrixRoomUtils.Core.Services; 
 
 public class HomeserverResolverService {
-    private readonly MatrixHttpClient _httpClient = new MatrixHttpClient();
+    private readonly MatrixHttpClient _httpClient = new();
     private readonly ILogger<HomeserverResolverService> _logger;
 
     private static Dictionary<string, object> _wellKnownCache = new();
diff --git a/MatrixRoomUtils.Core/StateEvent.cs b/MatrixRoomUtils.Core/StateEvent.cs
index 18b4632..901a194 100644
--- a/MatrixRoomUtils.Core/StateEvent.cs
+++ b/MatrixRoomUtils.Core/StateEvent.cs
@@ -53,10 +53,6 @@ public class StateEvent {
         }
     }
 
-    public T1 GetContent<T1>() where T1 : IStateEventType {
-        return RawContent.Deserialize<T1>();
-    }
-
     [JsonIgnore]
     public Type GetType {
         get {
@@ -81,7 +77,7 @@ public class StateEvent {
                         RawContent.ToJson());
                     Console.WriteLine($"Saved to unknown_state_events/{Type}/{stateEventResponse.EventId}.json");
                 }
-                else if (RawContent.FindExtraJsonObjectFields(type)) {
+                else if (RawContent is not null && RawContent.FindExtraJsonObjectFields(type)) {
                     Directory.CreateDirectory($"unknown_state_events/{Type}");
                     File.WriteAllText($"unknown_state_events/{Type}/{stateEventResponse.EventId}.json",
                         RawContent.ToJson());
diff --git a/MatrixRoomUtils.Core/StateEventTypes/Common/MjolnirShortcodeEventData.cs b/MatrixRoomUtils.Core/StateEventTypes/Common/MjolnirShortcodeEventData.cs
index efc946d..66dcdb9 100644
--- a/MatrixRoomUtils.Core/StateEventTypes/Common/MjolnirShortcodeEventData.cs
+++ b/MatrixRoomUtils.Core/StateEventTypes/Common/MjolnirShortcodeEventData.cs
@@ -2,7 +2,7 @@ using System.Text.Json.Serialization;
 using MatrixRoomUtils.Core.Extensions;
 using MatrixRoomUtils.Core.Interfaces;
 
-namespace MatrixRoomUtils.Core.StateEventTypes;
+namespace MatrixRoomUtils.Core.StateEventTypes.Common;
 
 [MatrixEvent(EventName = "org.matrix.mjolnir.shortcode")]
 public class MjolnirShortcodeEventData : IStateEventType {
diff --git a/MatrixRoomUtils.Core/StateEventTypes/Common/RoomEmotesEventData.cs b/MatrixRoomUtils.Core/StateEventTypes/Common/RoomEmotesEventData.cs
index 4a75b98..633998c 100644
--- a/MatrixRoomUtils.Core/StateEventTypes/Common/RoomEmotesEventData.cs
+++ b/MatrixRoomUtils.Core/StateEventTypes/Common/RoomEmotesEventData.cs
@@ -2,7 +2,7 @@ using System.Text.Json.Serialization;
 using MatrixRoomUtils.Core.Extensions;
 using MatrixRoomUtils.Core.Interfaces;
 
-namespace MatrixRoomUtils.Core.StateEventTypes; 
+namespace MatrixRoomUtils.Core.StateEventTypes.Common; 
 
 [MatrixEvent(EventName = "im.ponies.room_emotes")]
 public class RoomEmotesEventData : IStateEventType {
diff --git a/MatrixRoomUtils.Core/StateEventTypes/Spec/CanonicalAliasEventData.cs b/MatrixRoomUtils.Core/StateEventTypes/Spec/CanonicalAliasEventData.cs
index 4d6f9c3..354f99d 100644
--- a/MatrixRoomUtils.Core/StateEventTypes/Spec/CanonicalAliasEventData.cs
+++ b/MatrixRoomUtils.Core/StateEventTypes/Spec/CanonicalAliasEventData.cs
@@ -2,7 +2,7 @@ using System.Text.Json.Serialization;
 using MatrixRoomUtils.Core.Extensions;
 using MatrixRoomUtils.Core.Interfaces;
 
-namespace MatrixRoomUtils.Core.StateEventTypes; 
+namespace MatrixRoomUtils.Core.StateEventTypes.Spec; 
 
 [MatrixEvent(EventName = "m.room.canonical_alias")]
 public class CanonicalAliasEventData : IStateEventType {
diff --git a/MatrixRoomUtils.Core/StateEventTypes/Spec/GuestAccessData.cs b/MatrixRoomUtils.Core/StateEventTypes/Spec/GuestAccessEventData.cs
index 1727ce9..c5b92ad 100644
--- a/MatrixRoomUtils.Core/StateEventTypes/Spec/GuestAccessData.cs
+++ b/MatrixRoomUtils.Core/StateEventTypes/Spec/GuestAccessEventData.cs
@@ -2,10 +2,10 @@ using System.Text.Json.Serialization;
 using MatrixRoomUtils.Core.Extensions;
 using MatrixRoomUtils.Core.Interfaces;
 
-namespace MatrixRoomUtils.Core.StateEventTypes;
+namespace MatrixRoomUtils.Core.StateEventTypes.Spec;
 
 [MatrixEvent(EventName = "m.room.guest_access")]
-public class GuestAccessData : IStateEventType {
+public class GuestAccessEventData : IStateEventType {
     [JsonPropertyName("guest_access")]
     public string GuestAccess { get; set; }
 
diff --git a/MatrixRoomUtils.Core/StateEventTypes/Spec/HistoryVisibilityData.cs b/MatrixRoomUtils.Core/StateEventTypes/Spec/HistoryVisibilityEventData.cs
index 2bae838..e0785b9 100644
--- a/MatrixRoomUtils.Core/StateEventTypes/Spec/HistoryVisibilityData.cs
+++ b/MatrixRoomUtils.Core/StateEventTypes/Spec/HistoryVisibilityEventData.cs
@@ -2,10 +2,10 @@ using System.Text.Json.Serialization;
 using MatrixRoomUtils.Core.Extensions;
 using MatrixRoomUtils.Core.Interfaces;
 
-namespace MatrixRoomUtils.Core.StateEventTypes;
+namespace MatrixRoomUtils.Core.StateEventTypes.Spec;
 
 [MatrixEvent(EventName = "m.room.history_visibility")]
-public class HistoryVisibilityData : IStateEventType {
+public class HistoryVisibilityEventData : IStateEventType {
     [JsonPropertyName("history_visibility")]
     public string HistoryVisibility { get; set; }
 }
\ No newline at end of file
diff --git a/MatrixRoomUtils.Core/StateEventTypes/Spec/JoinRulesEventData.cs b/MatrixRoomUtils.Core/StateEventTypes/Spec/JoinRulesEventData.cs
index 590835b..f5410dc 100644
--- a/MatrixRoomUtils.Core/StateEventTypes/Spec/JoinRulesEventData.cs
+++ b/MatrixRoomUtils.Core/StateEventTypes/Spec/JoinRulesEventData.cs
@@ -2,7 +2,7 @@ using System.Text.Json.Serialization;
 using MatrixRoomUtils.Core.Extensions;
 using MatrixRoomUtils.Core.Interfaces;
 
-namespace MatrixRoomUtils.Core;
+namespace MatrixRoomUtils.Core.StateEventTypes.Spec;
 
 [MatrixEvent(EventName = "m.room.join_rules")]
 public class JoinRulesEventData : IStateEventType {
diff --git a/MatrixRoomUtils.Core/StateEventTypes/Spec/PolicyRuleStateEventData.cs b/MatrixRoomUtils.Core/StateEventTypes/Spec/PolicyRuleStateEventData.cs
index debbef0..ef94cff 100644
--- a/MatrixRoomUtils.Core/StateEventTypes/Spec/PolicyRuleStateEventData.cs
+++ b/MatrixRoomUtils.Core/StateEventTypes/Spec/PolicyRuleStateEventData.cs
@@ -2,7 +2,7 @@ using System.Text.Json.Serialization;
 using MatrixRoomUtils.Core.Extensions;
 using MatrixRoomUtils.Core.Interfaces;
 
-namespace MatrixRoomUtils.Core.StateEventTypes;
+namespace MatrixRoomUtils.Core.StateEventTypes.Spec;
 
 [MatrixEvent(EventName = "m.policy.rule.user")]
 [MatrixEvent(EventName = "m.policy.rule.server")]
diff --git a/MatrixRoomUtils.Core/StateEventTypes/Spec/PowerLevelEvent.cs b/MatrixRoomUtils.Core/StateEventTypes/Spec/PowerLevelEventData.cs
index c6100bb..6846db4 100644
--- a/MatrixRoomUtils.Core/StateEventTypes/Spec/PowerLevelEvent.cs
+++ b/MatrixRoomUtils.Core/StateEventTypes/Spec/PowerLevelEventData.cs
@@ -2,10 +2,10 @@ using System.Text.Json.Serialization;
 using MatrixRoomUtils.Core.Extensions;
 using MatrixRoomUtils.Core.Interfaces;
 
-namespace MatrixRoomUtils.Core.StateEventTypes;
+namespace MatrixRoomUtils.Core.StateEventTypes.Spec;
 
 [MatrixEvent(EventName = "m.room.power_levels")]
-public class PowerLevelEvent : IStateEventType {
+public class PowerLevelEventData : IStateEventType {
     [JsonPropertyName("ban")]
     public int Ban { get; set; } // = 50;
 
diff --git a/MatrixRoomUtils.Core/StateEventTypes/Spec/PresenceStateEventData.cs b/MatrixRoomUtils.Core/StateEventTypes/Spec/PresenceStateEventData.cs
index a17b6f9..c5eb2ea 100644
--- a/MatrixRoomUtils.Core/StateEventTypes/Spec/PresenceStateEventData.cs
+++ b/MatrixRoomUtils.Core/StateEventTypes/Spec/PresenceStateEventData.cs
@@ -2,7 +2,7 @@ using System.Text.Json.Serialization;
 using MatrixRoomUtils.Core.Extensions;
 using MatrixRoomUtils.Core.Interfaces;
 
-namespace MatrixRoomUtils.Core.StateEventTypes; 
+namespace MatrixRoomUtils.Core.StateEventTypes.Spec; 
 
 [MatrixEvent(EventName = "m.presence")]
 public class PresenceStateEventData : IStateEventType {
diff --git a/MatrixRoomUtils.Core/StateEventTypes/Spec/ProfileResponse.cs b/MatrixRoomUtils.Core/StateEventTypes/Spec/ProfileResponseEventData.cs
index d36ef74..4596de9 100644
--- a/MatrixRoomUtils.Core/StateEventTypes/Spec/ProfileResponse.cs
+++ b/MatrixRoomUtils.Core/StateEventTypes/Spec/ProfileResponseEventData.cs
@@ -1,10 +1,11 @@
 using System.Text.Json.Serialization;
 using MatrixRoomUtils.Core.Extensions;
+using MatrixRoomUtils.Core.Interfaces;
 
-namespace MatrixRoomUtils.Core.StateEventTypes;
+namespace MatrixRoomUtils.Core.StateEventTypes.Spec;
 
 [MatrixEvent(EventName = "m.room.member")]
-public class ProfileResponse {
+public class ProfileResponseEventData : IStateEventType {
     [JsonPropertyName("avatar_url")]
     public string? AvatarUrl { get; set; } = "";
 
diff --git a/MatrixRoomUtils.Core/StateEventTypes/Spec/RoomAliasEventData.cs b/MatrixRoomUtils.Core/StateEventTypes/Spec/RoomAliasEventData.cs
index 5141ed2..611e8a2 100644
--- a/MatrixRoomUtils.Core/StateEventTypes/Spec/RoomAliasEventData.cs
+++ b/MatrixRoomUtils.Core/StateEventTypes/Spec/RoomAliasEventData.cs
@@ -2,7 +2,7 @@ using System.Text.Json.Serialization;
 using MatrixRoomUtils.Core.Extensions;
 using MatrixRoomUtils.Core.Interfaces;
 
-namespace MatrixRoomUtils.Core;
+namespace MatrixRoomUtils.Core.StateEventTypes.Spec;
 
 [MatrixEvent(EventName = "m.room.alias")]
 public class RoomAliasEventData : IStateEventType {
diff --git a/MatrixRoomUtils.Core/StateEventTypes/Spec/RoomAvatarEventData.cs b/MatrixRoomUtils.Core/StateEventTypes/Spec/RoomAvatarEventData.cs
index 03ce16b..bab297b 100644
--- a/MatrixRoomUtils.Core/StateEventTypes/Spec/RoomAvatarEventData.cs
+++ b/MatrixRoomUtils.Core/StateEventTypes/Spec/RoomAvatarEventData.cs
@@ -2,7 +2,7 @@ using System.Text.Json.Serialization;
 using MatrixRoomUtils.Core.Extensions;
 using MatrixRoomUtils.Core.Interfaces;
 
-namespace MatrixRoomUtils.Core.StateEventTypes; 
+namespace MatrixRoomUtils.Core.StateEventTypes.Spec; 
 
 [MatrixEvent(EventName = "m.room.avatar")]
 public class RoomAvatarEventData : IStateEventType {
diff --git a/MatrixRoomUtils.Core/StateEventTypes/Spec/RoomCreateEventData.cs b/MatrixRoomUtils.Core/StateEventTypes/Spec/RoomCreateEventData.cs
index 2e4bb5a..8b85d69 100644
--- a/MatrixRoomUtils.Core/StateEventTypes/Spec/RoomCreateEventData.cs
+++ b/MatrixRoomUtils.Core/StateEventTypes/Spec/RoomCreateEventData.cs
@@ -2,7 +2,7 @@ using System.Text.Json.Serialization;
 using MatrixRoomUtils.Core.Extensions;
 using MatrixRoomUtils.Core.Interfaces;
 
-namespace MatrixRoomUtils.Core.StateEventTypes; 
+namespace MatrixRoomUtils.Core.StateEventTypes.Spec; 
 
 [MatrixEvent(EventName = "m.room.create")]
 public class RoomCreateEventData : IStateEventType {
diff --git a/MatrixRoomUtils.Core/StateEventTypes/Spec/RoomEncryptionEventData.cs b/MatrixRoomUtils.Core/StateEventTypes/Spec/RoomEncryptionEventData.cs
index 8d0576d..c473082 100644
--- a/MatrixRoomUtils.Core/StateEventTypes/Spec/RoomEncryptionEventData.cs
+++ b/MatrixRoomUtils.Core/StateEventTypes/Spec/RoomEncryptionEventData.cs
@@ -2,7 +2,7 @@ using System.Text.Json.Serialization;
 using MatrixRoomUtils.Core.Extensions;
 using MatrixRoomUtils.Core.Interfaces;
 
-namespace MatrixRoomUtils.Core.StateEventTypes; 
+namespace MatrixRoomUtils.Core.StateEventTypes.Spec; 
 
 [MatrixEvent(EventName = "m.room.encryption")]
 public class RoomEncryptionEventData : IStateEventType {
diff --git a/MatrixRoomUtils.Core/StateEventTypes/Spec/RoomMemberEventData.cs b/MatrixRoomUtils.Core/StateEventTypes/Spec/RoomMemberEventData.cs
index 50d9dd2..a543a2f 100644
--- a/MatrixRoomUtils.Core/StateEventTypes/Spec/RoomMemberEventData.cs
+++ b/MatrixRoomUtils.Core/StateEventTypes/Spec/RoomMemberEventData.cs
@@ -2,7 +2,7 @@ using System.Text.Json.Serialization;
 using MatrixRoomUtils.Core.Extensions;
 using MatrixRoomUtils.Core.Interfaces;
 
-namespace MatrixRoomUtils.Core.StateEventTypes;
+namespace MatrixRoomUtils.Core.StateEventTypes.Spec;
 
 [MatrixEvent(EventName = "m.room.member")]
 public class RoomMemberEventData : IStateEventType {
diff --git a/MatrixRoomUtils.Core/StateEventTypes/Spec/MessageEventData.cs b/MatrixRoomUtils.Core/StateEventTypes/Spec/RoomMessageEventData.cs
index bc1c52b..2c56b88 100644
--- a/MatrixRoomUtils.Core/StateEventTypes/Spec/MessageEventData.cs
+++ b/MatrixRoomUtils.Core/StateEventTypes/Spec/RoomMessageEventData.cs
@@ -2,8 +2,10 @@ using System.Text.Json.Serialization;
 using MatrixRoomUtils.Core.Extensions;
 using MatrixRoomUtils.Core.Interfaces;
 
+namespace MatrixRoomUtils.Core.StateEventTypes.Spec; 
+
 [MatrixEvent(EventName = "m.room.message")]
-public class MessageEventData : IStateEventType {
+public class RoomMessageEventData : IStateEventType {
     [JsonPropertyName("body")]
     public string Body { get; set; }
     [JsonPropertyName("msgtype")]
diff --git a/MatrixRoomUtils.Core/StateEventTypes/Spec/RoomNameEventData.cs b/MatrixRoomUtils.Core/StateEventTypes/Spec/RoomNameEventData.cs
index 642b5f9..e5b7d59 100644
--- a/MatrixRoomUtils.Core/StateEventTypes/Spec/RoomNameEventData.cs
+++ b/MatrixRoomUtils.Core/StateEventTypes/Spec/RoomNameEventData.cs
@@ -2,7 +2,7 @@ using System.Text.Json.Serialization;
 using MatrixRoomUtils.Core.Extensions;
 using MatrixRoomUtils.Core.Interfaces;
 
-namespace MatrixRoomUtils.Core.StateEventTypes; 
+namespace MatrixRoomUtils.Core.StateEventTypes.Spec; 
 
 [MatrixEvent(EventName = "m.room.name")]
 public class RoomNameEventData : IStateEventType {
diff --git a/MatrixRoomUtils.Core/StateEventTypes/Spec/RoomPinnedEventData.cs b/MatrixRoomUtils.Core/StateEventTypes/Spec/RoomPinnedEventData.cs
index 05c0048..d84e962 100644
--- a/MatrixRoomUtils.Core/StateEventTypes/Spec/RoomPinnedEventData.cs
+++ b/MatrixRoomUtils.Core/StateEventTypes/Spec/RoomPinnedEventData.cs
@@ -2,7 +2,7 @@ using System.Text.Json.Serialization;
 using MatrixRoomUtils.Core.Extensions;
 using MatrixRoomUtils.Core.Interfaces;
 
-namespace MatrixRoomUtils.Core.StateEventTypes; 
+namespace MatrixRoomUtils.Core.StateEventTypes.Spec; 
 
 [MatrixEvent(EventName = "m.room.pinned_events")]
 public class RoomPinnedEventData : IStateEventType {
diff --git a/MatrixRoomUtils.Core/StateEventTypes/Spec/RoomTopicEventData.cs b/MatrixRoomUtils.Core/StateEventTypes/Spec/RoomTopicEventData.cs
index cc5b35b..cdd62a1 100644
--- a/MatrixRoomUtils.Core/StateEventTypes/Spec/RoomTopicEventData.cs
+++ b/MatrixRoomUtils.Core/StateEventTypes/Spec/RoomTopicEventData.cs
@@ -2,7 +2,7 @@ using System.Text.Json.Serialization;
 using MatrixRoomUtils.Core.Extensions;
 using MatrixRoomUtils.Core.Interfaces;
 
-namespace MatrixRoomUtils.Core.StateEventTypes; 
+namespace MatrixRoomUtils.Core.StateEventTypes.Spec; 
 
 [MatrixEvent(EventName = "m.room.topic")]
 [MatrixEvent(EventName = "org.matrix.msc3765.topic", Legacy = true)]
diff --git a/MatrixRoomUtils.Core/StateEventTypes/Spec/RoomTypingEventData.cs b/MatrixRoomUtils.Core/StateEventTypes/Spec/RoomTypingEventData.cs
index eac4af2..017a117 100644
--- a/MatrixRoomUtils.Core/StateEventTypes/Spec/RoomTypingEventData.cs
+++ b/MatrixRoomUtils.Core/StateEventTypes/Spec/RoomTypingEventData.cs
@@ -2,7 +2,7 @@ using System.Text.Json.Serialization;
 using MatrixRoomUtils.Core.Extensions;
 using MatrixRoomUtils.Core.Interfaces;
 
-namespace MatrixRoomUtils.Core.StateEventTypes; 
+namespace MatrixRoomUtils.Core.StateEventTypes.Spec; 
 
 [MatrixEvent(EventName = "m.typing")]
 public class RoomTypingEventData : IStateEventType {
diff --git a/MatrixRoomUtils.Core/StateEventTypes/Spec/ServerACLData.cs b/MatrixRoomUtils.Core/StateEventTypes/Spec/ServerACLData.cs
index 41bf0a8..1d56e9c 100644
--- a/MatrixRoomUtils.Core/StateEventTypes/Spec/ServerACLData.cs
+++ b/MatrixRoomUtils.Core/StateEventTypes/Spec/ServerACLData.cs
@@ -2,7 +2,7 @@ using System.Text.Json.Serialization;
 using MatrixRoomUtils.Core.Extensions;
 using MatrixRoomUtils.Core.Interfaces;
 
-namespace MatrixRoomUtils.Core.StateEventTypes;
+namespace MatrixRoomUtils.Core.StateEventTypes.Spec;
 
 [MatrixEvent(EventName = "m.room.server_acl")]
 public class ServerACLData : IStateEventType {
diff --git a/MatrixRoomUtils.Core/StateEventTypes/Spec/SpaceChildEventData.cs b/MatrixRoomUtils.Core/StateEventTypes/Spec/SpaceChildEventData.cs
index f65cd5b..bb62d92 100644
--- a/MatrixRoomUtils.Core/StateEventTypes/Spec/SpaceChildEventData.cs
+++ b/MatrixRoomUtils.Core/StateEventTypes/Spec/SpaceChildEventData.cs
@@ -2,7 +2,7 @@ using System.Text.Json.Serialization;
 using MatrixRoomUtils.Core.Extensions;
 using MatrixRoomUtils.Core.Interfaces;
 
-namespace MatrixRoomUtils.Core.StateEventTypes; 
+namespace MatrixRoomUtils.Core.StateEventTypes.Spec; 
 
 [MatrixEvent(EventName = "m.space.child")]
 public class SpaceChildEventData : IStateEventType {