diff --git a/MatrixRoomUtils.Web/Classes/RoomCreationTemplates/DefaultRoomCreationTemplate.cs b/MatrixRoomUtils.Web/Classes/RoomCreationTemplates/DefaultRoomCreationTemplate.cs
index ca6345f..a519977 100644
--- a/MatrixRoomUtils.Web/Classes/RoomCreationTemplates/DefaultRoomCreationTemplate.cs
+++ b/MatrixRoomUtils.Web/Classes/RoomCreationTemplates/DefaultRoomCreationTemplate.cs
@@ -2,6 +2,7 @@ using System.Text.Json.Nodes;
using MatrixRoomUtils.Core;
using MatrixRoomUtils.Core.Responses;
using MatrixRoomUtils.Core.StateEventTypes;
+using MatrixRoomUtils.Core.StateEventTypes.Spec;
namespace MatrixRoomUtils.Web.Classes.RoomCreationTemplates;
@@ -9,7 +10,7 @@ public class DefaultRoomCreationTemplate : IRoomCreationTemplate {
public string Name => "Default";
public CreateRoomRequest CreateRoomRequest =>
- new CreateRoomRequest {
+ new() {
Name = "My new room",
RoomAliasName = "myroom",
InitialState = new List<StateEvent> {
@@ -21,7 +22,7 @@ public class DefaultRoomCreationTemplate : IRoomCreationTemplate {
},
new() {
Type = "m.room.guest_access",
- TypedContent = new GuestAccessData {
+ TypedContent = new GuestAccessEventData {
GuestAccess = "can_join"
}
},
@@ -47,7 +48,7 @@ public class DefaultRoomCreationTemplate : IRoomCreationTemplate {
}
},
Visibility = "public",
- PowerLevelContentOverride = new PowerLevelEvent {
+ PowerLevelContentOverride = new PowerLevelEventData {
UsersDefault = 0,
EventsDefault = 100,
StateDefault = 50,
@@ -55,7 +56,7 @@ public class DefaultRoomCreationTemplate : IRoomCreationTemplate {
Redact = 50,
Kick = 50,
Ban = 50,
- NotificationsPl = new PowerLevelEvent.NotificationsPL {
+ NotificationsPl = new PowerLevelEventData.NotificationsPL {
Room = 50
},
Events = new Dictionary<string, int> {
diff --git a/MatrixRoomUtils.Web/Classes/RoomInfo.cs b/MatrixRoomUtils.Web/Classes/RoomInfo.cs
new file mode 100644
index 0000000..711bf55
--- /dev/null
+++ b/MatrixRoomUtils.Web/Classes/RoomInfo.cs
@@ -0,0 +1,29 @@
+using MatrixRoomUtils.Core;
+using MatrixRoomUtils.Core.Responses;
+using MatrixRoomUtils.Core.RoomTypes;
+
+namespace MatrixRoomUtils.Web.Classes;
+
+public class RoomInfo {
+ public GenericRoom Room { get; set; }
+ public List<StateEventResponse?> StateEvents { get; } = new();
+
+ public async Task<StateEventResponse?> GetStateEvent(string type, string stateKey = "") {
+ var @event = StateEvents.FirstOrDefault(x => x.Type == type && x.StateKey == stateKey);
+ if (@event is not null) return @event;
+ @event = new StateEventResponse() {
+ RoomId = Room.RoomId,
+ Type = type,
+ StateKey = stateKey,
+ };
+ try {
+ @event.TypedContent = await Room.GetStateAsync<object>(type, stateKey);
+ }
+ catch (MatrixException e) {
+ if (e is { ErrorCode: "M_NOT_FOUND" }) @event.TypedContent = default!;
+ else throw;
+ }
+ StateEvents.Add(@event);
+ return @event;
+ }
+}
\ No newline at end of file
diff --git a/MatrixRoomUtils.Web/Classes/SessionStorageProviderService.cs b/MatrixRoomUtils.Web/Classes/SessionStorageProviderService.cs
index 4a9c7d1..58466c7 100644
--- a/MatrixRoomUtils.Web/Classes/SessionStorageProviderService.cs
+++ b/MatrixRoomUtils.Web/Classes/SessionStorageProviderService.cs
@@ -1,7 +1,7 @@
using Blazored.SessionStorage;
using MatrixRoomUtils.Core.Interfaces.Services;
-namespace MatrixRoomUtils.Web;
+namespace MatrixRoomUtils.Web.Classes;
public class SessionStorageProviderService : IStorageProvider {
private readonly ISessionStorageService _sessionStorage;
|