about summary refs log tree commit diff
path: root/LibMatrix/Homeservers/ImplementationDetails/Synapse/Models/Responses/Destinations.cs
diff options
context:
space:
mode:
Diffstat (limited to 'LibMatrix/Homeservers/ImplementationDetails/Synapse/Models/Responses/Destinations.cs')
-rw-r--r--LibMatrix/Homeservers/ImplementationDetails/Synapse/Models/Responses/Destinations.cs56
1 files changed, 56 insertions, 0 deletions
diff --git a/LibMatrix/Homeservers/ImplementationDetails/Synapse/Models/Responses/Destinations.cs b/LibMatrix/Homeservers/ImplementationDetails/Synapse/Models/Responses/Destinations.cs
new file mode 100644
index 0000000..646a4b5
--- /dev/null
+++ b/LibMatrix/Homeservers/ImplementationDetails/Synapse/Models/Responses/Destinations.cs
@@ -0,0 +1,56 @@
+using System.Text.Json.Serialization;
+
+namespace LibMatrix.Homeservers.ImplementationDetails.Synapse.Models.Responses;
+
+public class SynapseAdminDestinationListResult : SynapseNextTokenTotalCollectionResult {
+    [JsonPropertyName("destinations")]
+    public List<SynapseAdminDestinationListResultDestination> Destinations { get; set; } = new();
+
+    public class SynapseAdminDestinationListResultDestination {
+        [JsonPropertyName("destination")]
+        public string Destination { get; set; }
+
+        [JsonPropertyName("retry_last_ts")]
+        public long RetryLastTs { get; set; }
+
+        [JsonPropertyName("retry_interval")]
+        public long RetryInterval { get; set; }
+
+        [JsonPropertyName("failure_ts")]
+        public long? FailureTs { get; set; }
+
+        [JsonPropertyName("last_successful_stream_ordering")]
+        public long? LastSuccessfulStreamOrdering { get; set; }
+
+        [JsonIgnore]
+        public DateTime? FailureTsDateTime {
+            get => FailureTs.HasValue ? DateTimeOffset.FromUnixTimeMilliseconds(FailureTs.Value).DateTime : null;
+            set => FailureTs = value.HasValue ? new DateTimeOffset(value.Value).ToUnixTimeMilliseconds() : null;
+        }
+
+        [JsonIgnore]
+        public DateTime? RetryLastTsDateTime {
+            get => DateTimeOffset.FromUnixTimeMilliseconds(RetryLastTs).DateTime;
+            set => RetryLastTs = new DateTimeOffset(value.Value).ToUnixTimeMilliseconds();
+        }
+
+        [JsonIgnore]
+        public TimeSpan RetryIntervalTimeSpan {
+            get => TimeSpan.FromMilliseconds(RetryInterval);
+            set => RetryInterval = (long)value.TotalMilliseconds;
+        }
+    }
+}
+
+public class SynapseAdminDestinationRoomListResult : SynapseNextTokenTotalCollectionResult {
+    [JsonPropertyName("rooms")]
+    public List<SynapseAdminDestinationRoomListResultRoom> Rooms { get; set; } = new();
+
+    public class SynapseAdminDestinationRoomListResultRoom {
+        [JsonPropertyName("room_id")]
+        public string RoomId { get; set; }
+
+        [JsonPropertyName("stream_ordering")]
+        public int StreamOrdering { get; set; }
+    }
+}
\ No newline at end of file