diff --git a/LibMatrix/EventIdResponse.cs b/LibMatrix/EventIdResponse.cs
index 4d715a4..4dca734 100644
--- a/LibMatrix/EventIdResponse.cs
+++ b/LibMatrix/EventIdResponse.cs
@@ -1,3 +1,4 @@
+#define BALLS
using System.Text.Json.Serialization;
namespace LibMatrix;
diff --git a/LibMatrix/Extensions/EnumerableExtensions.cs b/LibMatrix/Extensions/EnumerableExtensions.cs
index 42d9491..b5193ab 100644
--- a/LibMatrix/Extensions/EnumerableExtensions.cs
+++ b/LibMatrix/Extensions/EnumerableExtensions.cs
@@ -1,7 +1,7 @@
namespace LibMatrix.Extensions;
public static class EnumerableExtensions {
- public static void MergeStateEventLists(this IList<StateEvent> oldState, IList<StateEvent> newState) {
+ public static void MergeStateEventLists(this IList<LegacyMatrixEvent> oldState, IList<LegacyMatrixEvent> newState) {
foreach (var stateEvent in newState) {
var old = oldState.FirstOrDefault(x => x.Type == stateEvent.Type && x.StateKey == stateEvent.StateKey);
if (old is null) {
@@ -14,7 +14,7 @@ public static class EnumerableExtensions {
}
}
- public static void MergeStateEventLists(this IList<StateEventResponse> oldState, IList<StateEventResponse> newState) {
+ public static void MergeStateEventLists(this IList<LegacyMatrixEventResponse> oldState, IList<LegacyMatrixEventResponse> newState) {
foreach (var stateEvent in newState) {
var old = oldState.FirstOrDefault(x => x.Type == stateEvent.Type && x.StateKey == stateEvent.StateKey);
if (old is null) {
diff --git a/LibMatrix/Extensions/JsonElementExtensions.cs b/LibMatrix/Extensions/JsonElementExtensions.cs
index c4ed743..a2faddc 100644
--- a/LibMatrix/Extensions/JsonElementExtensions.cs
+++ b/LibMatrix/Extensions/JsonElementExtensions.cs
@@ -8,7 +8,7 @@ namespace LibMatrix.Extensions;
public static class JsonElementExtensions {
public static bool FindExtraJsonElementFields(this JsonElement obj, Type objectType, string objectPropertyName) {
if (objectPropertyName == "content" && objectType == typeof(JsonObject))
- objectType = typeof(StateEventResponse);
+ objectType = typeof(LegacyMatrixEventResponse);
// if (t == typeof(JsonNode))
// return false;
@@ -35,9 +35,9 @@ public static class JsonElementExtensions {
continue;
}
- if (field.Name == "content" && (objectType == typeof(StateEventResponse) || objectType == typeof(StateEvent))) {
+ if (field.Name == "content" && (objectType == typeof(LegacyMatrixEventResponse) || objectType == typeof(LegacyMatrixEvent))) {
unknownPropertyFound |= field.FindExtraJsonPropertyFieldsByValueKind(
- StateEvent.GetStateEventType(obj.GetProperty("type").GetString()!), // We expect type to always be present
+ LegacyMatrixEvent.GetStateEventType(obj.GetProperty("type").GetString()!), // We expect type to always be present
mappedProperty.PropertyType);
continue;
}
diff --git a/LibMatrix/Helpers/SyncHelper.cs b/LibMatrix/Helpers/SyncHelper.cs
index 1833bd0..5635955 100644
--- a/LibMatrix/Helpers/SyncHelper.cs
+++ b/LibMatrix/Helpers/SyncHelper.cs
@@ -204,12 +204,12 @@ public class SyncHelper(AuthenticatedHomeserverGeneric homeserver, ILogger? logg
/// <summary>
/// Event fired when a timeline event is received
/// </summary>
- public List<Func<StateEventResponse, Task>> TimelineEventHandlers { get; } = new();
+ public List<Func<LegacyMatrixEventResponse, Task>> TimelineEventHandlers { get; } = new();
/// <summary>
/// Event fired when an account data event is received
/// </summary>
- public List<Func<StateEventResponse, Task>> AccountDataReceivedHandlers { get; } = new();
+ public List<Func<LegacyMatrixEventResponse, Task>> AccountDataReceivedHandlers { get; } = new();
private void Log(string message) {
if (logger is null) Console.WriteLine(message);
diff --git a/LibMatrix/Helpers/SyncStateResolver.cs b/LibMatrix/Helpers/SyncStateResolver.cs
index 72d600d..b1f83ff 100644
--- a/LibMatrix/Helpers/SyncStateResolver.cs
+++ b/LibMatrix/Helpers/SyncStateResolver.cs
@@ -37,13 +37,13 @@ public class SyncStateResolver(AuthenticatedHomeserverGeneric homeserver, ILogge
oldState.NextBatch = newState.NextBatch ?? oldState.NextBatch;
oldState.AccountData ??= new EventList();
- oldState.AccountData.Events ??= new List<StateEventResponse>();
+ oldState.AccountData.Events ??= new List<LegacyMatrixEventResponse>();
if (newState.AccountData?.Events is not null)
- oldState.AccountData.Events.MergeStateEventLists(newState.AccountData?.Events ?? new List<StateEventResponse>());
+ oldState.AccountData.Events.MergeStateEventLists(newState.AccountData?.Events ?? new List<LegacyMatrixEventResponse>());
oldState.Presence ??= new SyncResponse.PresenceDataStructure();
if (newState.Presence?.Events is not null)
- oldState.Presence.Events.MergeStateEventLists(newState.Presence?.Events ?? new List<StateEventResponse>());
+ oldState.Presence.Events.MergeStateEventLists(newState.Presence?.Events ?? new List<LegacyMatrixEventResponse>());
oldState.DeviceOneTimeKeysCount ??= new Dictionary<string, int>();
if (newState.DeviceOneTimeKeysCount is not null)
@@ -55,9 +55,9 @@ public class SyncStateResolver(AuthenticatedHomeserverGeneric homeserver, ILogge
oldState.Rooms = MergeRoomsDataStructure(oldState.Rooms, newState.Rooms);
oldState.ToDevice ??= new EventList();
- oldState.ToDevice.Events ??= new List<StateEventResponse>();
+ oldState.ToDevice.Events ??= new List<LegacyMatrixEventResponse>();
if (newState.ToDevice?.Events is not null)
- oldState.ToDevice.Events.MergeStateEventLists(newState.ToDevice?.Events ?? new List<StateEventResponse>());
+ oldState.ToDevice.Events.MergeStateEventLists(newState.ToDevice?.Events ?? new List<LegacyMatrixEventResponse>());
oldState.DeviceLists ??= new SyncResponse.DeviceListsDataStructure();
if (newState.DeviceLists?.Changed is not null)
@@ -97,22 +97,22 @@ public class SyncStateResolver(AuthenticatedHomeserverGeneric homeserver, ILogge
private SyncResponse.RoomsDataStructure.LeftRoomDataStructure MergeLeftRoomDataStructure(SyncResponse.RoomsDataStructure.LeftRoomDataStructure oldData,
SyncResponse.RoomsDataStructure.LeftRoomDataStructure newData) {
oldData.AccountData ??= new EventList();
- oldData.AccountData.Events ??= new List<StateEventResponse>();
+ oldData.AccountData.Events ??= new List<LegacyMatrixEventResponse>();
oldData.Timeline ??= new SyncResponse.RoomsDataStructure.JoinedRoomDataStructure.TimelineDataStructure();
- oldData.Timeline.Events ??= new List<StateEventResponse>();
+ oldData.Timeline.Events ??= new List<LegacyMatrixEventResponse>();
oldData.State ??= new EventList();
- oldData.State.Events ??= new List<StateEventResponse>();
+ oldData.State.Events ??= new List<LegacyMatrixEventResponse>();
if (newData.AccountData?.Events is not null)
- oldData.AccountData.Events.MergeStateEventLists(newData.AccountData?.Events ?? new List<StateEventResponse>());
+ oldData.AccountData.Events.MergeStateEventLists(newData.AccountData?.Events ?? new List<LegacyMatrixEventResponse>());
if (newData.Timeline?.Events is not null)
- oldData.Timeline.Events.MergeStateEventLists(newData.Timeline?.Events ?? new List<StateEventResponse>());
+ oldData.Timeline.Events.MergeStateEventLists(newData.Timeline?.Events ?? new List<LegacyMatrixEventResponse>());
oldData.Timeline.Limited = newData.Timeline?.Limited ?? oldData.Timeline.Limited;
oldData.Timeline.PrevBatch = newData.Timeline?.PrevBatch ?? oldData.Timeline.PrevBatch;
if (newData.State?.Events is not null)
- oldData.State.Events.MergeStateEventLists(newData.State?.Events ?? new List<StateEventResponse>());
+ oldData.State.Events.MergeStateEventLists(newData.State?.Events ?? new List<LegacyMatrixEventResponse>());
return oldData;
}
@@ -120,9 +120,9 @@ public class SyncStateResolver(AuthenticatedHomeserverGeneric homeserver, ILogge
private SyncResponse.RoomsDataStructure.InvitedRoomDataStructure MergeInvitedRoomDataStructure(SyncResponse.RoomsDataStructure.InvitedRoomDataStructure oldData,
SyncResponse.RoomsDataStructure.InvitedRoomDataStructure newData) {
oldData.InviteState ??= new EventList();
- oldData.InviteState.Events ??= new List<StateEventResponse>();
+ oldData.InviteState.Events ??= new List<LegacyMatrixEventResponse>();
if (newData.InviteState?.Events is not null)
- oldData.InviteState.Events.MergeStateEventLists(newData.InviteState?.Events ?? new List<StateEventResponse>());
+ oldData.InviteState.Events.MergeStateEventLists(newData.InviteState?.Events ?? new List<LegacyMatrixEventResponse>());
return oldData;
}
@@ -130,27 +130,27 @@ public class SyncStateResolver(AuthenticatedHomeserverGeneric homeserver, ILogge
private SyncResponse.RoomsDataStructure.JoinedRoomDataStructure MergeJoinedRoomDataStructure(SyncResponse.RoomsDataStructure.JoinedRoomDataStructure oldData,
SyncResponse.RoomsDataStructure.JoinedRoomDataStructure newData) {
oldData.AccountData ??= new EventList();
- oldData.AccountData.Events ??= new List<StateEventResponse>();
+ oldData.AccountData.Events ??= new List<LegacyMatrixEventResponse>();
oldData.Timeline ??= new SyncResponse.RoomsDataStructure.JoinedRoomDataStructure.TimelineDataStructure();
- oldData.Timeline.Events ??= new List<StateEventResponse>();
+ oldData.Timeline.Events ??= new List<LegacyMatrixEventResponse>();
oldData.State ??= new EventList();
- oldData.State.Events ??= new List<StateEventResponse>();
+ oldData.State.Events ??= new List<LegacyMatrixEventResponse>();
oldData.Ephemeral ??= new EventList();
- oldData.Ephemeral.Events ??= new List<StateEventResponse>();
+ oldData.Ephemeral.Events ??= new List<LegacyMatrixEventResponse>();
if (newData.AccountData?.Events is not null)
- oldData.AccountData.Events.MergeStateEventLists(newData.AccountData?.Events ?? new List<StateEventResponse>());
+ oldData.AccountData.Events.MergeStateEventLists(newData.AccountData?.Events ?? new List<LegacyMatrixEventResponse>());
if (newData.Timeline?.Events is not null)
- oldData.Timeline.Events.MergeStateEventLists(newData.Timeline?.Events ?? new List<StateEventResponse>());
+ oldData.Timeline.Events.MergeStateEventLists(newData.Timeline?.Events ?? new List<LegacyMatrixEventResponse>());
oldData.Timeline.Limited = newData.Timeline?.Limited ?? oldData.Timeline.Limited;
oldData.Timeline.PrevBatch = newData.Timeline?.PrevBatch ?? oldData.Timeline.PrevBatch;
if (newData.State?.Events is not null)
- oldData.State.Events.MergeStateEventLists(newData.State?.Events ?? new List<StateEventResponse>());
+ oldData.State.Events.MergeStateEventLists(newData.State?.Events ?? new List<LegacyMatrixEventResponse>());
if (newData.Ephemeral?.Events is not null)
- oldData.Ephemeral.Events.MergeStateEventLists(newData.Ephemeral?.Events ?? new List<StateEventResponse>());
+ oldData.Ephemeral.Events.MergeStateEventLists(newData.Ephemeral?.Events ?? new List<LegacyMatrixEventResponse>());
oldData.UnreadNotifications ??= new SyncResponse.RoomsDataStructure.JoinedRoomDataStructure.UnreadNotificationsDataStructure();
oldData.UnreadNotifications.HighlightCount = newData.UnreadNotifications?.HighlightCount ?? oldData.UnreadNotifications.HighlightCount;
diff --git a/LibMatrix/StateEvent.cs b/LibMatrix/LegacyMatrixEvent.cs
index 81ee3fe..1cfc879 100644
--- a/LibMatrix/StateEvent.cs
+++ b/LibMatrix/LegacyMatrixEvent.cs
@@ -12,7 +12,7 @@ using LibMatrix.Extensions;
namespace LibMatrix;
-public class StateEvent {
+public class LegacyMatrixEvent {
public static FrozenSet<Type> KnownStateEventTypes { get; } = new ClassCollector<EventContent>().ResolveFromAllAccessibleAssemblies().ToFrozenSet();
public static FrozenDictionary<string, Type> KnownStateEventTypesByName { get; } = KnownStateEventTypes.Aggregate(
@@ -97,39 +97,7 @@ public class StateEvent {
get => _rawContent;
set => _rawContent = value;
}
- //
- // [JsonIgnore]
- // public new Type GetType {
- // get {
- // var type = GetStateEventType(Type);
- //
- // //special handling for some types
- // // if (type == typeof(RoomEmotesEventContent)) {
- // // RawContent["emote"] = RawContent["emote"]?.AsObject() ?? new JsonObject();
- // // }
- // //
- // // if (this is StateEventResponse stateEventResponse) {
- // // if (type == null || type == typeof(object)) {
- // // Console.WriteLine($"Warning: unknown event type '{Type}'!");
- // // Console.WriteLine(RawContent.ToJson());
- // // Directory.CreateDirectory($"unknown_state_events/{Type}");
- // // File.WriteAllText($"unknown_state_events/{Type}/{stateEventResponse.EventId}.json",
- // // RawContent.ToJson());
- // // Console.WriteLine($"Saved to unknown_state_events/{Type}/{stateEventResponse.EventId}.json");
- // // }
- // // 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());
- // // Console.WriteLine($"Saved to unknown_state_events/{Type}/{stateEventResponse.EventId}.json");
- // // }
- // // }
- //
- // return type;
- // }
- // }
-
- //debug
+
[JsonIgnore]
public string InternalSelfTypeName {
get {
@@ -145,7 +113,7 @@ public class StateEvent {
public string InternalContentTypeName => TypedContent?.GetType().Name ?? "null";
}
-public class StateEventResponse : StateEvent {
+public class LegacyMatrixEventResponse : LegacyMatrixEvent {
[JsonPropertyName("origin_server_ts")]
public long? OriginServerTs { get; set; }
@@ -189,17 +157,17 @@ internal partial class ChunkedStateEventResponseSerializerContext : JsonSerializ
public class EventList {
public EventList() { }
- public EventList(List<StateEventResponse>? events) {
+ public EventList(List<LegacyMatrixEventResponse>? events) {
Events = events;
}
[JsonPropertyName("events")]
- public List<StateEventResponse>? Events { get; set; } = new();
+ public List<LegacyMatrixEventResponse>? Events { get; set; } = new();
}
public class ChunkedStateEventResponse {
[JsonPropertyName("chunk")]
- public List<StateEventResponse>? Chunk { get; set; } = new();
+ public List<LegacyMatrixEventResponse>? Chunk { get; set; } = new();
}
public class PaginatedChunkedStateEventResponse : ChunkedStateEventResponse {
diff --git a/LibMatrix/MessagesResponse.cs b/LibMatrix/MessagesResponse.cs
index 526da74..97a6c78 100644
--- a/LibMatrix/MessagesResponse.cs
+++ b/LibMatrix/MessagesResponse.cs
@@ -10,8 +10,8 @@ public class MessagesResponse {
public string? End { get; set; }
[JsonPropertyName("chunk")]
- public List<StateEventResponse> Chunk { get; set; } = new();
+ public List<LegacyMatrixEventResponse> Chunk { get; set; } = new();
[JsonPropertyName("state")]
- public List<StateEventResponse> State { get; set; } = new();
+ public List<LegacyMatrixEventResponse> State { get; set; } = new();
}
\ No newline at end of file
diff --git a/LibMatrix/Responses/CreateRoomRequest.cs b/LibMatrix/Responses/CreateRoomRequest.cs
index 6f47183..f5218b9 100644
--- a/LibMatrix/Responses/CreateRoomRequest.cs
+++ b/LibMatrix/Responses/CreateRoomRequest.cs
@@ -29,7 +29,7 @@ public class CreateRoomRequest {
// public string Preset { get; set; } = null!;
[JsonPropertyName("initial_state")]
- public List<StateEvent>? InitialState { get; set; }
+ public List<LegacyMatrixEvent>? InitialState { get; set; }
/// <summary>
/// One of: ["public", "private"]
@@ -50,15 +50,15 @@ public class CreateRoomRequest {
/// For use only when you can't use the CreationContent property
/// </summary>
- public StateEvent this[string eventType, string eventKey = ""] {
+ public LegacyMatrixEvent this[string eventType, string eventKey = ""] {
get {
var stateEvent = InitialState.FirstOrDefault(x => x.Type == eventType && x.StateKey == eventKey);
if (stateEvent == null)
- InitialState.Add(stateEvent = new StateEvent {
+ InitialState.Add(stateEvent = new LegacyMatrixEvent {
Type = eventType,
StateKey = eventKey,
TypedContent = (EventContent)Activator.CreateInstance(
- StateEvent.KnownStateEventTypes.FirstOrDefault(x =>
+ LegacyMatrixEvent.KnownStateEventTypes.FirstOrDefault(x =>
x.GetCustomAttributes<MatrixEventAttribute>()?
.Any(y => y.EventName == eventType) ?? false) ?? typeof(UnknownEventContent)
)!
@@ -118,7 +118,7 @@ public class CreateRoomRequest {
}
},
RoomAliasName = roomAliasName,
- InitialState = new List<StateEvent>()
+ InitialState = new List<LegacyMatrixEvent>()
};
return request;
@@ -158,7 +158,7 @@ public class CreateRoomRequest {
}
},
RoomAliasName = roomAliasName,
- InitialState = new List<StateEvent>()
+ InitialState = new List<LegacyMatrixEvent>()
};
return request;
diff --git a/LibMatrix/Responses/SyncResponse.cs b/LibMatrix/Responses/SyncResponse.cs
index e4addb6..7a51afe 100644
--- a/LibMatrix/Responses/SyncResponse.cs
+++ b/LibMatrix/Responses/SyncResponse.cs
@@ -39,7 +39,7 @@ public class SyncResponse {
// supporting classes
public class PresenceDataStructure {
[JsonPropertyName("events")]
- public List<StateEventResponse> Events { get; set; } = new();
+ public List<LegacyMatrixEventResponse> Events { get; set; } = new();
}
public class RoomsDataStructure {
@@ -85,13 +85,13 @@ public class SyncResponse {
public class TimelineDataStructure {
public TimelineDataStructure() { }
- public TimelineDataStructure(List<StateEventResponse>? events, bool? limited) {
+ public TimelineDataStructure(List<LegacyMatrixEventResponse>? events, bool? limited) {
Events = events;
Limited = limited;
}
[JsonPropertyName("events")]
- public List<StateEventResponse>? Events { get; set; }
+ public List<LegacyMatrixEventResponse>? Events { get; set; }
[JsonPropertyName("prev_batch")]
public string? PrevBatch { get; set; }
diff --git a/LibMatrix/RoomTypes/GenericRoom.cs b/LibMatrix/RoomTypes/GenericRoom.cs
index f15327c..5d85abd 100644
--- a/LibMatrix/RoomTypes/GenericRoom.cs
+++ b/LibMatrix/RoomTypes/GenericRoom.cs
@@ -32,13 +32,13 @@ public class GenericRoom {
public string RoomId { get; set; }
- public async IAsyncEnumerable<StateEventResponse?> GetFullStateAsync() {
- var result = Homeserver.ClientHttpClient.GetAsyncEnumerableFromJsonAsync<StateEventResponse>($"/_matrix/client/v3/rooms/{RoomId}/state");
+ public async IAsyncEnumerable<LegacyMatrixEventResponse?> GetFullStateAsync() {
+ var result = Homeserver.ClientHttpClient.GetAsyncEnumerableFromJsonAsync<LegacyMatrixEventResponse>($"/_matrix/client/v3/rooms/{RoomId}/state");
await foreach (var resp in result) yield return resp;
}
- public Task<List<StateEventResponse>> GetFullStateAsListAsync() =>
- Homeserver.ClientHttpClient.GetFromJsonAsync<List<StateEventResponse>>($"/_matrix/client/v3/rooms/{RoomId}/state");
+ public Task<List<LegacyMatrixEventResponse>> GetFullStateAsListAsync() =>
+ Homeserver.ClientHttpClient.GetFromJsonAsync<List<LegacyMatrixEventResponse>>($"/_matrix/client/v3/rooms/{RoomId}/state");
public async Task<T?> GetStateAsync<T>(string type, string stateKey = "") {
if (string.IsNullOrEmpty(type)) throw new ArgumentNullException(nameof(type), "Event type must be specified");
@@ -68,7 +68,7 @@ public class GenericRoom {
}
}
- public async Task<StateEventResponse> GetStateEventAsync(string type, string stateKey = "") {
+ public async Task<LegacyMatrixEventResponse> GetStateEventAsync(string type, string stateKey = "") {
if (string.IsNullOrEmpty(type)) throw new ArgumentNullException(nameof(type), "Event type must be specified");
var url = $"/_matrix/client/v3/rooms/{RoomId}/state/{type}";
if (!string.IsNullOrEmpty(stateKey)) url += $"/{stateKey}";
@@ -81,7 +81,7 @@ public class GenericRoom {
ErrorCode = LibMatrixException.ErrorCodes.M_UNSUPPORTED
};
// throw new InvalidDataException("Returned event type does not match requested type, or server does not support passing `format`.");
- return resp.Deserialize<StateEventResponse>();
+ return resp.Deserialize<LegacyMatrixEventResponse>();
}
catch (MatrixException e) {
// if (e is not { ErrorCodode: "M_NOT_FOUND" }) {
@@ -132,7 +132,7 @@ public class GenericRoom {
}
}
- public async Task<StateEventResponse?> GetStateEventOrNullAsync(string type, string stateKey = "") {
+ public async Task<LegacyMatrixEventResponse?> GetStateEventOrNullAsync(string type, string stateKey = "") {
try {
return await GetStateEventAsync(type, stateKey);
}
@@ -227,7 +227,7 @@ public class GenericRoom {
return await res.Content.ReadFromJsonAsync<RoomIdResponse>() ?? throw new Exception("Failed to join room?");
}
- public async IAsyncEnumerable<StateEventResponse> GetMembersEnumerableAsync(bool joinedOnly = true) {
+ public async IAsyncEnumerable<LegacyMatrixEventResponse> GetMembersEnumerableAsync(bool joinedOnly = true) {
// var sw = Stopwatch.StartNew();
var res = await Homeserver.ClientHttpClient.GetAsync($"/_matrix/client/v3/rooms/{RoomId}/members");
// if (sw.ElapsedMilliseconds > 1000)
@@ -251,7 +251,7 @@ public class GenericRoom {
// Console.WriteLine($"Members call iterated in {sw.GetElapsedAndRestart()}");
}
- public async Task<FrozenSet<StateEventResponse>> GetMembersListAsync(bool joinedOnly = true) {
+ public async Task<FrozenSet<LegacyMatrixEventResponse>> GetMembersListAsync(bool joinedOnly = true) {
// var sw = Stopwatch.StartNew();
var res = await Homeserver.ClientHttpClient.GetAsync($"/_matrix/client/v3/rooms/{RoomId}/members");
// if (sw.ElapsedMilliseconds > 1000)
@@ -265,7 +265,7 @@ public class GenericRoom {
// if (sw.ElapsedMilliseconds > 100)
// Console.WriteLine($"Members call deserialised in {sw.GetElapsedAndRestart()}");
// else sw.Restart();
- var members = new List<StateEventResponse>();
+ var members = new List<LegacyMatrixEventResponse>();
foreach (var resp in result.Chunk) {
if (resp?.Type != "m.room.member") continue;
if (joinedOnly && resp.RawContent?["membership"]?.GetValue<string>() != "join") continue;
@@ -451,8 +451,8 @@ public class GenericRoom {
}
}
- public Task<StateEventResponse> GetEventAsync(string eventId) =>
- Homeserver.ClientHttpClient.GetFromJsonAsync<StateEventResponse>($"/_matrix/client/v3/rooms/{RoomId}/event/{eventId}");
+ public Task<LegacyMatrixEventResponse> GetEventAsync(string eventId) =>
+ Homeserver.ClientHttpClient.GetFromJsonAsync<LegacyMatrixEventResponse>($"/_matrix/client/v3/rooms/{RoomId}/event/{eventId}");
public async Task<EventIdResponse> RedactEventAsync(string eventToRedact, string reason) {
var data = new { reason };
@@ -516,7 +516,7 @@ public class GenericRoom {
#endregion
- public async IAsyncEnumerable<StateEventResponse> GetRelatedEventsAsync(string eventId, string? relationType = null, string? eventType = null, string? dir = "f",
+ public async IAsyncEnumerable<LegacyMatrixEventResponse> GetRelatedEventsAsync(string eventId, string? relationType = null, string? eventType = null, string? dir = "f",
string? from = null, int? chunkLimit = 100, bool? recurse = null, string? to = null) {
var path = $"/_matrix/client/v1/rooms/{RoomId}/relations/{HttpUtility.UrlEncode(eventId)}";
if (!string.IsNullOrEmpty(relationType)) path += $"/{relationType}";
|