about summary refs log tree commit diff
path: root/MatrixRoomUtils.Core/Responses
diff options
context:
space:
mode:
Diffstat (limited to 'MatrixRoomUtils.Core/Responses')
-rw-r--r--MatrixRoomUtils.Core/Responses/Admin/AdminRoomDeleteRequest.cs18
-rw-r--r--MatrixRoomUtils.Core/Responses/Admin/AdminRoomListingResult.cs64
-rw-r--r--MatrixRoomUtils.Core/Responses/CreateRoomRequest.cs76
-rw-r--r--MatrixRoomUtils.Core/Responses/CreationContentBaseType.cs18
-rw-r--r--MatrixRoomUtils.Core/Responses/LoginResponse.cs17
-rw-r--r--MatrixRoomUtils.Core/Responses/StateEventResponse.cs48
6 files changed, 0 insertions, 241 deletions
diff --git a/MatrixRoomUtils.Core/Responses/Admin/AdminRoomDeleteRequest.cs b/MatrixRoomUtils.Core/Responses/Admin/AdminRoomDeleteRequest.cs
deleted file mode 100644
index 5605329..0000000
--- a/MatrixRoomUtils.Core/Responses/Admin/AdminRoomDeleteRequest.cs
+++ /dev/null
@@ -1,18 +0,0 @@
-using System.Text.Json.Serialization;
-
-namespace MatrixRoomUtils.Core.Responses.Admin; 
-
-public class AdminRoomDeleteRequest {
-    [JsonPropertyName("new_room_user_id")]
-    public string? NewRoomUserId { get; set; }
-    [JsonPropertyName("room_name")]
-    public string? RoomName { get; set; }
-    [JsonPropertyName("block")]
-    public bool Block { get; set; }
-    [JsonPropertyName("purge")]
-    public bool Purge { get; set; }
-    [JsonPropertyName("message")]
-    public string? Message { get; set; }
-    [JsonPropertyName("force_purge")]
-    public bool ForcePurge { get; set; }
-}
\ No newline at end of file
diff --git a/MatrixRoomUtils.Core/Responses/Admin/AdminRoomListingResult.cs b/MatrixRoomUtils.Core/Responses/Admin/AdminRoomListingResult.cs
deleted file mode 100644
index d6da859..0000000
--- a/MatrixRoomUtils.Core/Responses/Admin/AdminRoomListingResult.cs
+++ /dev/null
@@ -1,64 +0,0 @@
-using System.Text.Json.Serialization;
-
-namespace MatrixRoomUtils.Core.Responses.Admin;
-
-public class AdminRoomListingResult {
-    [JsonPropertyName("offset")]
-    public int Offset { get; set; }
-
-    [JsonPropertyName("total_rooms")]
-    public int TotalRooms { get; set; }
-
-    [JsonPropertyName("next_batch")]
-    public int? NextBatch { get; set; }
-
-    [JsonPropertyName("prev_batch")]
-    public int? PrevBatch { get; set; }
-
-    [JsonPropertyName("rooms")]
-    public List<AdminRoomListingResultRoom> Rooms { get; set; } = new();
-
-    public class AdminRoomListingResultRoom {
-        [JsonPropertyName("room_id")]
-        public string RoomId { get; set; }
-
-        [JsonPropertyName("name")]
-        public string? Name { get; set; }
-
-        [JsonPropertyName("canonical_alias")]
-        public string? CanonicalAlias { get; set; }
-
-        [JsonPropertyName("joined_members")]
-        public int JoinedMembers { get; set; }
-
-        [JsonPropertyName("joined_local_members")]
-        public int JoinedLocalMembers { get; set; }
-
-        [JsonPropertyName("version")]
-        public string Version { get; set; }
-
-        [JsonPropertyName("creator")]
-        public string Creator { get; set; }
-
-        [JsonPropertyName("encryption")]
-        public string? Encryption { get; set; }
-
-        [JsonPropertyName("federatable")]
-        public bool Federatable { get; set; }
-
-        [JsonPropertyName("public")]
-        public bool Public { get; set; }
-
-        [JsonPropertyName("join_rules")]
-        public string? JoinRules { get; set; }
-
-        [JsonPropertyName("guest_access")]
-        public string? GuestAccess { get; set; }
-
-        [JsonPropertyName("history_visibility")]
-        public string? HistoryVisibility { get; set; }
-
-        [JsonPropertyName("state_events")]
-        public int StateEvents { get; set; }
-    }
-}
\ No newline at end of file
diff --git a/MatrixRoomUtils.Core/Responses/CreateRoomRequest.cs b/MatrixRoomUtils.Core/Responses/CreateRoomRequest.cs
deleted file mode 100644
index 540a323..0000000
--- a/MatrixRoomUtils.Core/Responses/CreateRoomRequest.cs
+++ /dev/null
@@ -1,76 +0,0 @@
-using System.Reflection;
-using System.Text.Json.Nodes;
-using System.Text.Json.Serialization;
-using System.Text.RegularExpressions;
-using MatrixRoomUtils.Core.Extensions;
-using MatrixRoomUtils.Core.Interfaces;
-using MatrixRoomUtils.Core.StateEventTypes;
-using MatrixRoomUtils.Core.StateEventTypes.Spec;
-
-namespace MatrixRoomUtils.Core.Responses;
-
-public class CreateRoomRequest {
-    [JsonIgnore] public CreationContentBaseType _creationContentBaseType;
-
-    public CreateRoomRequest() => _creationContentBaseType = new CreationContentBaseType(this);
-
-    [JsonPropertyName("name")]
-    public string Name { get; set; } = null!;
-
-    [JsonPropertyName("room_alias_name")]
-    public string RoomAliasName { get; set; } = null!;
-
-    //we dont want to use this, we want more control
-    // [JsonPropertyName("preset")]
-    // public string Preset { get; set; } = null!;
-
-    [JsonPropertyName("initial_state")]
-    public List<StateEvent> InitialState { get; set; } = null!;
-
-    [JsonPropertyName("visibility")]
-    public string Visibility { get; set; } = null!;
-
-    [JsonPropertyName("power_level_content_override")]
-    public RoomPowerLevelEventData PowerLevelContentOverride { get; set; } = null!;
-
-    [JsonPropertyName("creation_content")]
-    public JsonObject CreationContent { get; set; } = new();
-
-    /// <summary>
-    ///     For use only when you can't use the CreationContent property
-    /// </summary>
-
-    public StateEvent this[string event_type, string event_key = ""] {
-        get {
-            var stateEvent = InitialState.FirstOrDefault(x => x.Type == event_type && x.StateKey == event_key);
-            if (stateEvent == null) {
-                InitialState.Add(stateEvent = new StateEvent {
-                    Type = event_type,
-                    StateKey = event_key,
-                    TypedContent = Activator.CreateInstance(
-                        StateEvent.KnownStateEventTypes.FirstOrDefault(x =>
-                            x.GetCustomAttributes<MatrixEventAttribute>()?
-                                .Any(y => y.EventName == event_type) ?? false) ?? typeof(object)
-                        )
-                });
-            }
-            return stateEvent;
-        }
-        set {
-            var stateEvent = InitialState.FirstOrDefault(x => x.Type == event_type && x.StateKey == event_key);
-            if (stateEvent == null)
-                InitialState.Add(value);
-            else
-                InitialState[InitialState.IndexOf(stateEvent)] = value;
-        }
-    }
-
-    public Dictionary<string, string> Validate() {
-        Dictionary<string, string> errors = new();
-        if (!Regex.IsMatch(RoomAliasName, @"[a-zA-Z0-9_\-]+$"))
-            errors.Add("room_alias_name",
-                "Room alias name must only contain letters, numbers, underscores, and hyphens.");
-
-        return errors;
-    }
-}
diff --git a/MatrixRoomUtils.Core/Responses/CreationContentBaseType.cs b/MatrixRoomUtils.Core/Responses/CreationContentBaseType.cs
deleted file mode 100644
index 743c552..0000000
--- a/MatrixRoomUtils.Core/Responses/CreationContentBaseType.cs
+++ /dev/null
@@ -1,18 +0,0 @@
-using System.Text.Json.Serialization;
-
-namespace MatrixRoomUtils.Core.Responses;
-
-public class CreationContentBaseType {
-    private readonly CreateRoomRequest createRoomRequest;
-
-    public CreationContentBaseType(CreateRoomRequest createRoomRequest) => this.createRoomRequest = createRoomRequest;
-
-    [JsonPropertyName("type")]
-    public string Type {
-        get => (string)createRoomRequest.CreationContent["type"];
-        set {
-            if (value is "null" or "") createRoomRequest.CreationContent.Remove("type");
-            else createRoomRequest.CreationContent["type"] = value;
-        }
-    }
-}
\ No newline at end of file
diff --git a/MatrixRoomUtils.Core/Responses/LoginResponse.cs b/MatrixRoomUtils.Core/Responses/LoginResponse.cs
deleted file mode 100644
index 239ea03..0000000
--- a/MatrixRoomUtils.Core/Responses/LoginResponse.cs
+++ /dev/null
@@ -1,17 +0,0 @@
-using System.Text.Json.Serialization;
-
-namespace MatrixRoomUtils.Core.Responses;
-
-public class LoginResponse {
-    [JsonPropertyName("access_token")]
-    public string AccessToken { get; set; }
-
-    [JsonPropertyName("device_id")]
-    public string DeviceId { get; set; }
-
-    [JsonPropertyName("home_server")]
-    public string Homeserver { get; set; }
-
-    [JsonPropertyName("user_id")]
-    public string UserId { get; set; }
-}
\ No newline at end of file
diff --git a/MatrixRoomUtils.Core/Responses/StateEventResponse.cs b/MatrixRoomUtils.Core/Responses/StateEventResponse.cs
deleted file mode 100644
index a7f9187..0000000
--- a/MatrixRoomUtils.Core/Responses/StateEventResponse.cs
+++ /dev/null
@@ -1,48 +0,0 @@
-using System.Text.Json.Nodes;
-using System.Text.Json.Serialization;
-using MatrixRoomUtils.Core.Interfaces;
-
-namespace MatrixRoomUtils.Core.Responses;
-
-public class StateEventResponse : StateEvent {
-    [JsonPropertyName("origin_server_ts")]
-    public ulong OriginServerTs { get; set; }
-
-    [JsonPropertyName("room_id")]
-    public string RoomId { get; set; }
-
-    [JsonPropertyName("sender")]
-    public string Sender { get; set; }
-
-    [JsonPropertyName("unsigned")]
-    public UnsignedData? Unsigned { get; set; }
-
-    [JsonPropertyName("event_id")]
-    public string EventId { get; set; }
-
-    [JsonPropertyName("user_id")]
-    public string UserId { get; set; }
-
-    [JsonPropertyName("replaces_state")]
-    public string ReplacesState { get; set; }
-
-    public class UnsignedData {
-        [JsonPropertyName("age")]
-        public ulong? Age { get; set; }
-
-        [JsonPropertyName("redacted_because")]
-        public object? RedactedBecause { get; set; }
-
-        [JsonPropertyName("transaction_id")]
-        public string? TransactionId { get; set; }
-
-        [JsonPropertyName("replaces_state")]
-        public string? ReplacesState { get; set; }
-
-        [JsonPropertyName("prev_sender")]
-        public string? PrevSender { get; set; }
-
-        [JsonPropertyName("prev_content")]
-        public JsonObject? PrevContent { get; set; }
-    }
-}