diff options
author | Rory& <root@rory.gay> | 2024-05-30 19:07:09 +0000 |
---|---|---|
committer | Rory& <root@rory.gay> | 2024-05-30 19:07:09 +0000 |
commit | cf90f02e1f9c9f7d037976cace2b9c49119c741c (patch) | |
tree | 3925bd8d689c3f330c217b0f867ba8a241d893e7 /LibMatrix/Filters/MatrixFilter.cs | |
parent | Rename legacy event types (diff) | |
download | LibMatrix-cf90f02e1f9c9f7d037976cace2b9c49119c741c.tar.xz |
Start implementing new event system
Diffstat (limited to 'LibMatrix/Filters/MatrixFilter.cs')
-rw-r--r-- | LibMatrix/Filters/MatrixFilter.cs | 87 |
1 files changed, 87 insertions, 0 deletions
diff --git a/LibMatrix/Filters/MatrixFilter.cs b/LibMatrix/Filters/MatrixFilter.cs new file mode 100644 index 0000000..08dc2fc --- /dev/null +++ b/LibMatrix/Filters/MatrixFilter.cs @@ -0,0 +1,87 @@ +using System.Text.Json.Serialization; + +namespace LibMatrix.Filters; + +public class MatrixFilter { + [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; } + + 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 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; + } +} \ No newline at end of file |