diff options
Diffstat (limited to 'LibMatrix')
-rw-r--r-- | LibMatrix/EventTypes/Common/MjolnirShortcodeEventData.cs (renamed from LibMatrix/StateEventTypes/Common/MjolnirShortcodeEventData.cs) | 2 | ||||
-rw-r--r-- | LibMatrix/EventTypes/Common/RoomEmotesEventData.cs (renamed from LibMatrix/StateEventTypes/Common/RoomEmotesEventData.cs) | 2 | ||||
-rw-r--r-- | LibMatrix/EventTypes/Spec/RoomMessageEventData.cs (renamed from LibMatrix/StateEventTypes/Spec/RoomMessageEventData.cs) | 3 | ||||
-rw-r--r-- | LibMatrix/EventTypes/Spec/State/CanonicalAliasEventContent.cs (renamed from LibMatrix/StateEventTypes/Spec/CanonicalAliasEventContent.cs) | 2 | ||||
-rw-r--r-- | LibMatrix/EventTypes/Spec/State/GuestAccessEventData.cs (renamed from LibMatrix/StateEventTypes/Spec/GuestAccessEventData.cs) | 2 | ||||
-rw-r--r-- | LibMatrix/EventTypes/Spec/State/HistoryVisibilityEventData.cs (renamed from LibMatrix/StateEventTypes/Spec/HistoryVisibilityEventData.cs) | 2 | ||||
-rw-r--r-- | LibMatrix/EventTypes/Spec/State/JoinRulesEventData.cs (renamed from LibMatrix/StateEventTypes/Spec/JoinRulesEventData.cs) | 2 | ||||
-rw-r--r-- | LibMatrix/EventTypes/Spec/State/PolicyRuleStateEventData.cs (renamed from LibMatrix/StateEventTypes/Spec/PolicyRuleStateEventData.cs) | 2 | ||||
-rw-r--r-- | LibMatrix/EventTypes/Spec/State/PresenceStateEventData.cs (renamed from LibMatrix/StateEventTypes/Spec/PresenceStateEventData.cs) | 2 | ||||
-rw-r--r-- | LibMatrix/EventTypes/Spec/State/ProfileResponseEventData.cs (renamed from LibMatrix/StateEventTypes/Spec/ProfileResponseEventData.cs) | 2 | ||||
-rw-r--r-- | LibMatrix/EventTypes/Spec/State/RoomAliasEventData.cs (renamed from LibMatrix/StateEventTypes/Spec/RoomAliasEventData.cs) | 2 | ||||
-rw-r--r-- | LibMatrix/EventTypes/Spec/State/RoomAvatarEventData.cs (renamed from LibMatrix/StateEventTypes/Spec/RoomAvatarEventData.cs) | 2 | ||||
-rw-r--r-- | LibMatrix/EventTypes/Spec/State/RoomCreateEventData.cs (renamed from LibMatrix/StateEventTypes/Spec/RoomCreateEventData.cs) | 2 | ||||
-rw-r--r-- | LibMatrix/EventTypes/Spec/State/RoomEncryptionEventData.cs (renamed from LibMatrix/StateEventTypes/Spec/RoomEncryptionEventData.cs) | 2 | ||||
-rw-r--r-- | LibMatrix/EventTypes/Spec/State/RoomMemberEventData.cs (renamed from LibMatrix/StateEventTypes/Spec/RoomMemberEventData.cs) | 2 | ||||
-rw-r--r-- | LibMatrix/EventTypes/Spec/State/RoomNameEventData.cs (renamed from LibMatrix/StateEventTypes/Spec/RoomNameEventData.cs) | 2 | ||||
-rw-r--r-- | LibMatrix/EventTypes/Spec/State/RoomPinnedEventData.cs (renamed from LibMatrix/StateEventTypes/Spec/RoomPinnedEventData.cs) | 2 | ||||
-rw-r--r-- | LibMatrix/EventTypes/Spec/State/RoomPowerLevelEventData.cs (renamed from LibMatrix/StateEventTypes/Spec/RoomPowerLevelEventData.cs) | 20 | ||||
-rw-r--r-- | LibMatrix/EventTypes/Spec/State/RoomTopicEventData.cs (renamed from LibMatrix/StateEventTypes/Spec/RoomTopicEventData.cs) | 2 | ||||
-rw-r--r-- | LibMatrix/EventTypes/Spec/State/RoomTypingEventData.cs (renamed from LibMatrix/StateEventTypes/Spec/RoomTypingEventData.cs) | 2 | ||||
-rw-r--r-- | LibMatrix/EventTypes/Spec/State/ServerACLEventData.cs (renamed from LibMatrix/StateEventTypes/Spec/ServerACLEventData.cs) | 2 | ||||
-rw-r--r-- | LibMatrix/EventTypes/Spec/State/SpaceChildEventData.cs (renamed from LibMatrix/StateEventTypes/Spec/SpaceChildEventData.cs) | 2 | ||||
-rw-r--r-- | LibMatrix/EventTypes/Spec/State/SpaceParentEventData.cs (renamed from LibMatrix/StateEventTypes/Spec/SpaceParentEventData.cs) | 2 | ||||
-rw-r--r-- | LibMatrix/EventTypes/UnknownStateEventData.cs (renamed from LibMatrix/StateEventTypes/UnknownStateEventData.cs) | 2 | ||||
-rw-r--r-- | LibMatrix/Extensions/HttpClientExtensions.cs | 12 | ||||
-rw-r--r-- | LibMatrix/Extensions/StringExtensions.cs | 13 | ||||
-rw-r--r-- | LibMatrix/Helpers/MediaResolver.cs | 7 | ||||
-rw-r--r-- | LibMatrix/Helpers/MessageFormatter.cs | 2 | ||||
-rw-r--r-- | LibMatrix/Helpers/SyncHelper.cs | 18 | ||||
-rw-r--r-- | LibMatrix/Homeservers/AuthenticatedHomeserverGeneric.cs | 23 | ||||
-rw-r--r-- | LibMatrix/Homeservers/AuthenticatedHomeserverMxApiExtended.cs | 2 | ||||
-rw-r--r-- | LibMatrix/Homeservers/AuthenticatedHomeserverSynapse.cs | 2 | ||||
-rw-r--r-- | LibMatrix/Homeservers/RemoteHomeServer.cs | 27 | ||||
-rw-r--r-- | LibMatrix/Interfaces/IStateEventType.cs | 4 | ||||
-rw-r--r-- | LibMatrix/Responses/CreateRoomRequest.cs | 2 | ||||
-rw-r--r-- | LibMatrix/Responses/StateEventResponse.cs | 5 | ||||
-rw-r--r-- | LibMatrix/RoomTypes/GenericRoom.cs | 33 | ||||
-rw-r--r-- | LibMatrix/RoomTypes/SpaceRoom.cs | 6 | ||||
-rw-r--r-- | LibMatrix/Services/HomeserverProviderService.cs | 4 | ||||
-rw-r--r-- | LibMatrix/Services/HomeserverResolverService.cs | 2 | ||||
-rw-r--r-- | LibMatrix/Services/TieredStorageService.cs | 6 | ||||
-rw-r--r-- | LibMatrix/StateEvent.cs | 5 |
42 files changed, 136 insertions, 104 deletions
diff --git a/LibMatrix/StateEventTypes/Common/MjolnirShortcodeEventData.cs b/LibMatrix/EventTypes/Common/MjolnirShortcodeEventData.cs index ff11be7..9067351 100644 --- a/LibMatrix/StateEventTypes/Common/MjolnirShortcodeEventData.cs +++ b/LibMatrix/EventTypes/Common/MjolnirShortcodeEventData.cs @@ -2,7 +2,7 @@ using System.Text.Json.Serialization; using LibMatrix.Helpers; using LibMatrix.Interfaces; -namespace LibMatrix.StateEventTypes.Common; +namespace LibMatrix.EventTypes.Common; [MatrixEvent(EventName = "org.matrix.mjolnir.shortcode")] public class MjolnirShortcodeEventContent : EventContent { diff --git a/LibMatrix/StateEventTypes/Common/RoomEmotesEventData.cs b/LibMatrix/EventTypes/Common/RoomEmotesEventData.cs index a056eda..abf936c 100644 --- a/LibMatrix/StateEventTypes/Common/RoomEmotesEventData.cs +++ b/LibMatrix/EventTypes/Common/RoomEmotesEventData.cs @@ -2,7 +2,7 @@ using System.Text.Json.Serialization; using LibMatrix.Helpers; using LibMatrix.Interfaces; -namespace LibMatrix.StateEventTypes.Common; +namespace LibMatrix.EventTypes.Common; [MatrixEvent(EventName = "im.ponies.room_emotes")] public class RoomEmotesEventContent : EventContent { diff --git a/LibMatrix/StateEventTypes/Spec/RoomMessageEventData.cs b/LibMatrix/EventTypes/Spec/RoomMessageEventData.cs index a15efe8..b76b176 100644 --- a/LibMatrix/StateEventTypes/Spec/RoomMessageEventData.cs +++ b/LibMatrix/EventTypes/Spec/RoomMessageEventData.cs @@ -1,9 +1,8 @@ using System.Text.Json.Serialization; -using ArcaneLibs.Extensions; using LibMatrix.Helpers; using LibMatrix.Interfaces; -namespace LibMatrix.StateEventTypes.Spec; +namespace LibMatrix.EventTypes.Spec; [MatrixEvent(EventName = "m.room.message")] public class RoomMessageEventContent : EventContent { diff --git a/LibMatrix/StateEventTypes/Spec/CanonicalAliasEventContent.cs b/LibMatrix/EventTypes/Spec/State/CanonicalAliasEventContent.cs index 7a0e84c..71f3d0d 100644 --- a/LibMatrix/StateEventTypes/Spec/CanonicalAliasEventContent.cs +++ b/LibMatrix/EventTypes/Spec/State/CanonicalAliasEventContent.cs @@ -2,7 +2,7 @@ using System.Text.Json.Serialization; using LibMatrix.Helpers; using LibMatrix.Interfaces; -namespace LibMatrix.StateEventTypes.Spec; +namespace LibMatrix.EventTypes.Spec.State; [MatrixEvent(EventName = "m.room.canonical_alias")] public class CanonicalAliasEventContent : EventContent { diff --git a/LibMatrix/StateEventTypes/Spec/GuestAccessEventData.cs b/LibMatrix/EventTypes/Spec/State/GuestAccessEventData.cs index 0709b86..af1b2ce 100644 --- a/LibMatrix/StateEventTypes/Spec/GuestAccessEventData.cs +++ b/LibMatrix/EventTypes/Spec/State/GuestAccessEventData.cs @@ -2,7 +2,7 @@ using System.Text.Json.Serialization; using LibMatrix.Helpers; using LibMatrix.Interfaces; -namespace LibMatrix.StateEventTypes.Spec; +namespace LibMatrix.EventTypes.Spec.State; [MatrixEvent(EventName = "m.room.guest_access")] public class GuestAccessEventContent : EventContent { diff --git a/LibMatrix/StateEventTypes/Spec/HistoryVisibilityEventData.cs b/LibMatrix/EventTypes/Spec/State/HistoryVisibilityEventData.cs index b19dd32..b57ade5 100644 --- a/LibMatrix/StateEventTypes/Spec/HistoryVisibilityEventData.cs +++ b/LibMatrix/EventTypes/Spec/State/HistoryVisibilityEventData.cs @@ -2,7 +2,7 @@ using System.Text.Json.Serialization; using LibMatrix.Helpers; using LibMatrix.Interfaces; -namespace LibMatrix.StateEventTypes.Spec; +namespace LibMatrix.EventTypes.Spec.State; [MatrixEvent(EventName = "m.room.history_visibility")] public class HistoryVisibilityEventContent : EventContent { diff --git a/LibMatrix/StateEventTypes/Spec/JoinRulesEventData.cs b/LibMatrix/EventTypes/Spec/State/JoinRulesEventData.cs index 8c0772f..0098bef 100644 --- a/LibMatrix/StateEventTypes/Spec/JoinRulesEventData.cs +++ b/LibMatrix/EventTypes/Spec/State/JoinRulesEventData.cs @@ -2,7 +2,7 @@ using System.Text.Json.Serialization; using LibMatrix.Helpers; using LibMatrix.Interfaces; -namespace LibMatrix.StateEventTypes.Spec; +namespace LibMatrix.EventTypes.Spec.State; [MatrixEvent(EventName = "m.room.join_rules")] public class JoinRulesEventContent : EventContent { diff --git a/LibMatrix/StateEventTypes/Spec/PolicyRuleStateEventData.cs b/LibMatrix/EventTypes/Spec/State/PolicyRuleStateEventData.cs index 539e371..fde02c1 100644 --- a/LibMatrix/StateEventTypes/Spec/PolicyRuleStateEventData.cs +++ b/LibMatrix/EventTypes/Spec/State/PolicyRuleStateEventData.cs @@ -2,7 +2,7 @@ using System.Text.Json.Serialization; using LibMatrix.Helpers; using LibMatrix.Interfaces; -namespace LibMatrix.StateEventTypes.Spec; +namespace LibMatrix.EventTypes.Spec.State; [MatrixEvent(EventName = "m.policy.rule.user")] [MatrixEvent(EventName = "m.policy.rule.server")] diff --git a/LibMatrix/StateEventTypes/Spec/PresenceStateEventData.cs b/LibMatrix/EventTypes/Spec/State/PresenceStateEventData.cs index b897ff0..b12da5b 100644 --- a/LibMatrix/StateEventTypes/Spec/PresenceStateEventData.cs +++ b/LibMatrix/EventTypes/Spec/State/PresenceStateEventData.cs @@ -2,7 +2,7 @@ using System.Text.Json.Serialization; using LibMatrix.Helpers; using LibMatrix.Interfaces; -namespace LibMatrix.StateEventTypes.Spec; +namespace LibMatrix.EventTypes.Spec.State; [MatrixEvent(EventName = "m.presence")] public class PresenceEventContent : EventContent { diff --git a/LibMatrix/StateEventTypes/Spec/ProfileResponseEventData.cs b/LibMatrix/EventTypes/Spec/State/ProfileResponseEventData.cs index 9b4f1d0..893fce1 100644 --- a/LibMatrix/StateEventTypes/Spec/ProfileResponseEventData.cs +++ b/LibMatrix/EventTypes/Spec/State/ProfileResponseEventData.cs @@ -1,7 +1,7 @@ using System.Text.Json.Serialization; using LibMatrix.Interfaces; -namespace LibMatrix.StateEventTypes.Spec; +namespace LibMatrix.EventTypes.Spec.State; public class ProfileResponseEventContent : EventContent { [JsonPropertyName("avatar_url")] diff --git a/LibMatrix/StateEventTypes/Spec/RoomAliasEventData.cs b/LibMatrix/EventTypes/Spec/State/RoomAliasEventData.cs index d3960a1..5b0e914 100644 --- a/LibMatrix/StateEventTypes/Spec/RoomAliasEventData.cs +++ b/LibMatrix/EventTypes/Spec/State/RoomAliasEventData.cs @@ -2,7 +2,7 @@ using System.Text.Json.Serialization; using LibMatrix.Helpers; using LibMatrix.Interfaces; -namespace LibMatrix.StateEventTypes.Spec; +namespace LibMatrix.EventTypes.Spec.State; [MatrixEvent(EventName = "m.room.alias")] public class RoomAliasEventContent : EventContent { diff --git a/LibMatrix/StateEventTypes/Spec/RoomAvatarEventData.cs b/LibMatrix/EventTypes/Spec/State/RoomAvatarEventData.cs index e2263c8..601d014 100644 --- a/LibMatrix/StateEventTypes/Spec/RoomAvatarEventData.cs +++ b/LibMatrix/EventTypes/Spec/State/RoomAvatarEventData.cs @@ -2,7 +2,7 @@ using System.Text.Json.Serialization; using LibMatrix.Helpers; using LibMatrix.Interfaces; -namespace LibMatrix.StateEventTypes.Spec; +namespace LibMatrix.EventTypes.Spec.State; [MatrixEvent(EventName = "m.room.avatar")] public class RoomAvatarEventContent : EventContent { diff --git a/LibMatrix/StateEventTypes/Spec/RoomCreateEventData.cs b/LibMatrix/EventTypes/Spec/State/RoomCreateEventData.cs index 22df784..e409f3a 100644 --- a/LibMatrix/StateEventTypes/Spec/RoomCreateEventData.cs +++ b/LibMatrix/EventTypes/Spec/State/RoomCreateEventData.cs @@ -2,7 +2,7 @@ using System.Text.Json.Serialization; using LibMatrix.Helpers; using LibMatrix.Interfaces; -namespace LibMatrix.StateEventTypes.Spec; +namespace LibMatrix.EventTypes.Spec.State; [MatrixEvent(EventName = "m.room.create")] public class RoomCreateEventContent : EventContent { diff --git a/LibMatrix/StateEventTypes/Spec/RoomEncryptionEventData.cs b/LibMatrix/EventTypes/Spec/State/RoomEncryptionEventData.cs index 1d5ec2c..6ffa4c5 100644 --- a/LibMatrix/StateEventTypes/Spec/RoomEncryptionEventData.cs +++ b/LibMatrix/EventTypes/Spec/State/RoomEncryptionEventData.cs @@ -2,7 +2,7 @@ using System.Text.Json.Serialization; using LibMatrix.Helpers; using LibMatrix.Interfaces; -namespace LibMatrix.StateEventTypes.Spec; +namespace LibMatrix.EventTypes.Spec.State; [MatrixEvent(EventName = "m.room.encryption")] public class RoomEncryptionEventContent : EventContent { diff --git a/LibMatrix/StateEventTypes/Spec/RoomMemberEventData.cs b/LibMatrix/EventTypes/Spec/State/RoomMemberEventData.cs index a9d4710..da158f1 100644 --- a/LibMatrix/StateEventTypes/Spec/RoomMemberEventData.cs +++ b/LibMatrix/EventTypes/Spec/State/RoomMemberEventData.cs @@ -2,7 +2,7 @@ using System.Text.Json.Serialization; using LibMatrix.Helpers; using LibMatrix.Interfaces; -namespace LibMatrix.StateEventTypes.Spec; +namespace LibMatrix.EventTypes.Spec.State; [MatrixEvent(EventName = "m.room.member")] public class RoomMemberEventContent : EventContent { diff --git a/LibMatrix/StateEventTypes/Spec/RoomNameEventData.cs b/LibMatrix/EventTypes/Spec/State/RoomNameEventData.cs index 3002102..7cb881a 100644 --- a/LibMatrix/StateEventTypes/Spec/RoomNameEventData.cs +++ b/LibMatrix/EventTypes/Spec/State/RoomNameEventData.cs @@ -2,7 +2,7 @@ using System.Text.Json.Serialization; using LibMatrix.Helpers; using LibMatrix.Interfaces; -namespace LibMatrix.StateEventTypes.Spec; +namespace LibMatrix.EventTypes.Spec.State; [MatrixEvent(EventName = "m.room.name")] public class RoomNameEventContent : EventContent { diff --git a/LibMatrix/StateEventTypes/Spec/RoomPinnedEventData.cs b/LibMatrix/EventTypes/Spec/State/RoomPinnedEventData.cs index 16144bc..eb02cc7 100644 --- a/LibMatrix/StateEventTypes/Spec/RoomPinnedEventData.cs +++ b/LibMatrix/EventTypes/Spec/State/RoomPinnedEventData.cs @@ -2,7 +2,7 @@ using System.Text.Json.Serialization; using LibMatrix.Helpers; using LibMatrix.Interfaces; -namespace LibMatrix.StateEventTypes.Spec; +namespace LibMatrix.EventTypes.Spec.State; [MatrixEvent(EventName = "m.room.pinned_events")] public class RoomPinnedEventContent : EventContent { diff --git a/LibMatrix/StateEventTypes/Spec/RoomPowerLevelEventData.cs b/LibMatrix/EventTypes/Spec/State/RoomPowerLevelEventData.cs index 960c198..1a5d5f5 100644 --- a/LibMatrix/StateEventTypes/Spec/RoomPowerLevelEventData.cs +++ b/LibMatrix/EventTypes/Spec/State/RoomPowerLevelEventData.cs @@ -2,39 +2,39 @@ using System.Text.Json.Serialization; using LibMatrix.Helpers; using LibMatrix.Interfaces; -namespace LibMatrix.StateEventTypes.Spec; +namespace LibMatrix.EventTypes.Spec.State; [MatrixEvent(EventName = "m.room.power_levels")] public class RoomPowerLevelEventContent : EventContent { [JsonPropertyName("ban")] - public long Ban { get; set; } // = 50; + public long? Ban { get; set; } // = 50; [JsonPropertyName("events_default")] public long EventsDefault { get; set; } // = 0; [JsonPropertyName("events")] - public Dictionary<string, long> Events { get; set; } // = null!; + public Dictionary<string, long>? Events { get; set; } // = null!; [JsonPropertyName("invite")] - public long Invite { get; set; } // = 50; + public long? Invite { get; set; } // = 50; [JsonPropertyName("kick")] - public long Kick { get; set; } // = 50; + public long? Kick { get; set; } // = 50; [JsonPropertyName("notifications")] - public NotificationsPL NotificationsPl { get; set; } // = null!; + public NotificationsPL? NotificationsPl { get; set; } // = null!; [JsonPropertyName("redact")] - public long Redact { get; set; } // = 50; + public long? Redact { get; set; } // = 50; [JsonPropertyName("state_default")] - public long StateDefault { get; set; } // = 50; + public long? StateDefault { get; set; } // = 50; [JsonPropertyName("users")] - public Dictionary<string, long> Users { get; set; } // = null!; + public Dictionary<string, long>? Users { get; set; } // = null!; [JsonPropertyName("users_default")] - public long UsersDefault { get; set; } // = 0; + public long? UsersDefault { get; set; } // = 0; [Obsolete("Historical was a key related to MSC2716, a spec change on backfill that was dropped!", true)] [JsonIgnore] diff --git a/LibMatrix/StateEventTypes/Spec/RoomTopicEventData.cs b/LibMatrix/EventTypes/Spec/State/RoomTopicEventData.cs index 61d1a01..52c7e42 100644 --- a/LibMatrix/StateEventTypes/Spec/RoomTopicEventData.cs +++ b/LibMatrix/EventTypes/Spec/State/RoomTopicEventData.cs @@ -2,7 +2,7 @@ using System.Text.Json.Serialization; using LibMatrix.Helpers; using LibMatrix.Interfaces; -namespace LibMatrix.StateEventTypes.Spec; +namespace LibMatrix.EventTypes.Spec.State; [MatrixEvent(EventName = "m.room.topic")] [MatrixEvent(EventName = "org.matrix.msc3765.topic", Legacy = true)] diff --git a/LibMatrix/StateEventTypes/Spec/RoomTypingEventData.cs b/LibMatrix/EventTypes/Spec/State/RoomTypingEventData.cs index e935cb2..01cfacf 100644 --- a/LibMatrix/StateEventTypes/Spec/RoomTypingEventData.cs +++ b/LibMatrix/EventTypes/Spec/State/RoomTypingEventData.cs @@ -2,7 +2,7 @@ using System.Text.Json.Serialization; using LibMatrix.Helpers; using LibMatrix.Interfaces; -namespace LibMatrix.StateEventTypes.Spec; +namespace LibMatrix.EventTypes.Spec.State; [MatrixEvent(EventName = "m.typing")] public class RoomTypingEventContent : EventContent { diff --git a/LibMatrix/StateEventTypes/Spec/ServerACLEventData.cs b/LibMatrix/EventTypes/Spec/State/ServerACLEventData.cs index 031d113..f18fe43 100644 --- a/LibMatrix/StateEventTypes/Spec/ServerACLEventData.cs +++ b/LibMatrix/EventTypes/Spec/State/ServerACLEventData.cs @@ -2,7 +2,7 @@ using System.Text.Json.Serialization; using LibMatrix.Helpers; using LibMatrix.Interfaces; -namespace LibMatrix.StateEventTypes.Spec; +namespace LibMatrix.EventTypes.Spec.State; [MatrixEvent(EventName = "m.room.server_acl")] public class ServerACLEventContent : EventContent { diff --git a/LibMatrix/StateEventTypes/Spec/SpaceChildEventData.cs b/LibMatrix/EventTypes/Spec/State/SpaceChildEventData.cs index 80fc771..a13ba2e 100644 --- a/LibMatrix/StateEventTypes/Spec/SpaceChildEventData.cs +++ b/LibMatrix/EventTypes/Spec/State/SpaceChildEventData.cs @@ -2,7 +2,7 @@ using System.Text.Json.Serialization; using LibMatrix.Helpers; using LibMatrix.Interfaces; -namespace LibMatrix.StateEventTypes.Spec; +namespace LibMatrix.EventTypes.Spec.State; [MatrixEvent(EventName = "m.space.child")] public class SpaceChildEventContent : EventContent { diff --git a/LibMatrix/StateEventTypes/Spec/SpaceParentEventData.cs b/LibMatrix/EventTypes/Spec/State/SpaceParentEventData.cs index 1bc89ab..0ffa193 100644 --- a/LibMatrix/StateEventTypes/Spec/SpaceParentEventData.cs +++ b/LibMatrix/EventTypes/Spec/State/SpaceParentEventData.cs @@ -2,7 +2,7 @@ using System.Text.Json.Serialization; using LibMatrix.Helpers; using LibMatrix.Interfaces; -namespace LibMatrix.StateEventTypes.Spec; +namespace LibMatrix.EventTypes.Spec.State; [MatrixEvent(EventName = "m.space.parent")] public class SpaceParentEventContent : EventContent { diff --git a/LibMatrix/StateEventTypes/UnknownStateEventData.cs b/LibMatrix/EventTypes/UnknownStateEventData.cs index 59d8fd4..9a276c8 100644 --- a/LibMatrix/StateEventTypes/UnknownStateEventData.cs +++ b/LibMatrix/EventTypes/UnknownStateEventData.cs @@ -1,6 +1,6 @@ using LibMatrix.Interfaces; -namespace LibMatrix.StateEventTypes; +namespace LibMatrix.EventTypes; public class UnknownEventContent : EventContent { diff --git a/LibMatrix/Extensions/HttpClientExtensions.cs b/LibMatrix/Extensions/HttpClientExtensions.cs index 31ae650..a5eb40f 100644 --- a/LibMatrix/Extensions/HttpClientExtensions.cs +++ b/LibMatrix/Extensions/HttpClientExtensions.cs @@ -1,6 +1,8 @@ using System.Diagnostics; +using System.Diagnostics.CodeAnalysis; using System.Net.Http.Headers; using System.Reflection; +using System.Text; using System.Text.Json; using ArcaneLibs.Extensions; @@ -28,7 +30,8 @@ public class MatrixHttpClient : HttpClient { if (request.RequestUri is null) throw new NullReferenceException("RequestUri is null"); if (AssertedUserId is not null) request.RequestUri = request.RequestUri.AddQuery("user_id", AssertedUserId); - Console.WriteLine($"Sending request to {request.RequestUri}"); + // Console.WriteLine($"Sending request to {request.RequestUri}"); + try { var webAssemblyEnableStreamingResponseKey = new HttpRequestOptionsKey<bool>("WebAssemblyEnableStreamingResponse"); @@ -76,4 +79,11 @@ public class MatrixHttpClient : HttpClient { response.EnsureSuccessStatusCode(); return await response.Content.ReadAsStreamAsync(cancellationToken); } + + public new async Task<HttpResponseMessage> PutAsJsonAsync<T>([StringSyntax(StringSyntaxAttribute.Uri)] string? requestUri, T value, JsonSerializerOptions? options = null, CancellationToken cancellationToken = default) { + var request = new HttpRequestMessage(HttpMethod.Put, requestUri); + request.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json")); + request.Content = new StringContent(JsonSerializer.Serialize(value, value.GetType()), Encoding.UTF8, "application/json"); + return await SendAsync(request, cancellationToken); + } } diff --git a/LibMatrix/Extensions/StringExtensions.cs b/LibMatrix/Extensions/StringExtensions.cs deleted file mode 100644 index 491fa77..0000000 --- a/LibMatrix/Extensions/StringExtensions.cs +++ /dev/null @@ -1,13 +0,0 @@ -namespace LibMatrix.Extensions; - -public static class StringExtensions { - // public static async Task<string> GetMediaUrl(this string MxcUrl) - // { - // //MxcUrl: mxc://rory.gay/ocRVanZoUTCcifcVNwXgbtTg - // //target: https://matrix.rory.gay/_matrix/media/v3/download/rory.gay/ocRVanZoUTCcifcVNwXgbtTg - // - // var server = MxcUrl.Split('/')[2]; - // var mediaId = MxcUrl.Split('/')[3]; - // return $"{(await new RemoteHomeServer(server).Configure()).FullHomeServerDomain}/_matrix/media/v3/download/{server}/{mediaId}"; - // } -} diff --git a/LibMatrix/Helpers/MediaResolver.cs b/LibMatrix/Helpers/MediaResolver.cs deleted file mode 100644 index 5886618..0000000 --- a/LibMatrix/Helpers/MediaResolver.cs +++ /dev/null @@ -1,7 +0,0 @@ -using LibMatrix.Services; - -namespace LibMatrix.Helpers; - -public static class MediaResolver { - public static string ResolveMediaUri(string homeserver, string mxc) => mxc.Replace("mxc://", $"{homeserver}/_matrix/media/v3/download/"); -} diff --git a/LibMatrix/Helpers/MessageFormatter.cs b/LibMatrix/Helpers/MessageFormatter.cs index 37d7004..ae02afc 100644 --- a/LibMatrix/Helpers/MessageFormatter.cs +++ b/LibMatrix/Helpers/MessageFormatter.cs @@ -1,5 +1,5 @@ using ArcaneLibs.Extensions; -using LibMatrix.StateEventTypes.Spec; +using LibMatrix.EventTypes.Spec; namespace LibMatrix.Helpers; diff --git a/LibMatrix/Helpers/SyncHelper.cs b/LibMatrix/Helpers/SyncHelper.cs index d719184..386fd4d 100644 --- a/LibMatrix/Helpers/SyncHelper.cs +++ b/LibMatrix/Helpers/SyncHelper.cs @@ -9,17 +9,17 @@ using LibMatrix.Services; namespace LibMatrix.Helpers; -public class SyncHelper(AuthenticatedHomeserverGeneric homeserver, TieredStorageService storageService) { +public class SyncHelper(AuthenticatedHomeserverGeneric homeserver) { public async Task<SyncResult?> Sync( string? since = null, int? timeout = 30000, string? setPresence = "online", SyncFilter? filter = null, CancellationToken? cancellationToken = null) { - var outFileName = "sync-" + - (await storageService.CacheStorageProvider.GetAllKeysAsync()).Count( - x => x.StartsWith("sync")) + - ".json"; + // var outFileName = "sync-" + + // (await storageService.CacheStorageProvider.GetAllKeysAsync()).Count( + // x => x.StartsWith("sync")) + + // ".json"; var url = $"/_matrix/client/v3/sync?timeout={timeout}&set_presence={setPresence}"; if (!string.IsNullOrWhiteSpace(since)) url += $"&since={since}"; if (filter is not null) url += $"&filter={filter.ToJson(ignoreNull: true, indent: false)}"; @@ -65,10 +65,10 @@ public class SyncHelper(AuthenticatedHomeserverGeneric homeserver, TieredStorage SyncFilter? filter = null, CancellationToken? cancellationToken = null ) { - await Task.WhenAll((await storageService.CacheStorageProvider.GetAllKeysAsync()) - .Where(x => x.StartsWith("sync")) - .ToList() - .Select(x => storageService.CacheStorageProvider.DeleteObjectAsync(x))); + // await Task.WhenAll((await storageService.CacheStorageProvider.GetAllKeysAsync()) + // .Where(x => x.StartsWith("sync")) + // .ToList() + // .Select(x => storageService.CacheStorageProvider.DeleteObjectAsync(x))); var nextBatch = since; while (cancellationToken is null || !cancellationToken.Value.IsCancellationRequested) { var sync = await Sync(since: nextBatch, timeout: timeout, setPresence: setPresence, filter: filter, diff --git a/LibMatrix/Homeservers/AuthenticatedHomeserverGeneric.cs b/LibMatrix/Homeservers/AuthenticatedHomeserverGeneric.cs index a280c54..b881e6c 100644 --- a/LibMatrix/Homeservers/AuthenticatedHomeserverGeneric.cs +++ b/LibMatrix/Homeservers/AuthenticatedHomeserverGeneric.cs @@ -12,25 +12,26 @@ using LibMatrix.Services; namespace LibMatrix.Homeservers; public class AuthenticatedHomeserverGeneric : RemoteHomeServer { - public AuthenticatedHomeserverGeneric(TieredStorageService storage, string canonicalHomeServerDomain, string accessToken) : base(canonicalHomeServerDomain) { - Storage = storage; + public AuthenticatedHomeserverGeneric(string canonicalHomeServerDomain, string accessToken) : base(canonicalHomeServerDomain) { AccessToken = accessToken.Trim(); - SyncHelper = new SyncHelper(this, storage); + SyncHelper = new SyncHelper(this); } - public virtual TieredStorageService Storage { get; set; } public virtual SyncHelper SyncHelper { get; init; } public virtual WhoAmIResponse WhoAmI { get; set; } = null!; public virtual string UserId => WhoAmI.UserId; public virtual string AccessToken { get; set; } - public virtual Task<GenericRoom> GetRoom(string roomId) => Task.FromResult<GenericRoom>(new(this, roomId)); + public virtual GenericRoom GetRoom(string roomId) { + if(roomId is null || !roomId.StartsWith("!")) throw new ArgumentException("Room ID must start with !", nameof(roomId)); + return new GenericRoom(this, roomId); + } public virtual async Task<List<GenericRoom>> GetJoinedRooms() { var roomQuery = await _httpClient.GetAsync("/_matrix/client/v3/joined_rooms"); var roomsJson = await roomQuery.Content.ReadFromJsonAsync<JsonElement>(); - var rooms = roomsJson.GetProperty("joined_rooms").EnumerateArray().Select(room => new GenericRoom(this, room.GetString()!)).ToList(); + var rooms = roomsJson.GetProperty("joined_rooms").EnumerateArray().Select(room => GetRoom(room.GetString()!)).ToList(); Console.WriteLine($"Fetched {rooms.Count} rooms"); @@ -58,7 +59,7 @@ public class AuthenticatedHomeserverGeneric : RemoteHomeServer { throw new InvalidDataException($"Failed to create room: {await res.Content.ReadAsStringAsync()}"); } - var room = await GetRoom((await res.Content.ReadFromJsonAsync<JsonObject>())!["room_id"]!.ToString()); + var room = GetRoom((await res.Content.ReadFromJsonAsync<JsonObject>())!["room_id"]!.ToString()); foreach (var user in creationEvent.Invite) { await room.InviteUser(user); @@ -67,6 +68,14 @@ public class AuthenticatedHomeserverGeneric : RemoteHomeServer { return room; } + public virtual async Task Logout() { + var res = await _httpClient.PostAsync("/_matrix/client/v3/logout", null); + if (!res.IsSuccessStatusCode) { + Console.WriteLine($"Failed to logout: {await res.Content.ReadAsStringAsync()}"); + throw new InvalidDataException($"Failed to logout: {await res.Content.ReadAsStringAsync()}"); + } + } + #region Utility Functions public virtual async IAsyncEnumerable<GenericRoom> GetJoinedRoomsByType(string type) { var rooms = await GetJoinedRooms(); diff --git a/LibMatrix/Homeservers/AuthenticatedHomeserverMxApiExtended.cs b/LibMatrix/Homeservers/AuthenticatedHomeserverMxApiExtended.cs index e44d727..5319f46 100644 --- a/LibMatrix/Homeservers/AuthenticatedHomeserverMxApiExtended.cs +++ b/LibMatrix/Homeservers/AuthenticatedHomeserverMxApiExtended.cs @@ -4,5 +4,5 @@ using LibMatrix.Services; namespace LibMatrix.Homeservers; -public class AuthenticatedHomeserverMxApiExtended(TieredStorageService storage, string canonicalHomeServerDomain, string accessToken) : AuthenticatedHomeserverGeneric(storage, canonicalHomeServerDomain, +public class AuthenticatedHomeserverMxApiExtended(string canonicalHomeServerDomain, string accessToken) : AuthenticatedHomeserverGeneric(canonicalHomeServerDomain, accessToken); diff --git a/LibMatrix/Homeservers/AuthenticatedHomeserverSynapse.cs b/LibMatrix/Homeservers/AuthenticatedHomeserverSynapse.cs index 218ded0..ae26f69 100644 --- a/LibMatrix/Homeservers/AuthenticatedHomeserverSynapse.cs +++ b/LibMatrix/Homeservers/AuthenticatedHomeserverSynapse.cs @@ -102,7 +102,7 @@ public class AuthenticatedHomeserverSynapse : AuthenticatedHomeserverGeneric { } } - public AuthenticatedHomeserverSynapse(TieredStorageService storage, string canonicalHomeServerDomain, string accessToken) : base(storage, canonicalHomeServerDomain, accessToken) { + public AuthenticatedHomeserverSynapse(string canonicalHomeServerDomain, string accessToken) : base(canonicalHomeServerDomain, accessToken) { Admin = new(this); } } diff --git a/LibMatrix/Homeservers/RemoteHomeServer.cs b/LibMatrix/Homeservers/RemoteHomeServer.cs index caed397..ab3ab51 100644 --- a/LibMatrix/Homeservers/RemoteHomeServer.cs +++ b/LibMatrix/Homeservers/RemoteHomeServer.cs @@ -1,7 +1,9 @@ using System.Net.Http.Json; +using System.Text.Json.Serialization; +using ArcaneLibs.Extensions; +using LibMatrix.EventTypes.Spec.State; using LibMatrix.Extensions; using LibMatrix.Responses; -using LibMatrix.StateEventTypes.Spec; namespace LibMatrix.Homeservers; @@ -13,12 +15,13 @@ public class RemoteHomeServer(string canonicalHomeServerDomain) { public string FullHomeServerDomain { get; set; } public MatrixHttpClient _httpClient { get; set; } = new(); - public async Task<ProfileResponseEventContent> GetProfile(string mxid) { - if(mxid is null) throw new ArgumentNullException(nameof(mxid)); + public async Task<ProfileResponseEventContent> GetProfileAsync(string mxid) { + if (mxid is null) throw new ArgumentNullException(nameof(mxid)); if (_profileCache.TryGetValue(mxid, out var value)) { if (value is SemaphoreSlim s) await s.WaitAsync(); if (value is ProfileResponseEventContent p) return p; } + _profileCache[mxid] = new SemaphoreSlim(1); var resp = await _httpClient.GetAsync($"/_matrix/client/v3/profile/{mxid}"); @@ -29,10 +32,26 @@ public class RemoteHomeServer(string canonicalHomeServerDomain) { return data; } - public async Task<ClientVersionsResponse> GetClientVersions() { + public async Task<ClientVersionsResponse> GetClientVersionsAsync() { var resp = await _httpClient.GetAsync($"/_matrix/client/versions"); var data = await resp.Content.ReadFromJsonAsync<ClientVersionsResponse>(); if (!resp.IsSuccessStatusCode) Console.WriteLine("ClientVersions: " + data); return data; } + + public async Task<AliasResult> ResolveRoomAliasAsync(string alias) { + var resp = await _httpClient.GetAsync($"/_matrix/client/v3/directory/room/{alias.Replace("#", "%23")}"); + var data = await resp.Content.ReadFromJsonAsync<AliasResult>(); + var text = await resp.Content.ReadAsStringAsync(); + if (!resp.IsSuccessStatusCode) Console.WriteLine("ResolveAlias: " + data.ToJson()); + return data; + } +} + +public class AliasResult { + [JsonPropertyName("room_id")] + public string RoomId { get; set; } = null!; + + [JsonPropertyName("servers")] + public List<string> Servers { get; set; } = null!; } diff --git a/LibMatrix/Interfaces/IStateEventType.cs b/LibMatrix/Interfaces/IStateEventType.cs index f2e4a3b..b187970 100644 --- a/LibMatrix/Interfaces/IStateEventType.cs +++ b/LibMatrix/Interfaces/IStateEventType.cs @@ -4,10 +4,10 @@ namespace LibMatrix.Interfaces; public abstract class EventContent { [JsonPropertyName("m.relates_to")] - public virtual MessageRelatesTo? RelatesTo { get; set; } + public MessageRelatesTo? RelatesTo { get; set; } [JsonPropertyName("m.new_content")] - public virtual EventContent? NewContent { get; set; } + public EventContent? NewContent { get; set; } public abstract class MessageRelatesTo { [JsonPropertyName("m.in_reply_to")] diff --git a/LibMatrix/Responses/CreateRoomRequest.cs b/LibMatrix/Responses/CreateRoomRequest.cs index 82a4b12..381271b 100644 --- a/LibMatrix/Responses/CreateRoomRequest.cs +++ b/LibMatrix/Responses/CreateRoomRequest.cs @@ -2,10 +2,10 @@ using System.Reflection; using System.Text.Json.Nodes; using System.Text.Json.Serialization; using System.Text.RegularExpressions; +using LibMatrix.EventTypes.Spec.State; using LibMatrix.Helpers; using LibMatrix.Homeservers; using LibMatrix.Interfaces; -using LibMatrix.StateEventTypes.Spec; namespace LibMatrix.Responses; diff --git a/LibMatrix/Responses/StateEventResponse.cs b/LibMatrix/Responses/StateEventResponse.cs index c60d71c..7ca6bab 100644 --- a/LibMatrix/Responses/StateEventResponse.cs +++ b/LibMatrix/Responses/StateEventResponse.cs @@ -45,3 +45,8 @@ public class StateEventResponse : StateEvent { public JsonObject? PrevContent { get; set; } } } + +public class ChunkedStateEventResponse { + [JsonPropertyName("chunk")] + public List<StateEventResponse>? Chunk { get; set; } +} diff --git a/LibMatrix/RoomTypes/GenericRoom.cs b/LibMatrix/RoomTypes/GenericRoom.cs index 146b5dd..ab748fe 100644 --- a/LibMatrix/RoomTypes/GenericRoom.cs +++ b/LibMatrix/RoomTypes/GenericRoom.cs @@ -2,10 +2,12 @@ using System.Net.Http.Json; using System.Text.Json; using System.Text.Json.Serialization; using System.Web; +using LibMatrix.EventTypes.Spec; +using LibMatrix.EventTypes.Spec.State; using LibMatrix.Extensions; using LibMatrix.Homeservers; +using LibMatrix.Interfaces; using LibMatrix.Responses; -using LibMatrix.StateEventTypes.Spec; using Microsoft.Extensions.Logging; namespace LibMatrix.RoomTypes; @@ -65,12 +67,12 @@ public class GenericRoom { #endif } catch (MatrixException e) { - if (e is not { ErrorCode: "M_NOT_FOUND" }) { + // if (e is not { ErrorCodode: "M_NOT_FOUND" }) { throw; - } + // } - Console.WriteLine(e); - return default; + // Console.WriteLine(e); + // return default; } } @@ -93,7 +95,7 @@ public class GenericRoom { } } - public async Task JoinAsync(string[]? homeservers = null, string? reason = null) { + public async Task<RoomIdResponse> JoinAsync(string[]? homeservers = null, string? reason = null) { var join_url = $"/_matrix/client/v3/join/{HttpUtility.UrlEncode(RoomId)}"; Console.WriteLine($"Calling {join_url} with {homeservers?.Length ?? 0} via's..."); if (homeservers == null || homeservers.Length == 0) homeservers = new[] { RoomId.Split(':')[1] }; @@ -101,6 +103,7 @@ public class GenericRoom { var res = await _httpClient.PostAsJsonAsync(fullJoinUrl, new { reason }); + return await res.Content.ReadFromJsonAsync<RoomIdResponse>() ?? throw new Exception("Failed to join room?"); } // TODO: rewrite (members endpoint?) @@ -111,10 +114,10 @@ public class GenericRoom { // if (joinedOnly && (member.TypedContent as RoomMemberEventContent)?.Membership is not "join") continue; // yield return member; // } - var res = await _httpClient.GetAsync($"/_matrix/client/v3/rooms/{RoomId}/members"); - var result = - JsonSerializer.DeserializeAsyncEnumerable<StateEventResponse>(await res.Content.ReadAsStreamAsync()); - await foreach (var resp in result) { + var res = await _httpClient.GetAsync($"/_matrix/client/v3/rooms/{RoomId}/members?limit=2"); + var resText = await res.Content.ReadAsStringAsync(); + var result = await JsonSerializer.DeserializeAsync<ChunkedStateEventResponse>(await res.Content.ReadAsStreamAsync()); + foreach (var resp in result.Chunk) { if (resp?.Type != "m.room.member") continue; if (joinedOnly && (resp.TypedContent as RoomMemberEventContent)?.Membership is not "join") continue; yield return resp; @@ -123,6 +126,9 @@ public class GenericRoom { #region Utility shortcuts + public async Task<EventIdResponse> SendMessageEventAsync(RoomMessageEventContent content) => + await SendTimelineEventAsync("m.room.message", content); + public async Task<List<string>> GetAliasesAsync() { var res = await GetStateAsync<RoomAliasEventContent>("m.room.aliases"); return res.Aliases; @@ -187,7 +193,7 @@ public class GenericRoom { await (await _httpClient.PutAsJsonAsync($"/_matrix/client/v3/rooms/{RoomId}/state/{eventType}/{stateKey}", content)) .Content.ReadFromJsonAsync<EventIdResponse>(); - public async Task<EventIdResponse> SendMessageEventAsync(string eventType, RoomMessageEventContent content) { + public async Task<EventIdResponse> SendTimelineEventAsync(string eventType, EventContent content) { var res = await _httpClient.PutAsJsonAsync( $"/_matrix/client/v3/rooms/{RoomId}/send/{eventType}/" + Guid.NewGuid(), content, new JsonSerializerOptions { DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull @@ -244,3 +250,8 @@ public class GenericRoom { await _httpClient.PostAsJsonAsync($"/_matrix/client/v3/rooms/{RoomId}/invite", new UserIdAndReason(userId, reason)); } } + +public class RoomIdResponse { + [JsonPropertyName("room_id")] + public string RoomId { get; set; } = null!; +} diff --git a/LibMatrix/RoomTypes/SpaceRoom.cs b/LibMatrix/RoomTypes/SpaceRoom.cs index 0a4447a..a43ae82 100644 --- a/LibMatrix/RoomTypes/SpaceRoom.cs +++ b/LibMatrix/RoomTypes/SpaceRoom.cs @@ -13,14 +13,14 @@ public class SpaceRoom : GenericRoom { private static SemaphoreSlim _semaphore = new(1, 1); public async IAsyncEnumerable<GenericRoom> GetChildrenAsync(bool includeRemoved = false) { - await _semaphore.WaitAsync(); + // await _semaphore.WaitAsync(); var rooms = new List<GenericRoom>(); var state = GetFullStateAsync(); await foreach (var stateEvent in state) { if (stateEvent.Type != "m.space.child") continue; if (stateEvent.RawContent.ToJson() != "{}" || includeRemoved) - yield return await _homeserver.GetRoom(stateEvent.StateKey); + yield return _homeserver.GetRoom(stateEvent.StateKey); } - _semaphore.Release(); + // _semaphore.Release(); } } diff --git a/LibMatrix/Services/HomeserverProviderService.cs b/LibMatrix/Services/HomeserverProviderService.cs index 71d9860..49167fa 100644 --- a/LibMatrix/Services/HomeserverProviderService.cs +++ b/LibMatrix/Services/HomeserverProviderService.cs @@ -39,10 +39,10 @@ public class HomeserverProviderService { AuthenticatedHomeserverGeneric hs; if (true) { - hs = new AuthenticatedHomeserverMxApiExtended(_tieredStorageService, homeserver, accessToken); + hs = new AuthenticatedHomeserverMxApiExtended(homeserver, accessToken); } else { - hs = new AuthenticatedHomeserverGeneric(_tieredStorageService, homeserver, accessToken); + hs = new AuthenticatedHomeserverGeneric(homeserver, accessToken); } hs.FullHomeServerDomain = domain; diff --git a/LibMatrix/Services/HomeserverResolverService.cs b/LibMatrix/Services/HomeserverResolverService.cs index f2c0781..685724b 100644 --- a/LibMatrix/Services/HomeserverResolverService.cs +++ b/LibMatrix/Services/HomeserverResolverService.cs @@ -5,7 +5,7 @@ using Microsoft.Extensions.Logging; namespace LibMatrix.Services; -public class HomeserverResolverService(ILogger<HomeserverResolverService>? logger) { +public class HomeserverResolverService(ILogger<HomeserverResolverService>? logger = null) { private readonly MatrixHttpClient _httpClient = new(); private static readonly Dictionary<string, string> _wellKnownCache = new(); diff --git a/LibMatrix/Services/TieredStorageService.cs b/LibMatrix/Services/TieredStorageService.cs index 954a2ce..f242785 100644 --- a/LibMatrix/Services/TieredStorageService.cs +++ b/LibMatrix/Services/TieredStorageService.cs @@ -3,10 +3,10 @@ using LibMatrix.Interfaces.Services; namespace LibMatrix.Services; public class TieredStorageService { - public IStorageProvider CacheStorageProvider { get; } - public IStorageProvider DataStorageProvider { get; } + public IStorageProvider? CacheStorageProvider { get; } + public IStorageProvider? DataStorageProvider { get; } - public TieredStorageService(IStorageProvider cacheStorageProvider, IStorageProvider dataStorageProvider) { + public TieredStorageService(IStorageProvider? cacheStorageProvider, IStorageProvider? dataStorageProvider) { CacheStorageProvider = cacheStorageProvider; DataStorageProvider = dataStorageProvider; } diff --git a/LibMatrix/StateEvent.cs b/LibMatrix/StateEvent.cs index 9ca9141..97348a5 100644 --- a/LibMatrix/StateEvent.cs +++ b/LibMatrix/StateEvent.cs @@ -4,15 +4,14 @@ using System.Text.Json.Nodes; using System.Text.Json.Serialization; using ArcaneLibs; using ArcaneLibs.Extensions; +using LibMatrix.EventTypes; using LibMatrix.Helpers; using LibMatrix.Interfaces; -using LibMatrix.StateEventTypes; namespace LibMatrix; public class StateEvent { - public static readonly List<Type> KnownStateEventTypes = - new ClassCollector<EventContent>().ResolveFromAllAccessibleAssemblies(); + public static List<Type> KnownStateEventTypes { get; } = new ClassCollector<EventContent>().ResolveFromAllAccessibleAssemblies(); public static readonly Dictionary<string, Type> KnownStateEventTypesByName = KnownStateEventTypes.Aggregate( new Dictionary<string, Type>(), |