about summary refs log tree commit diff
path: root/LibMatrix/Homeservers/RemoteHomeServer.cs
diff options
context:
space:
mode:
Diffstat (limited to 'LibMatrix/Homeservers/RemoteHomeServer.cs')
-rw-r--r--LibMatrix/Homeservers/RemoteHomeServer.cs14
1 files changed, 8 insertions, 6 deletions
diff --git a/LibMatrix/Homeservers/RemoteHomeServer.cs b/LibMatrix/Homeservers/RemoteHomeServer.cs
index f8d61fd..a47b731 100644
--- a/LibMatrix/Homeservers/RemoteHomeServer.cs
+++ b/LibMatrix/Homeservers/RemoteHomeServer.cs
@@ -2,7 +2,6 @@ using System.Net.Http.Json;
 using System.Text.Json;
 using System.Text.Json.Serialization;
 using ArcaneLibs.Extensions;
-using LibMatrix.EventTypes.Spec.State;
 using LibMatrix.Extensions;
 using LibMatrix.Responses;
 using LibMatrix.Services;
@@ -10,6 +9,7 @@ using LibMatrix.Services;
 namespace LibMatrix.Homeservers;
 
 public class RemoteHomeserver(string baseUrl) {
+    
     public static async Task<RemoteHomeserver> Create(string baseUrl, string? proxy = null) {
         var homeserver = new RemoteHomeserver(baseUrl);
         homeserver.WellKnownUris = await new HomeserverResolverService().ResolveHomeserverFromWellKnown(baseUrl);
@@ -32,9 +32,10 @@ public class RemoteHomeserver(string baseUrl) {
 
     private Dictionary<string, object> _profileCache { get; set; } = new();
     public string BaseUrl { get; } = baseUrl;
-    public MatrixHttpClient ClientHttpClient { get; set; }
-    public MatrixHttpClient ServerHttpClient { get; set; }
-    public HomeserverResolverService.WellKnownUris WellKnownUris { get; set; }
+    
+    public MatrixHttpClient ClientHttpClient { get; set; } = null!;
+    public MatrixHttpClient ServerHttpClient { get; set; } = null!;
+    public HomeserverResolverService.WellKnownUris WellKnownUris { get; set; } = null!;
 
     public async Task<UserProfileResponse> GetProfileAsync(string mxid) {
         if (mxid is null) throw new ArgumentNullException(nameof(mxid));
@@ -63,7 +64,7 @@ public class RemoteHomeserver(string baseUrl) {
     public async Task<AliasResult> ResolveRoomAliasAsync(string alias) {
         var resp = await ClientHttpClient.GetAsync($"/_matrix/client/v3/directory/room/{alias.Replace("#", "%23")}");
         var data = await resp.Content.ReadFromJsonAsync<AliasResult>();
-        var text = await resp.Content.ReadAsStringAsync();
+        //var text = await resp.Content.ReadAsStringAsync();
         if (!resp.IsSuccessStatusCode) Console.WriteLine("ResolveAlias: " + data.ToJson());
         return data;
     }
@@ -119,8 +120,9 @@ public class RemoteHomeserver(string baseUrl) {
 public class ServerVersionResponse {
 
     [JsonPropertyName("server")]
-    public ServerInfo Server { get; set; }
+    public required ServerInfo Server { get; set; }
 
+    // ReSharper disable once ClassNeverInstantiated.Global
     public class ServerInfo {
         [JsonPropertyName("name")]
         public string Name { get; set; }