diff --git a/LibMatrix/Filters/SyncFilter.cs b/LibMatrix/Filters/SyncFilter.cs
index 787ffa7..8c66656 100644
--- a/LibMatrix/Filters/SyncFilter.cs
+++ b/LibMatrix/Filters/SyncFilter.cs
@@ -0,0 +1,100 @@
+using System.Text.Json.Serialization;
+
+namespace LibMatrix.Filters;
+
+public class SyncFilter {
+ [JsonPropertyName("account_data")]
+ public EventFilter? AccountData { get; set; }
+
+ [JsonPropertyName("presence")]
+ public EventFilter? Presence { get; set; }
+
+ [JsonPropertyName("room")]
+ public RoomFilter? Room { get; set; }
+
+ public class RoomFilter {
+ [JsonPropertyName("account_data")]
+ public StateFilter? AccountData { get; set; }
+
+ [JsonPropertyName("ephemeral")]
+ public StateFilter? Ephemeral { get; set; }
+
+ [JsonPropertyName("state")]
+ public StateFilter? State { get; set; }
+
+ [JsonPropertyName("timeline")]
+ public StateFilter? Timeline { get; set; }
+
+ [JsonPropertyName("rooms")]
+ public List<string>? Rooms { get; set; }
+
+ [JsonPropertyName("not_rooms")]
+ public List<string>? NotRooms { get; set; }
+
+ [JsonPropertyName("include_leave")]
+ public bool? IncludeLeave { get; set; }
+
+ private static readonly RoomFilter Empty = new() {
+ Rooms = [],
+ IncludeLeave = false,
+ AccountData = StateFilter.Empty,
+ Ephemeral = StateFilter.Empty,
+ State = StateFilter.Empty,
+ Timeline = StateFilter.Empty,
+ };
+
+ public class StateFilter(
+ bool? containsUrl = null,
+ bool? includeRedundantMembers = null,
+ bool? lazyLoadMembers = null,
+ List<string>? rooms = null,
+ List<string>? notRooms = null,
+ bool? unreadThreadNotifications = null,
+ //base ctor
+ int? limit = null,
+ List<string>? types = null,
+ List<string>? notTypes = null,
+ List<string>? senders = null,
+ List<string>? notSenders = null
+ ) : EventFilter(limit, types, notTypes, senders, notSenders) {
+ [JsonPropertyName("contains_url")]
+ public bool? ContainsUrl { get; set; } = containsUrl;
+
+ [JsonPropertyName("include_redundant_members")]
+ public bool? IncludeRedundantMembers { get; set; } = includeRedundantMembers;
+
+ [JsonPropertyName("lazy_load_members")]
+ public bool? LazyLoadMembers { get; set; } = lazyLoadMembers;
+
+ [JsonPropertyName("rooms")]
+ public List<string>? Rooms { get; set; } = rooms;
+
+ [JsonPropertyName("not_rooms")]
+ public List<string>? NotRooms { get; set; } = notRooms;
+
+ [JsonPropertyName("unread_thread_notifications")]
+ public bool? UnreadThreadNotifications { get; set; } = unreadThreadNotifications;
+
+ public static readonly StateFilter Empty = new(limit: 0, senders: [], types: [], rooms: []);
+ }
+ }
+
+ public class EventFilter(int? limit = null, List<string>? types = null, List<string>? notTypes = null, List<string>? senders = null, List<string>? notSenders = null) {
+ [JsonPropertyName("limit")]
+ public int? Limit { get; set; } = limit;
+
+ [JsonPropertyName("types")]
+ public List<string>? Types { get; set; } = types;
+
+ [JsonPropertyName("not_types")]
+ public List<string>? NotTypes { get; set; } = notTypes;
+
+ [JsonPropertyName("senders")]
+ public List<string>? Senders { get; set; } = senders;
+
+ [JsonPropertyName("not_senders")]
+ public List<string>? NotSenders { get; set; } = notSenders;
+
+ public static readonly EventFilter Empty = new(limit: 0, senders: [], types: []);
+ }
+}
diff --git a/LibMatrix/RoomTypes/GenericRoom.cs b/LibMatrix/RoomTypes/GenericRoom.cs
index cc3c0a1..55fa42c 100644
--- a/LibMatrix/RoomTypes/GenericRoom.cs
+++ b/LibMatrix/RoomTypes/GenericRoom.cs
@@ -304,7 +304,6 @@ public class GenericRoom {
public Task<RoomPowerLevelEventContent?> GetPowerLevelsAsync() =>
GetStateAsync<RoomPowerLevelEventContent>("m.room.power_levels");
- [Obsolete("This method will be merged into GetNameAsync() in the future.")]
public async Task<string> GetNameOrFallbackAsync(int maxMemberNames = 2) {
try {
var name = await GetNameAsync();
diff --git a/LibMatrix/RoomTypes/PolicyRoom.cs b/LibMatrix/RoomTypes/PolicyRoom.cs
index e0b6edb..c6eec63 100644
--- a/LibMatrix/RoomTypes/PolicyRoom.cs
+++ b/LibMatrix/RoomTypes/PolicyRoom.cs
@@ -8,10 +8,10 @@ namespace LibMatrix.RoomTypes;
public class PolicyRoom(AuthenticatedHomeserverGeneric homeserver, string roomId) : GenericRoom(homeserver, roomId) {
public const string TypeName = "support.feline.policy.lists.msc.v1";
- private static readonly FrozenSet<string> UserPolicyEventTypes = EventContent.GetMatchingEventTypes<UserPolicyRuleEventContent>().ToFrozenSet();
- private static readonly FrozenSet<string> ServerPolicyEventTypes = EventContent.GetMatchingEventTypes<ServerPolicyRuleEventContent>().ToFrozenSet();
- private static readonly FrozenSet<string> RoomPolicyEventTypes = EventContent.GetMatchingEventTypes<RoomPolicyRuleEventContent>().ToFrozenSet();
- private static readonly FrozenSet<string> SpecPolicyEventTypes = [..UserPolicyEventTypes, ..ServerPolicyEventTypes, ..RoomPolicyEventTypes];
+ public static readonly FrozenSet<string> UserPolicyEventTypes = EventContent.GetMatchingEventTypes<UserPolicyRuleEventContent>().ToFrozenSet();
+ public static readonly FrozenSet<string> ServerPolicyEventTypes = EventContent.GetMatchingEventTypes<ServerPolicyRuleEventContent>().ToFrozenSet();
+ public static readonly FrozenSet<string> RoomPolicyEventTypes = EventContent.GetMatchingEventTypes<RoomPolicyRuleEventContent>().ToFrozenSet();
+ public static readonly FrozenSet<string> SpecPolicyEventTypes = [..UserPolicyEventTypes, ..ServerPolicyEventTypes, ..RoomPolicyEventTypes];
public async IAsyncEnumerable<StateEventResponse> GetPoliciesAsync() {
var fullRoomState = GetFullStateAsync();
|