about summary refs log tree commit diff
path: root/LibMatrix/Filters
diff options
context:
space:
mode:
authorTheArcaneBrony <myrainbowdash949@gmail.com>2023-08-14 04:09:13 +0200
committerTheArcaneBrony <myrainbowdash949@gmail.com>2023-08-14 04:09:13 +0200
commit0d0511e35d9965fc0ea5190ae3347c3d77c3334c (patch)
treeb4e0c336cbccc37bd14952b447868a577ea15540 /LibMatrix/Filters
downloadLibMatrix-0d0511e35d9965fc0ea5190ae3347c3d77c3334c.tar.xz
Split LibMatrix into separate repo
Diffstat (limited to 'LibMatrix/Filters')
-rw-r--r--LibMatrix/Filters/LocalRoomQueryFilter.cs28
-rw-r--r--LibMatrix/Filters/SyncFilter.cs66
2 files changed, 94 insertions, 0 deletions
diff --git a/LibMatrix/Filters/LocalRoomQueryFilter.cs b/LibMatrix/Filters/LocalRoomQueryFilter.cs
new file mode 100644
index 0000000..668d408
--- /dev/null
+++ b/LibMatrix/Filters/LocalRoomQueryFilter.cs
@@ -0,0 +1,28 @@
+namespace LibMatrix.Filters;
+
+public class LocalRoomQueryFilter {
+    public string RoomIdContains { get; set; } = "";
+    public string NameContains { get; set; } = "";
+    public string CanonicalAliasContains { get; set; } = "";
+    public string VersionContains { get; set; } = "";
+    public string CreatorContains { get; set; } = "";
+    public string EncryptionContains { get; set; } = "";
+    public string JoinRulesContains { get; set; } = "";
+    public string GuestAccessContains { get; set; } = "";
+    public string HistoryVisibilityContains { get; set; } = "";
+
+    public bool Federatable { get; set; } = true;
+    public bool Public { get; set; } = true;
+
+    public int JoinedMembersGreaterThan { get; set; } = 0;
+    public int JoinedMembersLessThan { get; set; } = int.MaxValue;
+
+    public int JoinedLocalMembersGreaterThan { get; set; } = 0;
+    public int JoinedLocalMembersLessThan { get; set; } = int.MaxValue;
+    public int StateEventsGreaterThan { get; set; } = 0;
+    public int StateEventsLessThan { get; set; } = int.MaxValue;
+
+
+    public bool CheckFederation { get; set; }
+    public bool CheckPublic { get; set; }
+}
diff --git a/LibMatrix/Filters/SyncFilter.cs b/LibMatrix/Filters/SyncFilter.cs
new file mode 100644
index 0000000..c907f6b
--- /dev/null
+++ b/LibMatrix/Filters/SyncFilter.cs
@@ -0,0 +1,66 @@
+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; }
+
+
+        public class StateFilter : EventFilter {
+            [JsonPropertyName("contains_url")]
+            public bool? ContainsUrl { get; set; }
+
+            [JsonPropertyName("include_redundant_members")]
+            public bool? IncludeRedundantMembers { get; set; }
+
+            [JsonPropertyName("lazy_load_members")]
+            public bool? LazyLoadMembers { get; set; }
+
+            [JsonPropertyName("rooms")]
+            public List<string>? Rooms { get; set; }
+
+            [JsonPropertyName("not_rooms")]
+            public List<string>? NotRooms { get; set; }
+
+            [JsonPropertyName("unread_thread_notifications")]
+            public bool? UnreadThreadNotifications { get; set; }
+        }
+    }
+
+    public class EventFilter {
+        [JsonPropertyName("limit")]
+        public int? Limit { get; set; }
+
+        [JsonPropertyName("types")]
+        public List<string>? Types { get; set; }
+
+        [JsonPropertyName("not_types")]
+        public List<string>? NotTypes { get; set; }
+
+        [JsonPropertyName("senders")]
+        public List<string>? Senders { get; set; }
+
+        [JsonPropertyName("not_senders")]
+        public List<string>? NotSenders { get; set; }
+    }
+}